summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/spirv/nir_spirv.h6
-rw-r--r--src/compiler/spirv/spirv2nir.c2
-rw-r--r--src/compiler/spirv/spirv_to_nir.c17
-rw-r--r--src/compiler/spirv/vtn_private.h1
4 files changed, 23 insertions, 3 deletions
diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h
index 500f2cb94df..d959f3f227c 100644
--- a/src/compiler/spirv/nir_spirv.h
+++ b/src/compiler/spirv/nir_spirv.h
@@ -41,10 +41,16 @@ struct nir_spirv_specialization {
uint32_t data;
};
+struct nir_spirv_supported_extensions {
+ bool storage_image_extended_formats;
+ bool image_ms_array;
+};
+
nir_function *spirv_to_nir(const uint32_t *words, size_t word_count,
struct nir_spirv_specialization *specializations,
unsigned num_specializations,
gl_shader_stage stage, const char *entry_point_name,
+ const struct nir_spirv_supported_extensions *ext,
const nir_shader_compiler_options *options);
#ifdef __cplusplus
diff --git a/src/compiler/spirv/spirv2nir.c b/src/compiler/spirv/spirv2nir.c
index 3dc07351322..0ae14fb19b1 100644
--- a/src/compiler/spirv/spirv2nir.c
+++ b/src/compiler/spirv/spirv2nir.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
}
nir_function *func = spirv_to_nir(map, word_count, NULL, 0,
- MESA_SHADER_FRAGMENT, "main", NULL);
+ MESA_SHADER_FRAGMENT, "main", NULL, NULL);
nir_print_shader(func->shader, stderr);
return 0;
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,
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 47579fe0fb9..9302611803f 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -347,6 +347,7 @@ struct vtn_builder {
nir_shader *shader;
nir_function_impl *impl;
+ const struct nir_spirv_supported_extensions *ext;
struct vtn_block *block;
/* Current file, line, and column. Useful for debugging. Set