diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-03-28 10:23:02 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-04-08 19:29:33 -0700 |
commit | bd73531677f45b4ab1bebb910ab2b0e24c349643 (patch) | |
tree | 39e12599d598426485e269ddf2f6840f76b1bbcf | |
parent | 956226c8bae100cad9d2da539cf71fd26a382df7 (diff) |
spirv: Add support for DerivativeGroup capabilities
As defined in SPV_NV_compute_shader_derivatives. These control how the
invocations are arranged in a CS when doing derivative and related
operations (which are also enabled by the extension).
Since we expect valid SPIR-V, we don't need to do more work at SPIR-V
level to enable the derivative and related operations to be called.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/compiler/shader_info.h | 1 | ||||
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 78f4032362a..0b67082a732 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -35,6 +35,7 @@ extern "C" { struct spirv_supported_capabilities { bool address; bool atomic_storage; + bool derivative_group; bool descriptor_array_dynamic_indexing; bool device_group; bool draw_parameters; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 8c2b995be8f..98205a1b8b2 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3776,6 +3776,11 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, spv_check_supported(physical_storage_buffer_address, cap); break; + case SpvCapabilityComputeDerivativeGroupQuadsNV: + case SpvCapabilityComputeDerivativeGroupLinearNV: + spv_check_supported(derivative_group, cap); + break; + default: vtn_fail("Unhandled capability"); } @@ -4019,6 +4024,16 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, vtn_assert(b->shader->info.stage == MESA_SHADER_FRAGMENT); break; + case SpvExecutionModeDerivativeGroupQuadsNV: + vtn_assert(b->shader->info.stage == MESA_SHADER_COMPUTE); + b->shader->info.cs.derivative_group = DERIVATIVE_GROUP_QUADS; + break; + + case SpvExecutionModeDerivativeGroupLinearNV: + vtn_assert(b->shader->info.stage == MESA_SHADER_COMPUTE); + b->shader->info.cs.derivative_group = DERIVATIVE_GROUP_LINEAR; + break; + default: vtn_fail("Unhandled execution mode"); } |