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 <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user