diff options
author | Kenneth Graunke <[email protected]> | 2016-09-25 14:23:55 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-01-10 13:21:24 -0800 |
commit | 23710e17f8cce92b58bd48149440dae03a7a103b (patch) | |
tree | 8551dcd8cf71b1f1195c2775a8b97fbd6f49a0d1 /src | |
parent | 5edc3381628d1db4468f31b1c66bb518146e35b5 (diff) |
spirv: Handle tessellation execution modes.
v2: Use info->tess.
v3: Handle more things in either TCS/TES.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Dave Airlie <[email protected]> [v1]
Reviewed-by: Iago Toral Quiroga <[email protected]> [v1]
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index befee1a4b9b..640f6296a77 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2753,8 +2753,13 @@ 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->stage == MESA_SHADER_TESS_EVAL) { + 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 +2769,14 @@ 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_CTRL || + b->shader->stage == MESA_SHADER_TESS_EVAL) { + 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 +2789,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: |