[Mesa-dev] [PATCH 01/11] spirv: Handle tessellation execution modes.

Kenneth Graunke kenneth at whitecape.org
Mon Jan 9 05:26:40 UTC 2017


Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/spirv/spirv_to_nir.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

One totally bogus thing here: we set CCW backwards.  In all three driver
backends (i965, nvc0, radeonsi), we invert CCW because it doesn't seem to
match the HW.  That means that Vulkan CCW and HW CCW match, and it's just
OpenGL that's backwards.  We should figure out what's actually going on
here and decide which meaning we want to go with.

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 41da0e85c9d..8f19afa77ee 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2655,8 +2655,12 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
       break; /* Nothing to do with this */
 
    case SpvExecutionModeOutputVertices:
-      assert(b->shader->stage == MESA_SHADER_GEOMETRY);
-      b->shader->info->gs.vertices_out = mode->literals[0];
+      if (b->shader->stage == MESA_SHADER_TESS_CTRL) {
+         b->shader->info->tcs.vertices_out = mode->literals[0];
+      } else {
+         assert(b->shader->stage == MESA_SHADER_GEOMETRY);
+         b->shader->info->gs.vertices_out = mode->literals[0];
+      }
       break;
 
    case SpvExecutionModeInputPoints:
@@ -2666,11 +2670,13 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
    case SpvExecutionModeInputTrianglesAdjacency:
    case SpvExecutionModeQuads:
    case SpvExecutionModeIsolines:
-      if (b->shader->stage == MESA_SHADER_GEOMETRY) {
+      if (b->shader->stage == MESA_SHADER_TESS_EVAL) {
+         b->shader->info->tes.primitive_mode =
+            gl_primitive_from_spv_execution_mode(mode->exec_mode);
+      } else {
+         assert(b->shader->stage == MESA_SHADER_GEOMETRY);
          b->shader->info->gs.vertices_in =
             vertices_in_from_spv_execution_mode(mode->exec_mode);
-      } else {
-         assert(!"Tesselation shaders not yet supported");
       }
       break;
 
@@ -2683,12 +2689,22 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
       break;
 
    case SpvExecutionModeSpacingEqual:
+      b->shader->info->tes.spacing = TESS_SPACING_EQUAL;
+      break;
    case SpvExecutionModeSpacingFractionalEven:
+      b->shader->info->tes.spacing = TESS_SPACING_FRACTIONAL_EVEN;
+      break;
    case SpvExecutionModeSpacingFractionalOdd:
+      b->shader->info->tes.spacing = TESS_SPACING_FRACTIONAL_ODD;
+      break;
    case SpvExecutionModeVertexOrderCw:
+      b->shader->info->tes.ccw = true;
+      break;
    case SpvExecutionModeVertexOrderCcw:
+      b->shader->info->tes.ccw = false;
+      break;
    case SpvExecutionModePointMode:
-      assert(!"TODO: Add tessellation metadata");
+      b->shader->info->tes.point_mode = true;
       break;
 
    case SpvExecutionModePixelCenterInteger:
-- 
2.11.0



More information about the mesa-dev mailing list