[Mesa-dev] [PATCH v2 03/14] spirv: Handle tessellation execution modes.

Jason Ekstrand jason at jlekstrand.net
Tue Jan 10 17:20:27 UTC 2017


Assuming the answer to both of the below questions is "yes", everything
except patch 10 is

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

I don't think caching will be all thar thard to fix.

On Tue, Jan 10, 2017 at 9:06 AM, Jason Ekstrand <jason at jlekstrand.net>
wrote:

> On Mon, Jan 9, 2017 at 11:37 PM, Kenneth Graunke <kenneth at whitecape.org>
> wrote:
>
>> v2: Use info->tess.
>>
>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>> Reviewed-by: Dave Airlie <airlied at redhat.com> [v1]
>> Reviewed-by: Iago Toral Quiroga <itoral at igalia.com> [v1]
>> Reviewed-by: Jason Ekstrand <jason at jlekstrand.net> [v1]
>> ---
>>  src/compiler/spirv/spirv_to_nir.c | 45 ++++++++++++++++++++++++++++++
>> +++------
>>  1 file changed, 39 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/compiler/spirv/spirv_to_nir.c
>> b/src/compiler/spirv/spirv_to_nir.c
>> index befee1a4b9b..8f662aa35e2 100644
>> --- a/src/compiler/spirv/spirv_to_nir.c
>> +++ b/src/compiler/spirv/spirv_to_nir.c
>> @@ -2753,8 +2753,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) {
>>
>
> Is this only allowed in TCS?  Just double-checking...
>
>
>> +         b->shader->info->tess.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:
>> @@ -2764,11 +2768,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) {
>>
>
> Same question here only TES.
>
>
>> +         b->shader->info->tess.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;
>>
>> @@ -2781,12 +2787,39 @@ vtn_handle_execution_mode(struct vtn_builder *b,
>> struct vtn_value *entry_point,
>>        break;
>>
>>     case SpvExecutionModeSpacingEqual:
>> +      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||
>> +             b->shader->stage == MESA_SHADER_TESS_EVAL);
>> +      b->shader->info->tess.spacing = TESS_SPACING_EQUAL;
>> +      break;
>>     case SpvExecutionModeSpacingFractionalEven:
>> +      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||
>> +             b->shader->stage == MESA_SHADER_TESS_EVAL);
>> +      b->shader->info->tess.spacing = TESS_SPACING_FRACTIONAL_EVEN;
>> +      break;
>>     case SpvExecutionModeSpacingFractionalOdd:
>> +      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||
>> +             b->shader->stage == MESA_SHADER_TESS_EVAL);
>> +      b->shader->info->tess.spacing = TESS_SPACING_FRACTIONAL_ODD;
>> +      break;
>>     case SpvExecutionModeVertexOrderCw:
>> +      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||
>> +             b->shader->stage == MESA_SHADER_TESS_EVAL);
>> +      /* Vulkan's notion of CCW seems to match the hardware backends,
>> +       * but be the opposite of OpenGL.  Currently NIR follows GL
>> semantics,
>> +       * so we set it backwards here.
>> +       */
>> +      b->shader->info->tess.ccw = true;
>> +      break;
>>     case SpvExecutionModeVertexOrderCcw:
>> +      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||
>> +             b->shader->stage == MESA_SHADER_TESS_EVAL);
>> +      /* Backwards; see above */
>> +      b->shader->info->tess.ccw = false;
>> +      break;
>>     case SpvExecutionModePointMode:
>> -      assert(!"TODO: Add tessellation metadata");
>> +      assert(b->shader->stage == MESA_SHADER_TESS_CTRL ||
>> +             b->shader->stage == MESA_SHADER_TESS_EVAL);
>> +      b->shader->info->tess.point_mode = true;
>>        break;
>>
>>     case SpvExecutionModePixelCenterInteger:
>> --
>> 2.11.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170110/6073effc/attachment.html>


More information about the mesa-dev mailing list