[Mesa-dev] [PATCH 01/11] spirv: Handle tessellation execution modes.
Jason Ekstrand
jason at jlekstrand.net
Mon Jan 9 16:53:35 UTC 2017
On Sun, Jan 8, 2017 at 9:26 PM, 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.
>
> 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;
>
Given the issues we found with point_mode, I think we want to assert that
we're in the right stage on all of these.
> + break;
> case SpvExecutionModePointMode:
> - assert(!"TODO: Add tessellation metadata");
> + b->shader->info->tes.point_mode = true;
>
these can come through either stage so we need to have them in both tes and
tcs and switch correctly.
> 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/20170109/96e7c468/attachment.html>
More information about the mesa-dev
mailing list