<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 9, 2017 at 11:37 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">v2: Use info->tess.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
Reviewed-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>> [v1]<br>
Reviewed-by: Iago Toral Quiroga <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> [v1]<br>
Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> [v1]<br>
---<br>
 src/compiler/spirv/spirv_to_<wbr>nir.c | 45 ++++++++++++++++++++++++++++++<wbr>+++------<br>
 1 file changed, 39 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index befee1a4b9b..8f662aa35e2 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -2753,8 +2753,12 @@ vtn_handle_execution_mode(<wbr>struct vtn_builder *b, struct vtn_value *entry_point,<br>
       break; /* Nothing to do with this */<br>
<br>
    case SpvExecutionModeOutputVertices<wbr>:<br>
-      assert(b->shader->stage == MESA_SHADER_GEOMETRY);<br>
-      b->shader->info->gs.vertices_<wbr>out = mode->literals[0];<br>
+      if (b->shader->stage == MESA_SHADER_TESS_CTRL) {<br></blockquote><div><br></div><div>Is this only allowed in TCS?  Just double-checking...<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+         b->shader->info->tess.tcs_<wbr>vertices_out = mode->literals[0];<br>
+      } else {<br>
+         assert(b->shader->stage == MESA_SHADER_GEOMETRY);<br>
+         b->shader->info->gs.vertices_<wbr>out = mode->literals[0];<br>
+      }<br>
       break;<br>
<br>
    case SpvExecutionModeInputPoints:<br>
@@ -2764,11 +2768,13 @@ vtn_handle_execution_mode(<wbr>struct vtn_builder *b, struct vtn_value *entry_point,<br>
    case SpvExecutionModeInputTriangles<wbr>Adjacency:<br>
    case SpvExecutionModeQuads:<br>
    case SpvExecutionModeIsolines:<br>
-      if (b->shader->stage == MESA_SHADER_GEOMETRY) {<br>
+      if (b->shader->stage == MESA_SHADER_TESS_EVAL) {<br></blockquote><div><br></div><div>Same question here only TES.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+         b->shader->info->tess.<wbr>primitive_mode =<br>
+            gl_primitive_from_spv_<wbr>execution_mode(mode->exec_<wbr>mode);<br>
+      } else {<br>
+         assert(b->shader->stage == MESA_SHADER_GEOMETRY);<br>
          b->shader->info->gs.vertices_<wbr>in =<br>
             vertices_in_from_spv_<wbr>execution_mode(mode->exec_<wbr>mode);<br>
-      } else {<br>
-         assert(!"Tesselation shaders not yet supported");<br>
       }<br>
       break;<br>
<br>
@@ -2781,12 +2787,39 @@ vtn_handle_execution_mode(<wbr>struct vtn_builder *b, struct vtn_value *entry_point,<br>
       break;<br>
<br>
    case SpvExecutionModeSpacingEqual:<br>
+      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||<br>
+             b->shader->stage == MESA_SHADER_TESS_EVAL);<br>
+      b->shader->info->tess.spacing = TESS_SPACING_EQUAL;<br>
+      break;<br>
    case SpvExecutionModeSpacingFractio<wbr>nalEven:<br>
+      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||<br>
+             b->shader->stage == MESA_SHADER_TESS_EVAL);<br>
+      b->shader->info->tess.spacing = TESS_SPACING_FRACTIONAL_EVEN;<br>
+      break;<br>
    case SpvExecutionModeSpacingFractio<wbr>nalOdd:<br>
+      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||<br>
+             b->shader->stage == MESA_SHADER_TESS_EVAL);<br>
+      b->shader->info->tess.spacing = TESS_SPACING_FRACTIONAL_ODD;<br>
+      break;<br>
    case SpvExecutionModeVertexOrderCw:<br>
+      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||<br>
+             b->shader->stage == MESA_SHADER_TESS_EVAL);<br>
+      /* Vulkan's notion of CCW seems to match the hardware backends,<br>
+       * but be the opposite of OpenGL.  Currently NIR follows GL semantics,<br>
+       * so we set it backwards here.<br>
+       */<br>
+      b->shader->info->tess.ccw = true;<br>
+      break;<br>
    case SpvExecutionModeVertexOrderCcw<wbr>:<br>
+      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||<br>
+             b->shader->stage == MESA_SHADER_TESS_EVAL);<br>
+      /* Backwards; see above */<br>
+      b->shader->info->tess.ccw = false;<br>
+      break;<br>
    case SpvExecutionModePointMode:<br>
-      assert(!"TODO: Add tessellation metadata");<br>
+      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||<br>
+             b->shader->stage == MESA_SHADER_TESS_EVAL);<br>
+      b->shader->info->tess.point_<wbr>mode = true;<br>
       break;<br>
<br>
    case SpvExecutionModePixelCenterInt<wbr>eger:<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>