diff options
author | Kenneth Graunke <[email protected]> | 2016-11-22 14:43:57 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-01-07 20:42:32 -0800 |
commit | 9bb89175e6487186389b69e8ee0b587d38ed8015 (patch) | |
tree | e1aa28ac935aac1f5d089ad88bd7b7f26f3d1207 /src | |
parent | faa1edeeb7bbe9321c79587e592dce812e8caa78 (diff) |
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]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/shader_info.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tes.c | 13 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 2 | ||||
-rw-r--r-- | 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 181f85febac..24b1291f2f5 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 06862df8346..2dae1e57f41 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 571b35be58b..f198a3c6302 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 e9dd5846698..7d548d51c13 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); |