compiler: Change shader_info->tes.vertex_order into a ccw boolean.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 22 Nov 2016 22:43:57 +0000 (14:43 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sun, 8 Jan 2017 04:42:32 +0000 (20:42 -0800)
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>
src/compiler/shader_info.h
src/mesa/drivers/dri/i965/brw_tes.c
src/mesa/main/shaderapi.c
src/mesa/state_tracker/st_program.c

index 181f85febac26adcd4b2e6a50d32452f5cac5f73..24b1291f2f5fab2b836d6f42789afb0ba32a4de3 100644 (file)
@@ -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;
    };
index 06862df834649cb587c7f64a66900ac3c1079f0e..2dae1e57f416f16877e2fe05b70041017db44529 100644 (file)
@@ -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
index 571b35be58b4d6cc95953343ebbba02ff3d15640..f198a3c6302cd1b88d275f9029bf0360a7afeb96 100644 (file)
@@ -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;
index e9dd5846698f688c41cfd9d9d4a6e3e00d97ce6b..7d548d51c13385f339ab1f10638e4578dacbe8e4 100644 (file)
@@ -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);