aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-18 17:28:19 -0700
committerJason Ekstrand <[email protected]>2017-12-02 08:09:11 -0800
commite19c623128ef07c778f5f587864361c1ff383695 (patch)
treea555c61ff96823ac171d15cab6c7401ab1a07806 /src/compiler/spirv
parent6bd876dcaa4403b30eedd5ebe66bfadcef1f1a0c (diff)
spirv: Convert the supported_extensions struct to spirv_options
This is a bit more general and lets us pass additional options into the spirv_to_nir pass beyond what capabilities we support. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/nir_spirv.h26
-rw-r--r--src/compiler/spirv/spirv_to_nir.c10
-rw-r--r--src/compiler/spirv/vtn_private.h2
3 files changed, 20 insertions, 18 deletions
diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h
index 83577fb5d23..234b0ce3444 100644
--- a/src/compiler/spirv/nir_spirv.h
+++ b/src/compiler/spirv/nir_spirv.h
@@ -42,24 +42,26 @@ struct nir_spirv_specialization {
};
};
-struct nir_spirv_supported_extensions {
- bool float64;
- bool image_ms_array;
- bool tessellation;
- bool draw_parameters;
- bool image_read_without_format;
- bool image_write_without_format;
- bool int64;
- bool multiview;
- bool variable_pointers;
+struct spirv_to_nir_options {
+ struct {
+ bool float64;
+ bool image_ms_array;
+ bool tessellation;
+ bool draw_parameters;
+ bool image_read_without_format;
+ bool image_write_without_format;
+ bool int64;
+ bool multiview;
+ bool variable_pointers;
+ } caps;
};
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);
+ const struct spirv_to_nir_options *options,
+ const nir_shader_compiler_options *nir_options);
#ifdef __cplusplus
}
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 2c4f5b0c93e..b36772caad1 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2675,7 +2675,7 @@ stage_for_execution_model(SpvExecutionModel model)
}
#define spv_check_supported(name, cap) do { \
- if (!(b->ext && b->ext->name)) \
+ if (!(b->options && b->options->caps.name)) \
vtn_warn("Unsupported SPIR-V capability: %s", \
spirv_capability_to_string(cap)); \
} while(0)
@@ -3316,8 +3316,8 @@ 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 struct spirv_to_nir_options *options,
+ const nir_shader_compiler_options *nir_options)
{
const uint32_t *word_end = words + word_count;
@@ -3339,7 +3339,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;
+ b->options = options;
/* Handle all the preamble instructions */
words = vtn_foreach_instruction(b, words, word_end,
@@ -3351,7 +3351,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
return NULL;
}
- b->shader = nir_shader_create(NULL, stage, options, NULL);
+ b->shader = nir_shader_create(NULL, stage, nir_options, NULL);
/* Set shader info defaults */
b->shader->info.gs.invocations = 1;
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 751f5011b7d..b4380294048 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -467,7 +467,7 @@ struct vtn_builder {
nir_builder nb;
nir_shader *shader;
- const struct nir_spirv_supported_extensions *ext;
+ const struct spirv_to_nir_options *options;
struct vtn_block *block;
/* Current file, line, and column. Useful for debugging. Set