summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-09-24 17:59:55 -0700
committerKenneth Graunke <[email protected]>2017-01-07 22:22:28 -0800
commita4fd84ef5f247f50a3683ecdf7f9d801a6e3cf15 (patch)
treedcf2a26e9a8cde7d6bc77fee2aaf8b655fe11adc /src/compiler
parent9bb89175e6487186389b69e8ee0b587d38ed8015 (diff)
mesa: Introduce a compiler enum for tessellation spacing.
It feels weird using GL_* enums in a Vulkan driver. v2: Fix the TESS_SPACING -> PIPE_TESS_SPACING conversion. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/ast.h2
-rw-r--r--src/compiler/glsl/glsl_parser.yy8
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp2
-rw-r--r--src/compiler/glsl/linker.cpp6
-rw-r--r--src/compiler/shader_enums.h8
-rw-r--r--src/compiler/shader_info.h2
6 files changed, 18 insertions, 10 deletions
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 0e32c36528e..e3f629e3419 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -704,7 +704,7 @@ struct ast_type_qualifier {
ast_layout_expression *local_size[3];
/** Tessellation evaluation shader: vertex spacing (equal, fractional even/odd) */
- GLenum vertex_spacing;
+ enum gl_tess_spacing vertex_spacing;
/** Tessellation evaluation shader: vertex ordering (CW or CCW) */
GLenum ordering;
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index e3893d5ec3b..519e35b6d53 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1463,11 +1463,11 @@ layout_qualifier_id:
if (!$$.flags.i) {
static const struct {
const char *s;
- GLenum e;
+ enum gl_tess_spacing e;
} map[] = {
- { "equal_spacing", GL_EQUAL },
- { "fractional_odd_spacing", GL_FRACTIONAL_ODD },
- { "fractional_even_spacing", GL_FRACTIONAL_EVEN },
+ { "equal_spacing", TESS_SPACING_EQUAL },
+ { "fractional_odd_spacing", TESS_SPACING_FRACTIONAL_ODD },
+ { "fractional_even_spacing", TESS_SPACING_FRACTIONAL_EVEN },
};
for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
if (match_layout_qualifier($1, map[i].s, state) == 0) {
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index e97cbf4b826..1b84876079d 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -1732,7 +1732,7 @@ set_shader_inout_layout(struct gl_shader *shader,
if (state->in_qualifier->flags.q.prim_type)
shader->info.TessEval.PrimitiveMode = state->in_qualifier->prim_type;
- shader->info.TessEval.Spacing = 0;
+ shader->info.TessEval.Spacing = TESS_SPACING_UNSPECIFIED;
if (state->in_qualifier->flags.q.vertex_spacing)
shader->info.TessEval.Spacing = state->in_qualifier->vertex_spacing;
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index d4a484fdea0..bf902bd862a 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -1721,7 +1721,7 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog,
unsigned num_shaders)
{
linked_shader->info.TessEval.PrimitiveMode = PRIM_UNKNOWN;
- linked_shader->info.TessEval.Spacing = 0;
+ linked_shader->info.TessEval.Spacing = TESS_SPACING_UNSPECIFIED;
linked_shader->info.TessEval.VertexOrder = 0;
linked_shader->info.TessEval.PointMode = -1;
@@ -1804,8 +1804,8 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog,
return;
}
- if (linked_shader->info.TessEval.Spacing == 0)
- linked_shader->info.TessEval.Spacing = GL_EQUAL;
+ if (linked_shader->info.TessEval.Spacing == TESS_SPACING_UNSPECIFIED)
+ linked_shader->info.TessEval.Spacing = TESS_SPACING_EQUAL;
if (linked_shader->info.TessEval.VertexOrder == 0)
linked_shader->info.TessEval.VertexOrder = GL_CCW;
diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index bb9f53d2e17..98565c80cb8 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -591,6 +591,14 @@ enum gl_advanced_blend_mode
BLEND_ALL = 0x7fff,
};
+enum gl_tess_spacing
+{
+ TESS_SPACING_UNSPECIFIED,
+ TESS_SPACING_EQUAL,
+ TESS_SPACING_FRACTIONAL_ODD,
+ TESS_SPACING_FRACTIONAL_EVEN,
+};
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 24b1291f2f5..1dd687e9b89 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -149,7 +149,7 @@ typedef struct shader_info {
struct {
uint32_t primitive_mode; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */
- uint32_t spacing; /* GL_EQUAL, GL_FRACTIONAL_EVEN, GL_FRACTIONAL_ODD */
+ enum gl_tess_spacing spacing;
/** Is the vertex order counterclockwise? */
bool ccw;
bool point_mode;