[Mesa-dev] [PATCH 07/24] spirv_extensions: rename nir_spirv_supported_extensions
From: Alejandro Piñeiro Renamed to nir_spirv_supported_capabilities. The original name seemed to suggest that it was directly related to the SPIR-V extensions supported, but that is not the case. For example, float64 was supported on SPIR-V 1.0 core, without the need of any extra extension. Additionally, this is used at spirv_to_nir to check if a given capability is supported or not (see spv_check_supported), not if a given extension is supported or not. One could argue that it should be renamed to something like nir_spirv_supported_extra_capabilities (or similar) as not all the capabilities are flagged there. In any case, that name seemed too long. This rename was triggered by the need of really maintain the SPIR-V supported extensions as part of ARB_spirv_extensions implementation, making that struct name confusing. --- src/amd/vulkan/radv_shader.c | 4 ++-- src/compiler/spirv/nir_spirv.h| 4 ++-- src/compiler/spirv/spirv_to_nir.c | 6 +++--- src/compiler/spirv/vtn_private.h | 2 +- src/intel/vulkan/anv_pipeline.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 32edf2abd22..cea61333ebc 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -196,7 +196,7 @@ radv_shader_compile_to_nir(struct radv_device *device, spec_entries[i].data32 = *(const uint32_t *)data; } } - const struct nir_spirv_supported_extensions supported_ext = { + const struct nir_spirv_supported_capabilities supported_cap = { .draw_parameters = true, .float64 = true, .image_read_without_format = true, @@ -208,7 +208,7 @@ radv_shader_compile_to_nir(struct radv_device *device, }; entry_point = spirv_to_nir(spirv, module->size / 4, spec_entries, num_spec_entries, - stage, entrypoint_name, &supported_ext, &nir_options); + stage, entrypoint_name, &supported_cap, &nir_options); nir = entry_point->shader; assert(nir->info.stage == stage); nir_validate_shader(nir); diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h index 83577fb5d23..0204e81d091 100644 --- a/src/compiler/spirv/nir_spirv.h +++ b/src/compiler/spirv/nir_spirv.h @@ -42,7 +42,7 @@ struct nir_spirv_specialization { }; }; -struct nir_spirv_supported_extensions { +struct nir_spirv_supported_capabilities { bool float64; bool image_ms_array; bool tessellation; @@ -58,7 +58,7 @@ 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 struct nir_spirv_supported_capabilities *cap, const nir_shader_compiler_options *options); #ifdef __cplusplus diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 027efab88d7..6034228ed36 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2672,7 +2672,7 @@ stage_for_execution_model(SpvExecutionModel model) } #define spv_check_supported(name, cap) do {\ - if (!(b->ext && b->ext->name)) \ + if (!(b->cap && b->cap->name)) \ vtn_warn("Unsupported SPIR-V capability: %s", \ spirv_capability_to_string(cap)); \ } while(0) @@ -3313,7 +3313,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 struct nir_spirv_supported_capabilities *cap, const nir_shader_compiler_options *options) { const uint32_t *word_end = words + word_count; @@ -3336,7 +3336,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->cap = cap; /* 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 6b4645acc8b..0c1ce21dd88 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -465,7 +465,7 @@ struct vtn_builder { nir_shader *sh
Re: [Mesa-dev] [PATCH 07/24] spirv_extensions: rename nir_spirv_supported_extensions
This patch is Reviewed-by: Ian Romanick On 11/15/2017 05:22 AM, Eduardo Lima Mitev wrote: > From: Alejandro Piñeiro > > Renamed to nir_spirv_supported_capabilities. > > The original name seemed to suggest that it was directly related to > the SPIR-V extensions supported, but that is not the case. For > example, float64 was supported on SPIR-V 1.0 core, without the need of > any extra extension. > > Additionally, this is used at spirv_to_nir to check if a given > capability is supported or not (see spv_check_supported), not if a > given extension is supported or not. > > One could argue that it should be renamed to something like > nir_spirv_supported_extra_capabilities (or similar) as not all the > capabilities are flagged there. In any case, that name seemed too long. > > This rename was triggered by the need of really maintain the SPIR-V > supported extensions as part of ARB_spirv_extensions implementation, > making that struct name confusing. > --- > src/amd/vulkan/radv_shader.c | 4 ++-- > src/compiler/spirv/nir_spirv.h| 4 ++-- > src/compiler/spirv/spirv_to_nir.c | 6 +++--- > src/compiler/spirv/vtn_private.h | 2 +- > src/intel/vulkan/anv_pipeline.c | 4 ++-- > 5 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c > index 32edf2abd22..cea61333ebc 100644 > --- a/src/amd/vulkan/radv_shader.c > +++ b/src/amd/vulkan/radv_shader.c > @@ -196,7 +196,7 @@ radv_shader_compile_to_nir(struct radv_device *device, > spec_entries[i].data32 = *(const > uint32_t *)data; > } > } > - const struct nir_spirv_supported_extensions supported_ext = { > + const struct nir_spirv_supported_capabilities supported_cap = { > .draw_parameters = true, > .float64 = true, > .image_read_without_format = true, > @@ -208,7 +208,7 @@ radv_shader_compile_to_nir(struct radv_device *device, > }; > entry_point = spirv_to_nir(spirv, module->size / 4, > spec_entries, num_spec_entries, > -stage, entrypoint_name, > &supported_ext, &nir_options); > +stage, entrypoint_name, > &supported_cap, &nir_options); > nir = entry_point->shader; > assert(nir->info.stage == stage); > nir_validate_shader(nir); > diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h > index 83577fb5d23..0204e81d091 100644 > --- a/src/compiler/spirv/nir_spirv.h > +++ b/src/compiler/spirv/nir_spirv.h > @@ -42,7 +42,7 @@ struct nir_spirv_specialization { > }; > }; > > -struct nir_spirv_supported_extensions { > +struct nir_spirv_supported_capabilities { > bool float64; > bool image_ms_array; > bool tessellation; > @@ -58,7 +58,7 @@ 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 struct nir_spirv_supported_capabilities > *cap, > const nir_shader_compiler_options *options); > > #ifdef __cplusplus > diff --git a/src/compiler/spirv/spirv_to_nir.c > b/src/compiler/spirv/spirv_to_nir.c > index 027efab88d7..6034228ed36 100644 > --- a/src/compiler/spirv/spirv_to_nir.c > +++ b/src/compiler/spirv/spirv_to_nir.c > @@ -2672,7 +2672,7 @@ stage_for_execution_model(SpvExecutionModel model) > } > > #define spv_check_supported(name, cap) do { \ > - if (!(b->ext && b->ext->name)) \ > + if (!(b->cap && b->cap->name)) \ > vtn_warn("Unsupported SPIR-V capability: %s", \ >spirv_capability_to_string(cap)); \ > } while(0) > @@ -3313,7 +3313,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 struct nir_spirv_supported_capabilities *cap, > const nir_shader_compiler_options *options) > { > const uint32_t *word_end = words + word_count; > @@ -3336,7 +3336,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->cap = cap; > > /* Handle all the preamble instructions */ > words = vtn_foreach_instruction(b