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

Dave Airlie airlied at gmail.com
Mon Jan 9 05:36:21 UTC 2017


On 9 January 2017 at 15:26, Kenneth Graunke <kenneth at whitecape.org> wrote:
> 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.

Maybe put this comment in the code where we assign it backwards,

Otherwise:

Reviewed-by: Dave Airlie <airlied at redhat.com>
>
> 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list