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

Iago Toral itoral at igalia.com
Mon Jan 9 15:33:14 UTC 2017


Patches 1-5 are:
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

On Sun, 2017-01-08 at 21:26 -0800, Kenneth Graunke 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.
> 
> 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:


More information about the mesa-dev mailing list