compiler: Change shader_info->tes.vertex_order into a ccw boolean.

The vertex order is either clockwise or counterclockwise.  We can just
store a "ccw" boolean rather than GLenum values.  I don't want to use
GLenums in a Vulkan driver, and even in GL a simple boolean works fine.

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:
Kenneth Graunke
2016-11-22 14:43:57 -08:00
parent faa1edeeb7
commit 9bb89175e6
4 changed files with 7 additions and 13 deletions

View File

@@ -150,7 +150,8 @@ typedef struct shader_info {
struct { struct {
uint32_t primitive_mode; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */ uint32_t primitive_mode; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */
uint32_t spacing; /* GL_EQUAL, GL_FRACTIONAL_EVEN, GL_FRACTIONAL_ODD */ uint32_t spacing; /* GL_EQUAL, GL_FRACTIONAL_EVEN, GL_FRACTIONAL_ODD */
uint32_t vertex_order; /* GL_CW or GL_CCW */ /** Is the vertex order counterclockwise? */
bool ccw;
bool point_mode; bool point_mode;
} tes; } tes;
}; };

View File

@@ -127,16 +127,9 @@ brw_codegen_tes_prog(struct brw_context *brw,
prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_LINE; prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_LINE;
} else { } else {
/* Hardware winding order is backwards from OpenGL */ /* Hardware winding order is backwards from OpenGL */
switch (tep->program.info.tes.vertex_order) { prog_data.output_topology =
case GL_CCW: tep->program.info.tes.ccw ? BRW_TESS_OUTPUT_TOPOLOGY_TRI_CW
prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_TRI_CW; : BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW;
break;
case GL_CW:
prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW;
break;
default:
unreachable("invalid domain shader vertex order");
}
} }
/* Allocate the references to the uniforms that will end up in the /* Allocate the references to the uniforms that will end up in the

View File

@@ -2176,7 +2176,7 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src,
case MESA_SHADER_TESS_EVAL: { case MESA_SHADER_TESS_EVAL: {
dst->info.tes.primitive_mode = dst_sh->info.TessEval.PrimitiveMode; dst->info.tes.primitive_mode = dst_sh->info.TessEval.PrimitiveMode;
dst->info.tes.spacing = dst_sh->info.TessEval.Spacing; dst->info.tes.spacing = dst_sh->info.TessEval.Spacing;
dst->info.tes.vertex_order = dst_sh->info.TessEval.VertexOrder; dst->info.tes.ccw = dst_sh->info.TessEval.VertexOrder == GL_CCW;
dst->info.tes.point_mode = dst_sh->info.TessEval.PointMode; dst->info.tes.point_mode = dst_sh->info.TessEval.PointMode;
dst->ClipDistanceArraySize = src->TessEval.ClipDistanceArraySize; dst->ClipDistanceArraySize = src->TessEval.ClipDistanceArraySize;
dst->CullDistanceArraySize = src->TessEval.CullDistanceArraySize; dst->CullDistanceArraySize = src->TessEval.CullDistanceArraySize;

View File

@@ -1624,7 +1624,7 @@ st_translate_tesseval_program(struct st_context *st,
} }
ureg_property(ureg, TGSI_PROPERTY_TES_VERTEX_ORDER_CW, ureg_property(ureg, TGSI_PROPERTY_TES_VERTEX_ORDER_CW,
sttep->Base.info.tes.vertex_order == GL_CW); !sttep->Base.info.tes.ccw);
ureg_property(ureg, TGSI_PROPERTY_TES_POINT_MODE, ureg_property(ureg, TGSI_PROPERTY_TES_POINT_MODE,
sttep->Base.info.tes.point_mode); sttep->Base.info.tes.point_mode);