Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-28 Thread Alejandro Piñeiro


On 28/11/17 14:13, Eric Engestrom wrote:
> On Tuesday, 2017-11-28 14:01:38 +0100, Alejandro Piñeiro wrote:
>> On 28/11/17 11:36, Eric Engestrom wrote:
>>> On Monday, 2017-11-27 13:21:31 +0200, Tapani Pälli wrote:
 On 11/15/2017 03:22 PM, Eduardo Lima Mitev wrote:
> From: Alejandro Piñeiro 
>
> Ideally this should be generated somehow. One option would be gather
> all the extension dependencies listed on the core grammar, but there
> would be the possibility of not including some of the extensions.
>
> Note that spirv-tools is doing it just slightly better, as it has a
> hardcoded list of extensions manually took from the registry, that
> they parse to get the enum and the to_string method (see
> generate_grammar_tables.py).
> ---
>   src/compiler/Makefile.sources |  2 +
>   src/compiler/spirv/spirv_extensions.c | 61 
> +++
>   src/compiler/spirv/spirv_extensions.h | 69 
> +++
>   3 files changed, 132 insertions(+)
>   create mode 100644 src/compiler/spirv/spirv_extensions.c
>   create mode 100644 src/compiler/spirv/spirv_extensions.h
>
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index 2ab8e163a26..f198456c751 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -293,6 +293,8 @@ SPIRV_FILES = \
>   spirv/GLSL.std.450.h \
>   spirv/nir_spirv.h \
>   spirv/spirv.h \
> + spirv/spirv_extensions.c \
> + spirv/spirv_extensions.h \
>   spirv/spirv_info.h \
>   spirv/spirv_to_nir.c \
>   spirv/vtn_alu.c \
> diff --git a/src/compiler/spirv/spirv_extensions.c 
> b/src/compiler/spirv/spirv_extensions.c
> new file mode 100644
> index 000..64d61c49d31
> --- /dev/null
> +++ b/src/compiler/spirv/spirv_extensions.c
> @@ -0,0 +1,61 @@
> +/*
> + * Copyright © 2017 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining 
> a
> + * copy of this software and associated documentation files (the 
> "Software"),
> + * to deal in the Software without restriction, including without 
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute, 
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the 
> next
> + * paragraph) shall be included in all copies or substantial portions of 
> the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT 
> SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
> ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include "spirv.h"
> +#include "spirv_extensions.h"
> +
> +const char *
> +spirv_extensions_to_string(SpvExtension ext)
> +{
> +   switch (ext) {
> +   case SPV_AMD_shader_explicit_vertex_parameter: return 
> "SPV_AMD_shader_explicit_vertex_parameter";
> +   case SPV_AMD_shader_trinary_minmax: return 
> "SPV_AMD_shader_trinary_minmax";
> +   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
> +   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
> +   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
> +   case SPV_AMD_gpu_shader_half_float: return 
> "SPV_AMD_gpu_shader_half_float";
> +   case SPV_KHR_shader_draw_parameters: return 
> "SPV_KHR_shader_draw_parameters";
> +   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
> +   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
> +   case SPV_KHR_device_group: return "SPV_KHR_device_group";
> +   case SPV_KHR_multiview: return "SPV_KHR_multiview";
> +   case SPV_NVX_multiview_per_view_attributes: return 
> "SPV_NVX_multiview_per_view_attributes";
> +   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
> +   case SPV_NV_stereo_view_rendering: return 
> "SPV_NV_stereo_view_rendering";
> +   case SPV_NV_sample_mask_override_coverage: return 
> "SPV_NV_sample_mask_override_coverage";
> +   case SPV_NV_geometry_shader_passthrough: return 
> "SPV_NV_geometry_shader_passthrough";
> +   case 

Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-28 Thread Eric Engestrom
On Tuesday, 2017-11-28 14:01:38 +0100, Alejandro Piñeiro wrote:
> On 28/11/17 11:36, Eric Engestrom wrote:
> > On Monday, 2017-11-27 13:21:31 +0200, Tapani Pälli wrote:
> >>
> >> On 11/15/2017 03:22 PM, Eduardo Lima Mitev wrote:
> >>> From: Alejandro Piñeiro 
> >>>
> >>> Ideally this should be generated somehow. One option would be gather
> >>> all the extension dependencies listed on the core grammar, but there
> >>> would be the possibility of not including some of the extensions.
> >>>
> >>> Note that spirv-tools is doing it just slightly better, as it has a
> >>> hardcoded list of extensions manually took from the registry, that
> >>> they parse to get the enum and the to_string method (see
> >>> generate_grammar_tables.py).
> >>> ---
> >>>   src/compiler/Makefile.sources |  2 +
> >>>   src/compiler/spirv/spirv_extensions.c | 61 
> >>> +++
> >>>   src/compiler/spirv/spirv_extensions.h | 69 
> >>> +++
> >>>   3 files changed, 132 insertions(+)
> >>>   create mode 100644 src/compiler/spirv/spirv_extensions.c
> >>>   create mode 100644 src/compiler/spirv/spirv_extensions.h
> >>>
> >>> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> >>> index 2ab8e163a26..f198456c751 100644
> >>> --- a/src/compiler/Makefile.sources
> >>> +++ b/src/compiler/Makefile.sources
> >>> @@ -293,6 +293,8 @@ SPIRV_FILES = \
> >>>   spirv/GLSL.std.450.h \
> >>>   spirv/nir_spirv.h \
> >>>   spirv/spirv.h \
> >>> + spirv/spirv_extensions.c \
> >>> + spirv/spirv_extensions.h \
> >>>   spirv/spirv_info.h \
> >>>   spirv/spirv_to_nir.c \
> >>>   spirv/vtn_alu.c \
> >>> diff --git a/src/compiler/spirv/spirv_extensions.c 
> >>> b/src/compiler/spirv/spirv_extensions.c
> >>> new file mode 100644
> >>> index 000..64d61c49d31
> >>> --- /dev/null
> >>> +++ b/src/compiler/spirv/spirv_extensions.c
> >>> @@ -0,0 +1,61 @@
> >>> +/*
> >>> + * Copyright © 2017 Intel Corporation
> >>> + *
> >>> + * Permission is hereby granted, free of charge, to any person obtaining 
> >>> a
> >>> + * copy of this software and associated documentation files (the 
> >>> "Software"),
> >>> + * to deal in the Software without restriction, including without 
> >>> limitation
> >>> + * the rights to use, copy, modify, merge, publish, distribute, 
> >>> sublicense,
> >>> + * and/or sell copies of the Software, and to permit persons to whom the
> >>> + * Software is furnished to do so, subject to the following conditions:
> >>> + *
> >>> + * The above copyright notice and this permission notice (including the 
> >>> next
> >>> + * paragraph) shall be included in all copies or substantial portions of 
> >>> the
> >>> + * Software.
> >>> + *
> >>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
> >>> EXPRESS OR
> >>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
> >>> MERCHANTABILITY,
> >>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT 
> >>> SHALL
> >>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
> >>> OTHER
> >>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
> >>> ARISING
> >>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> >>> DEALINGS
> >>> + * IN THE SOFTWARE.
> >>> + */
> >>> +
> >>> +#include "spirv.h"
> >>> +#include "spirv_extensions.h"
> >>> +
> >>> +const char *
> >>> +spirv_extensions_to_string(SpvExtension ext)
> >>> +{
> >>> +   switch (ext) {
> >>> +   case SPV_AMD_shader_explicit_vertex_parameter: return 
> >>> "SPV_AMD_shader_explicit_vertex_parameter";
> >>> +   case SPV_AMD_shader_trinary_minmax: return 
> >>> "SPV_AMD_shader_trinary_minmax";
> >>> +   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
> >>> +   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
> >>> +   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
> >>> +   case SPV_AMD_gpu_shader_half_float: return 
> >>> "SPV_AMD_gpu_shader_half_float";
> >>> +   case SPV_KHR_shader_draw_parameters: return 
> >>> "SPV_KHR_shader_draw_parameters";
> >>> +   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
> >>> +   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
> >>> +   case SPV_KHR_device_group: return "SPV_KHR_device_group";
> >>> +   case SPV_KHR_multiview: return "SPV_KHR_multiview";
> >>> +   case SPV_NVX_multiview_per_view_attributes: return 
> >>> "SPV_NVX_multiview_per_view_attributes";
> >>> +   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
> >>> +   case SPV_NV_stereo_view_rendering: return 
> >>> "SPV_NV_stereo_view_rendering";
> >>> +   case SPV_NV_sample_mask_override_coverage: return 
> >>> "SPV_NV_sample_mask_override_coverage";
> >>> +   case SPV_NV_geometry_shader_passthrough: return 
> >>> "SPV_NV_geometry_shader_passthrough";
> >>> +   case SPV_AMD_texture_gather_bias_lod: return 
> >>> 

Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-28 Thread Alejandro Piñeiro
On 28/11/17 11:36, Eric Engestrom wrote:
> On Monday, 2017-11-27 13:21:31 +0200, Tapani Pälli wrote:
>>
>> On 11/15/2017 03:22 PM, Eduardo Lima Mitev wrote:
>>> From: Alejandro Piñeiro 
>>>
>>> Ideally this should be generated somehow. One option would be gather
>>> all the extension dependencies listed on the core grammar, but there
>>> would be the possibility of not including some of the extensions.
>>>
>>> Note that spirv-tools is doing it just slightly better, as it has a
>>> hardcoded list of extensions manually took from the registry, that
>>> they parse to get the enum and the to_string method (see
>>> generate_grammar_tables.py).
>>> ---
>>>   src/compiler/Makefile.sources |  2 +
>>>   src/compiler/spirv/spirv_extensions.c | 61 +++
>>>   src/compiler/spirv/spirv_extensions.h | 69 
>>> +++
>>>   3 files changed, 132 insertions(+)
>>>   create mode 100644 src/compiler/spirv/spirv_extensions.c
>>>   create mode 100644 src/compiler/spirv/spirv_extensions.h
>>>
>>> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
>>> index 2ab8e163a26..f198456c751 100644
>>> --- a/src/compiler/Makefile.sources
>>> +++ b/src/compiler/Makefile.sources
>>> @@ -293,6 +293,8 @@ SPIRV_FILES = \
>>> spirv/GLSL.std.450.h \
>>> spirv/nir_spirv.h \
>>> spirv/spirv.h \
>>> +   spirv/spirv_extensions.c \
>>> +   spirv/spirv_extensions.h \
>>> spirv/spirv_info.h \
>>> spirv/spirv_to_nir.c \
>>> spirv/vtn_alu.c \
>>> diff --git a/src/compiler/spirv/spirv_extensions.c 
>>> b/src/compiler/spirv/spirv_extensions.c
>>> new file mode 100644
>>> index 000..64d61c49d31
>>> --- /dev/null
>>> +++ b/src/compiler/spirv/spirv_extensions.c
>>> @@ -0,0 +1,61 @@
>>> +/*
>>> + * Copyright © 2017 Intel Corporation
>>> + *
>>> + * Permission is hereby granted, free of charge, to any person obtaining a
>>> + * copy of this software and associated documentation files (the 
>>> "Software"),
>>> + * to deal in the Software without restriction, including without 
>>> limitation
>>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>>> + * and/or sell copies of the Software, and to permit persons to whom the
>>> + * Software is furnished to do so, subject to the following conditions:
>>> + *
>>> + * The above copyright notice and this permission notice (including the 
>>> next
>>> + * paragraph) shall be included in all copies or substantial portions of 
>>> the
>>> + * Software.
>>> + *
>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
>>> OR
>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
>>> OTHER
>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
>>> DEALINGS
>>> + * IN THE SOFTWARE.
>>> + */
>>> +
>>> +#include "spirv.h"
>>> +#include "spirv_extensions.h"
>>> +
>>> +const char *
>>> +spirv_extensions_to_string(SpvExtension ext)
>>> +{
>>> +   switch (ext) {
>>> +   case SPV_AMD_shader_explicit_vertex_parameter: return 
>>> "SPV_AMD_shader_explicit_vertex_parameter";
>>> +   case SPV_AMD_shader_trinary_minmax: return 
>>> "SPV_AMD_shader_trinary_minmax";
>>> +   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
>>> +   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
>>> +   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
>>> +   case SPV_AMD_gpu_shader_half_float: return 
>>> "SPV_AMD_gpu_shader_half_float";
>>> +   case SPV_KHR_shader_draw_parameters: return 
>>> "SPV_KHR_shader_draw_parameters";
>>> +   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
>>> +   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
>>> +   case SPV_KHR_device_group: return "SPV_KHR_device_group";
>>> +   case SPV_KHR_multiview: return "SPV_KHR_multiview";
>>> +   case SPV_NVX_multiview_per_view_attributes: return 
>>> "SPV_NVX_multiview_per_view_attributes";
>>> +   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
>>> +   case SPV_NV_stereo_view_rendering: return 
>>> "SPV_NV_stereo_view_rendering";
>>> +   case SPV_NV_sample_mask_override_coverage: return 
>>> "SPV_NV_sample_mask_override_coverage";
>>> +   case SPV_NV_geometry_shader_passthrough: return 
>>> "SPV_NV_geometry_shader_passthrough";
>>> +   case SPV_AMD_texture_gather_bias_lod: return 
>>> "SPV_AMD_texture_gather_bias_lod";
>>> +   case SPV_KHR_storage_buffer_storage_class: return 
>>> "SPV_KHR_storage_buffer_storage_class";
>>> +   case SPV_KHR_variable_pointers: return "SPV_KHR_variable_pointers";
>>> +   case SPV_AMD_gpu_shader_int16: return "SPV_AMD_gpu_shader_int16";
>>> +   case SPV_KHR_post_depth_coverage: return "SPV_KHR_post_depth_coverage";

Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-28 Thread Eric Engestrom
On Monday, 2017-11-27 13:21:31 +0200, Tapani Pälli wrote:
> 
> 
> On 11/15/2017 03:22 PM, Eduardo Lima Mitev wrote:
> > From: Alejandro Piñeiro 
> > 
> > Ideally this should be generated somehow. One option would be gather
> > all the extension dependencies listed on the core grammar, but there
> > would be the possibility of not including some of the extensions.
> > 
> > Note that spirv-tools is doing it just slightly better, as it has a
> > hardcoded list of extensions manually took from the registry, that
> > they parse to get the enum and the to_string method (see
> > generate_grammar_tables.py).
> > ---
> >   src/compiler/Makefile.sources |  2 +
> >   src/compiler/spirv/spirv_extensions.c | 61 +++
> >   src/compiler/spirv/spirv_extensions.h | 69 
> > +++
> >   3 files changed, 132 insertions(+)
> >   create mode 100644 src/compiler/spirv/spirv_extensions.c
> >   create mode 100644 src/compiler/spirv/spirv_extensions.h
> > 
> > diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> > index 2ab8e163a26..f198456c751 100644
> > --- a/src/compiler/Makefile.sources
> > +++ b/src/compiler/Makefile.sources
> > @@ -293,6 +293,8 @@ SPIRV_FILES = \
> > spirv/GLSL.std.450.h \
> > spirv/nir_spirv.h \
> > spirv/spirv.h \
> > +   spirv/spirv_extensions.c \
> > +   spirv/spirv_extensions.h \
> > spirv/spirv_info.h \
> > spirv/spirv_to_nir.c \
> > spirv/vtn_alu.c \
> > diff --git a/src/compiler/spirv/spirv_extensions.c 
> > b/src/compiler/spirv/spirv_extensions.c
> > new file mode 100644
> > index 000..64d61c49d31
> > --- /dev/null
> > +++ b/src/compiler/spirv/spirv_extensions.c
> > @@ -0,0 +1,61 @@
> > +/*
> > + * Copyright © 2017 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the 
> > "Software"),
> > + * to deal in the Software without restriction, including without 
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the 
> > next
> > + * paragraph) shall be included in all copies or substantial portions of 
> > the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
> > OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
> > OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> > DEALINGS
> > + * IN THE SOFTWARE.
> > + */
> > +
> > +#include "spirv.h"
> > +#include "spirv_extensions.h"
> > +
> > +const char *
> > +spirv_extensions_to_string(SpvExtension ext)
> > +{
> > +   switch (ext) {
> > +   case SPV_AMD_shader_explicit_vertex_parameter: return 
> > "SPV_AMD_shader_explicit_vertex_parameter";
> > +   case SPV_AMD_shader_trinary_minmax: return 
> > "SPV_AMD_shader_trinary_minmax";
> > +   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
> > +   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
> > +   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
> > +   case SPV_AMD_gpu_shader_half_float: return 
> > "SPV_AMD_gpu_shader_half_float";
> > +   case SPV_KHR_shader_draw_parameters: return 
> > "SPV_KHR_shader_draw_parameters";
> > +   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
> > +   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
> > +   case SPV_KHR_device_group: return "SPV_KHR_device_group";
> > +   case SPV_KHR_multiview: return "SPV_KHR_multiview";
> > +   case SPV_NVX_multiview_per_view_attributes: return 
> > "SPV_NVX_multiview_per_view_attributes";
> > +   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
> > +   case SPV_NV_stereo_view_rendering: return 
> > "SPV_NV_stereo_view_rendering";
> > +   case SPV_NV_sample_mask_override_coverage: return 
> > "SPV_NV_sample_mask_override_coverage";
> > +   case SPV_NV_geometry_shader_passthrough: return 
> > "SPV_NV_geometry_shader_passthrough";
> > +   case SPV_AMD_texture_gather_bias_lod: return 
> > "SPV_AMD_texture_gather_bias_lod";
> > +   case SPV_KHR_storage_buffer_storage_class: return 
> > "SPV_KHR_storage_buffer_storage_class";
> > +   case SPV_KHR_variable_pointers: return "SPV_KHR_variable_pointers";
> > +   case SPV_AMD_gpu_shader_int16: return "SPV_AMD_gpu_shader_int16";
> > +   case SPV_KHR_post_depth_coverage: return "SPV_KHR_post_depth_coverage";
> > +   case 

Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-27 Thread Ian Romanick
On 11/15/2017 05:22 AM, Eduardo Lima Mitev wrote:
> From: Alejandro Piñeiro 
> 
> Ideally this should be generated somehow. One option would be gather
> all the extension dependencies listed on the core grammar, but there
> would be the possibility of not including some of the extensions.
> 
> Note that spirv-tools is doing it just slightly better, as it has a
> hardcoded list of extensions manually took from the registry, that
> they parse to get the enum and the to_string method (see
> generate_grammar_tables.py).
> ---
>  src/compiler/Makefile.sources |  2 +
>  src/compiler/spirv/spirv_extensions.c | 61 +++
>  src/compiler/spirv/spirv_extensions.h | 69 
> +++
>  3 files changed, 132 insertions(+)
>  create mode 100644 src/compiler/spirv/spirv_extensions.c
>  create mode 100644 src/compiler/spirv/spirv_extensions.h
> 
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index 2ab8e163a26..f198456c751 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -293,6 +293,8 @@ SPIRV_FILES = \
>   spirv/GLSL.std.450.h \
>   spirv/nir_spirv.h \
>   spirv/spirv.h \
> + spirv/spirv_extensions.c \
> + spirv/spirv_extensions.h \
>   spirv/spirv_info.h \
>   spirv/spirv_to_nir.c \
>   spirv/vtn_alu.c \
> diff --git a/src/compiler/spirv/spirv_extensions.c 
> b/src/compiler/spirv/spirv_extensions.c
> new file mode 100644
> index 000..64d61c49d31
> --- /dev/null
> +++ b/src/compiler/spirv/spirv_extensions.c
> @@ -0,0 +1,61 @@
> +/*
> + * Copyright © 2017 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include "spirv.h"
> +#include "spirv_extensions.h"
> +
> +const char *
> +spirv_extensions_to_string(SpvExtension ext)
> +{
> +   switch (ext) {
> +   case SPV_AMD_shader_explicit_vertex_parameter: return 
> "SPV_AMD_shader_explicit_vertex_parameter";
> +   case SPV_AMD_shader_trinary_minmax: return 
> "SPV_AMD_shader_trinary_minmax";
> +   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
> +   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
> +   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
> +   case SPV_AMD_gpu_shader_half_float: return 
> "SPV_AMD_gpu_shader_half_float";
> +   case SPV_KHR_shader_draw_parameters: return 
> "SPV_KHR_shader_draw_parameters";
> +   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
> +   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
> +   case SPV_KHR_device_group: return "SPV_KHR_device_group";
> +   case SPV_KHR_multiview: return "SPV_KHR_multiview";
> +   case SPV_NVX_multiview_per_view_attributes: return 
> "SPV_NVX_multiview_per_view_attributes";
> +   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
> +   case SPV_NV_stereo_view_rendering: return "SPV_NV_stereo_view_rendering";
> +   case SPV_NV_sample_mask_override_coverage: return 
> "SPV_NV_sample_mask_override_coverage";
> +   case SPV_NV_geometry_shader_passthrough: return 
> "SPV_NV_geometry_shader_passthrough";
> +   case SPV_AMD_texture_gather_bias_lod: return 
> "SPV_AMD_texture_gather_bias_lod";
> +   case SPV_KHR_storage_buffer_storage_class: return 
> "SPV_KHR_storage_buffer_storage_class";
> +   case SPV_KHR_variable_pointers: return "SPV_KHR_variable_pointers";
> +   case SPV_AMD_gpu_shader_int16: return "SPV_AMD_gpu_shader_int16";
> +   case SPV_KHR_post_depth_coverage: return "SPV_KHR_post_depth_coverage";
> +   case SPV_KHR_shader_atomic_counter_ops: return 
> "SPV_KHR_shader_atomic_counter_ops";
> +   case SPV_EXT_shader_stencil_export: return 
> "SPV_EXT_shader_stencil_export";
> +   case SPV_EXT_shader_viewport_index_layer: return 
> "SPV_EXT_shader_viewport_index_layer";
> +   case SPV_AMD_shader_image_load_store_lod: return 

Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-27 Thread Alejandro Piñeiro


On 27/11/17 12:21, Tapani Pälli wrote:
>
>
> On 11/15/2017 03:22 PM, Eduardo Lima Mitev wrote:
>> From: Alejandro Piñeiro 
>>
>> Ideally this should be generated somehow. One option would be gather
>> all the extension dependencies listed on the core grammar, but there
>> would be the possibility of not including some of the extensions.
>>
>> Note that spirv-tools is doing it just slightly better, as it has a
>> hardcoded list of extensions manually took from the registry, that
>> they parse to get the enum and the to_string method (see
>> generate_grammar_tables.py).
>> ---
>>   src/compiler/Makefile.sources |  2 +
>>   src/compiler/spirv/spirv_extensions.c | 61
>> +++
>>   src/compiler/spirv/spirv_extensions.h | 69
>> +++
>>   3 files changed, 132 insertions(+)
>>   create mode 100644 src/compiler/spirv/spirv_extensions.c
>>   create mode 100644 src/compiler/spirv/spirv_extensions.h
>>
>> diff --git a/src/compiler/Makefile.sources
>> b/src/compiler/Makefile.sources
>> index 2ab8e163a26..f198456c751 100644
>> --- a/src/compiler/Makefile.sources
>> +++ b/src/compiler/Makefile.sources
>> @@ -293,6 +293,8 @@ SPIRV_FILES = \
>>   spirv/GLSL.std.450.h \
>>   spirv/nir_spirv.h \
>>   spirv/spirv.h \
>> +    spirv/spirv_extensions.c \
>> +    spirv/spirv_extensions.h \
>>   spirv/spirv_info.h \
>>   spirv/spirv_to_nir.c \
>>   spirv/vtn_alu.c \
>> diff --git a/src/compiler/spirv/spirv_extensions.c
>> b/src/compiler/spirv/spirv_extensions.c
>> new file mode 100644
>> index 000..64d61c49d31
>> --- /dev/null
>> +++ b/src/compiler/spirv/spirv_extensions.c
>> @@ -0,0 +1,61 @@
>> +/*
>> + * Copyright © 2017 Intel Corporation
>> + *
>> + * Permission is hereby granted, free of charge, to any person
>> obtaining a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * the rights to use, copy, modify, merge, publish, distribute,
>> sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom
>> the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including
>> the next
>> + * paragraph) shall be included in all copies or substantial
>> portions of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
>> EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
>> OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
>> OTHER DEALINGS
>> + * IN THE SOFTWARE.
>> + */
>> +
>> +#include "spirv.h"
>> +#include "spirv_extensions.h"
>> +
>> +const char *
>> +spirv_extensions_to_string(SpvExtension ext)
>> +{
>> +   switch (ext) {
>> +   case SPV_AMD_shader_explicit_vertex_parameter: return
>> "SPV_AMD_shader_explicit_vertex_parameter";
>> +   case SPV_AMD_shader_trinary_minmax: return
>> "SPV_AMD_shader_trinary_minmax";
>> +   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
>> +   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
>> +   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
>> +   case SPV_AMD_gpu_shader_half_float: return
>> "SPV_AMD_gpu_shader_half_float";
>> +   case SPV_KHR_shader_draw_parameters: return
>> "SPV_KHR_shader_draw_parameters";
>> +   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
>> +   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
>> +   case SPV_KHR_device_group: return "SPV_KHR_device_group";
>> +   case SPV_KHR_multiview: return "SPV_KHR_multiview";
>> +   case SPV_NVX_multiview_per_view_attributes: return
>> "SPV_NVX_multiview_per_view_attributes";
>> +   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
>> +   case SPV_NV_stereo_view_rendering: return
>> "SPV_NV_stereo_view_rendering";
>> +   case SPV_NV_sample_mask_override_coverage: return
>> "SPV_NV_sample_mask_override_coverage";
>> +   case SPV_NV_geometry_shader_passthrough: return
>> "SPV_NV_geometry_shader_passthrough";
>> +   case SPV_AMD_texture_gather_bias_lod: return
>> "SPV_AMD_texture_gather_bias_lod";
>> +   case SPV_KHR_storage_buffer_storage_class: return
>> "SPV_KHR_storage_buffer_storage_class";
>> +   case SPV_KHR_variable_pointers: return "SPV_KHR_variable_pointers";
>> +   case SPV_AMD_gpu_shader_int16: return "SPV_AMD_gpu_shader_int16";
>> +   case SPV_KHR_post_depth_coverage: return
>> "SPV_KHR_post_depth_coverage";
>> +   case SPV_KHR_shader_atomic_counter_ops: return
>> "SPV_KHR_shader_atomic_counter_ops";
>> +   case SPV_EXT_shader_stencil_export: return
>> 

Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-27 Thread Tapani Pälli



On 11/15/2017 03:22 PM, Eduardo Lima Mitev wrote:

From: Alejandro Piñeiro 

Ideally this should be generated somehow. One option would be gather
all the extension dependencies listed on the core grammar, but there
would be the possibility of not including some of the extensions.

Note that spirv-tools is doing it just slightly better, as it has a
hardcoded list of extensions manually took from the registry, that
they parse to get the enum and the to_string method (see
generate_grammar_tables.py).
---
  src/compiler/Makefile.sources |  2 +
  src/compiler/spirv/spirv_extensions.c | 61 +++
  src/compiler/spirv/spirv_extensions.h | 69 +++
  3 files changed, 132 insertions(+)
  create mode 100644 src/compiler/spirv/spirv_extensions.c
  create mode 100644 src/compiler/spirv/spirv_extensions.h

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 2ab8e163a26..f198456c751 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -293,6 +293,8 @@ SPIRV_FILES = \
spirv/GLSL.std.450.h \
spirv/nir_spirv.h \
spirv/spirv.h \
+   spirv/spirv_extensions.c \
+   spirv/spirv_extensions.h \
spirv/spirv_info.h \
spirv/spirv_to_nir.c \
spirv/vtn_alu.c \
diff --git a/src/compiler/spirv/spirv_extensions.c 
b/src/compiler/spirv/spirv_extensions.c
new file mode 100644
index 000..64d61c49d31
--- /dev/null
+++ b/src/compiler/spirv/spirv_extensions.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "spirv.h"
+#include "spirv_extensions.h"
+
+const char *
+spirv_extensions_to_string(SpvExtension ext)
+{
+   switch (ext) {
+   case SPV_AMD_shader_explicit_vertex_parameter: return 
"SPV_AMD_shader_explicit_vertex_parameter";
+   case SPV_AMD_shader_trinary_minmax: return "SPV_AMD_shader_trinary_minmax";
+   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
+   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
+   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
+   case SPV_AMD_gpu_shader_half_float: return "SPV_AMD_gpu_shader_half_float";
+   case SPV_KHR_shader_draw_parameters: return 
"SPV_KHR_shader_draw_parameters";
+   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
+   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
+   case SPV_KHR_device_group: return "SPV_KHR_device_group";
+   case SPV_KHR_multiview: return "SPV_KHR_multiview";
+   case SPV_NVX_multiview_per_view_attributes: return 
"SPV_NVX_multiview_per_view_attributes";
+   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
+   case SPV_NV_stereo_view_rendering: return "SPV_NV_stereo_view_rendering";
+   case SPV_NV_sample_mask_override_coverage: return 
"SPV_NV_sample_mask_override_coverage";
+   case SPV_NV_geometry_shader_passthrough: return 
"SPV_NV_geometry_shader_passthrough";
+   case SPV_AMD_texture_gather_bias_lod: return 
"SPV_AMD_texture_gather_bias_lod";
+   case SPV_KHR_storage_buffer_storage_class: return 
"SPV_KHR_storage_buffer_storage_class";
+   case SPV_KHR_variable_pointers: return "SPV_KHR_variable_pointers";
+   case SPV_AMD_gpu_shader_int16: return "SPV_AMD_gpu_shader_int16";
+   case SPV_KHR_post_depth_coverage: return "SPV_KHR_post_depth_coverage";
+   case SPV_KHR_shader_atomic_counter_ops: return 
"SPV_KHR_shader_atomic_counter_ops";
+   case SPV_EXT_shader_stencil_export: return "SPV_EXT_shader_stencil_export";
+   case SPV_EXT_shader_viewport_index_layer: return 
"SPV_EXT_shader_viewport_index_layer";
+   case SPV_AMD_shader_image_load_store_lod: return 
"SPV_AMD_shader_image_load_store_lod";
+   case SPV_AMD_shader_fragment_mask: return "SPV_AMD_shader_fragment_mask";
+   default: return "unknown";



This could make it a bit less noisy 

Re: [Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-15 Thread Eric Engestrom
On Wednesday, 2017-11-15 14:22:14 +0100, Eduardo Lima Mitev wrote:
> From: Alejandro Piñeiro 
> 
> Ideally this should be generated somehow. One option would be gather
> all the extension dependencies listed on the core grammar, but there
> would be the possibility of not including some of the extensions.
> 
> Note that spirv-tools is doing it just slightly better, as it has a
> hardcoded list of extensions manually took from the registry, that
> they parse to get the enum and the to_string method (see
> generate_grammar_tables.py).
> ---
>  src/compiler/Makefile.sources |  2 +
>  src/compiler/spirv/spirv_extensions.c | 61 +++
>  src/compiler/spirv/spirv_extensions.h | 69 
> +++
>  3 files changed, 132 insertions(+)
>  create mode 100644 src/compiler/spirv/spirv_extensions.c
>  create mode 100644 src/compiler/spirv/spirv_extensions.h
> 
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index 2ab8e163a26..f198456c751 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -293,6 +293,8 @@ SPIRV_FILES = \
>   spirv/GLSL.std.450.h \
>   spirv/nir_spirv.h \
>   spirv/spirv.h \
> + spirv/spirv_extensions.c \
> + spirv/spirv_extensions.h \
>   spirv/spirv_info.h \
>   spirv/spirv_to_nir.c \
>   spirv/vtn_alu.c \

Please add to this patch:

8<
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index e5c8326aa066a580d79e..e7d2e57fa7007115d195 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -176,6 +176,8 @@ files_libnir = files(
   '../spirv/GLSL.std.450.h',
   '../spirv/nir_spirv.h',
   '../spirv/spirv.h',
+  '../spirv/spirv_extensions.c',
+  '../spirv/spirv_extensions.h',
   '../spirv/spirv_info.h',
   '../spirv/spirv_to_nir.c',
   '../spirv/vtn_alu.c',
>8

> diff --git a/src/compiler/spirv/spirv_extensions.c 
> b/src/compiler/spirv/spirv_extensions.c
> new file mode 100644
> index 000..64d61c49d31
> --- /dev/null
> +++ b/src/compiler/spirv/spirv_extensions.c
> @@ -0,0 +1,61 @@
> +/*
> + * Copyright © 2017 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include "spirv.h"
> +#include "spirv_extensions.h"
> +
> +const char *
> +spirv_extensions_to_string(SpvExtension ext)
> +{
> +   switch (ext) {
> +   case SPV_AMD_shader_explicit_vertex_parameter: return 
> "SPV_AMD_shader_explicit_vertex_parameter";
> +   case SPV_AMD_shader_trinary_minmax: return 
> "SPV_AMD_shader_trinary_minmax";
> +   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
> +   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
> +   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
> +   case SPV_AMD_gpu_shader_half_float: return 
> "SPV_AMD_gpu_shader_half_float";
> +   case SPV_KHR_shader_draw_parameters: return 
> "SPV_KHR_shader_draw_parameters";
> +   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
> +   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
> +   case SPV_KHR_device_group: return "SPV_KHR_device_group";
> +   case SPV_KHR_multiview: return "SPV_KHR_multiview";
> +   case SPV_NVX_multiview_per_view_attributes: return 
> "SPV_NVX_multiview_per_view_attributes";
> +   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
> +   case SPV_NV_stereo_view_rendering: return "SPV_NV_stereo_view_rendering";
> +   case SPV_NV_sample_mask_override_coverage: return 
> "SPV_NV_sample_mask_override_coverage";
> +   case SPV_NV_geometry_shader_passthrough: return 
> "SPV_NV_geometry_shader_passthrough";
> +   case SPV_AMD_texture_gather_bias_lod: return 
> "SPV_AMD_texture_gather_bias_lod";
> +   case SPV_KHR_storage_buffer_storage_class: return 
> "SPV_KHR_storage_buffer_storage_class";
> +   case 

[Mesa-dev] [PATCH 11/24] spirv_extensions: add list of extensions and to_string method

2017-11-15 Thread Eduardo Lima Mitev
From: Alejandro Piñeiro 

Ideally this should be generated somehow. One option would be gather
all the extension dependencies listed on the core grammar, but there
would be the possibility of not including some of the extensions.

Note that spirv-tools is doing it just slightly better, as it has a
hardcoded list of extensions manually took from the registry, that
they parse to get the enum and the to_string method (see
generate_grammar_tables.py).
---
 src/compiler/Makefile.sources |  2 +
 src/compiler/spirv/spirv_extensions.c | 61 +++
 src/compiler/spirv/spirv_extensions.h | 69 +++
 3 files changed, 132 insertions(+)
 create mode 100644 src/compiler/spirv/spirv_extensions.c
 create mode 100644 src/compiler/spirv/spirv_extensions.h

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 2ab8e163a26..f198456c751 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -293,6 +293,8 @@ SPIRV_FILES = \
spirv/GLSL.std.450.h \
spirv/nir_spirv.h \
spirv/spirv.h \
+   spirv/spirv_extensions.c \
+   spirv/spirv_extensions.h \
spirv/spirv_info.h \
spirv/spirv_to_nir.c \
spirv/vtn_alu.c \
diff --git a/src/compiler/spirv/spirv_extensions.c 
b/src/compiler/spirv/spirv_extensions.c
new file mode 100644
index 000..64d61c49d31
--- /dev/null
+++ b/src/compiler/spirv/spirv_extensions.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "spirv.h"
+#include "spirv_extensions.h"
+
+const char *
+spirv_extensions_to_string(SpvExtension ext)
+{
+   switch (ext) {
+   case SPV_AMD_shader_explicit_vertex_parameter: return 
"SPV_AMD_shader_explicit_vertex_parameter";
+   case SPV_AMD_shader_trinary_minmax: return "SPV_AMD_shader_trinary_minmax";
+   case SPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader";
+   case SPV_KHR_shader_ballot: return "SPV_KHR_shader_ballot";
+   case SPV_AMD_shader_ballot: return "SPV_AMD_shader_ballot";
+   case SPV_AMD_gpu_shader_half_float: return "SPV_AMD_gpu_shader_half_float";
+   case SPV_KHR_shader_draw_parameters: return 
"SPV_KHR_shader_draw_parameters";
+   case SPV_KHR_subgroup_vote: return "SPV_KHR_subgroup_vote";
+   case SPV_KHR_16bit_storage: return "SPV_KHR_16bit_storage";
+   case SPV_KHR_device_group: return "SPV_KHR_device_group";
+   case SPV_KHR_multiview: return "SPV_KHR_multiview";
+   case SPV_NVX_multiview_per_view_attributes: return 
"SPV_NVX_multiview_per_view_attributes";
+   case SPV_NV_viewport_array2: return "SPV_NV_viewport_array2";
+   case SPV_NV_stereo_view_rendering: return "SPV_NV_stereo_view_rendering";
+   case SPV_NV_sample_mask_override_coverage: return 
"SPV_NV_sample_mask_override_coverage";
+   case SPV_NV_geometry_shader_passthrough: return 
"SPV_NV_geometry_shader_passthrough";
+   case SPV_AMD_texture_gather_bias_lod: return 
"SPV_AMD_texture_gather_bias_lod";
+   case SPV_KHR_storage_buffer_storage_class: return 
"SPV_KHR_storage_buffer_storage_class";
+   case SPV_KHR_variable_pointers: return "SPV_KHR_variable_pointers";
+   case SPV_AMD_gpu_shader_int16: return "SPV_AMD_gpu_shader_int16";
+   case SPV_KHR_post_depth_coverage: return "SPV_KHR_post_depth_coverage";
+   case SPV_KHR_shader_atomic_counter_ops: return 
"SPV_KHR_shader_atomic_counter_ops";
+   case SPV_EXT_shader_stencil_export: return "SPV_EXT_shader_stencil_export";
+   case SPV_EXT_shader_viewport_index_layer: return 
"SPV_EXT_shader_viewport_index_layer";
+   case SPV_AMD_shader_image_load_store_lod: return 
"SPV_AMD_shader_image_load_store_lod";
+   case SPV_AMD_shader_fragment_mask: return "SPV_AMD_shader_fragment_mask";
+   default: return "unknown";
+   }
+
+   return "unknown";
+}
diff --git a/src/compiler/spirv/spirv_extensions.h