diff options
author | Dave Airlie <[email protected]> | 2016-12-27 23:27:14 +0000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2016-12-28 22:43:17 +0000 |
commit | de7dd4d621ca2654a1091457c514b50c50ba92dd (patch) | |
tree | eecaeb3f9575343e66ed18f4ee827a8be6798212 /src/compiler/spirv/spirv_to_nir.c | |
parent | 464b23b1f289e8f9ede7c9d817c1678bbef0ad8d (diff) |
spirv: add interface for drivers to define support extensions.
I expect over time the struct contents will change as all
drivers support stuff etc, but for now this should be a good
starting point.
Reviewed-by: Edward O'Callaghan <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Acked-by: Jason Ekstrand <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/spirv/spirv_to_nir.c')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 57d08865ff2..b8acc1ed2e9 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2461,6 +2461,12 @@ stage_for_execution_model(SpvExecutionModel model) } } +#define spv_check_supported(name, cap) do { \ + if (!(b->ext && b->ext->name)) \ + vtn_warn("Unsupported SPIR-V capability: %s", \ + spirv_capability_to_string(cap)); \ + } while(0) + static bool vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, const uint32_t *w, unsigned count) @@ -2519,8 +2525,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, case SpvCapabilityInt8: case SpvCapabilitySparseResidency: case SpvCapabilityMinLod: - case SpvCapabilityImageMSArray: - case SpvCapabilityStorageImageExtendedFormats: case SpvCapabilityTransformFeedback: case SpvCapabilityStorageImageReadWithoutFormat: case SpvCapabilityStorageImageWriteWithoutFormat: @@ -2541,6 +2545,13 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, vtn_warn("Unsupported OpenCL-style SPIR-V capability: %s", spirv_capability_to_string(cap)); break; + + case SpvCapabilityStorageImageExtendedFormats: + spv_check_supported(storage_image_extended_formats, cap); + break; + case SpvCapabilityImageMSArray: + spv_check_supported(image_ms_array, cap); + break; } break; } @@ -3015,6 +3026,7 @@ nir_function * spirv_to_nir(const uint32_t *words, size_t word_count, struct nir_spirv_specialization *spec, unsigned num_spec, gl_shader_stage stage, const char *entry_point_name, + const struct nir_spirv_supported_extensions *ext, const nir_shader_compiler_options *options) { const uint32_t *word_end = words + word_count; @@ -3037,6 +3049,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count, exec_list_make_empty(&b->functions); b->entry_point_stage = stage; b->entry_point_name = entry_point_name; + b->ext = ext; /* Handle all the preamble instructions */ words = vtn_foreach_instruction(b, words, word_end, |