Module: Mesa Branch: master Commit: 9bb89175e6487186389b69e8ee0b587d38ed8015 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bb89175e6487186389b69e8ee0b587d38ed8015
Author: Kenneth Graunke <[email protected]> Date: Tue Nov 22 14:43:57 2016 -0800 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 <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> --- src/compiler/shader_info.h | 3 ++- src/mesa/drivers/dri/i965/brw_tes.c | 13 +++---------- src/mesa/main/shaderapi.c | 2 +- src/mesa/state_tracker/st_program.c | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 181f85f..24b1291 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -150,7 +150,8 @@ 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 */ - uint32_t vertex_order; /* GL_CW or GL_CCW */ + /** Is the vertex order counterclockwise? */ + bool ccw; bool point_mode; } tes; }; diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 06862df..2dae1e5 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -127,16 +127,9 @@ brw_codegen_tes_prog(struct brw_context *brw, prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_LINE; } else { /* Hardware winding order is backwards from OpenGL */ - switch (tep->program.info.tes.vertex_order) { - case GL_CCW: - prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_TRI_CW; - break; - case GL_CW: - prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW; - break; - default: - unreachable("invalid domain shader vertex order"); - } + prog_data.output_topology = + tep->program.info.tes.ccw ? BRW_TESS_OUTPUT_TOPOLOGY_TRI_CW + : BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW; } /* Allocate the references to the uniforms that will end up in the diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 571b35b..f198a3c 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2176,7 +2176,7 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src, case MESA_SHADER_TESS_EVAL: { dst->info.tes.primitive_mode = dst_sh->info.TessEval.PrimitiveMode; 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->ClipDistanceArraySize = src->TessEval.ClipDistanceArraySize; dst->CullDistanceArraySize = src->TessEval.CullDistanceArraySize; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index e9dd584..7d548d5 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1624,7 +1624,7 @@ st_translate_tesseval_program(struct st_context *st, } 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, sttep->Base.info.tes.point_mode); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
