[Mesa-dev] [PATCH 07/24] spirv_extensions: rename nir_spirv_supported_extensions

Ian Romanick idr at freedesktop.org
Mon Nov 27 22:04:29 UTC 2017


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 11/15/2017 05:22 AM, Eduardo Lima Mitev wrote:
> From: Alejandro PiƱeiro <apinheiro at igalia.com>
> 
> 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 *shader;
>     nir_function_impl *impl;
> -   const struct nir_spirv_supported_extensions *ext;
> +   const struct nir_spirv_supported_capabilities *cap;
>     struct vtn_block *block;
>  
>     /* Current file, line, and column.  Useful for debugging.  Set
> diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
> index 907b24a758d..35d68f2d658 100644
> --- a/src/intel/vulkan/anv_pipeline.c
> +++ b/src/intel/vulkan/anv_pipeline.c
> @@ -132,7 +132,7 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,
>        }
>     }
>  
> -   const struct nir_spirv_supported_extensions supported_ext = {
> +   const struct nir_spirv_supported_capabilities supported_cap = {
>        .float64 = device->instance->physicalDevice.info.gen >= 8,
>        .int64 = device->instance->physicalDevice.info.gen >= 8,
>        .tessellation = true,
> @@ -145,7 +145,7 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,
>     nir_function *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_shader *nir = entry_point->shader;
>     assert(nir->info.stage == stage);
>     nir_validate_shader(nir);
> 



More information about the mesa-dev mailing list