Re: [Mesa-dev] [PATCH 1/2] mesa: add a workaround for unigine Tropics

2015-02-02 Thread Martin Peres
You're welcome Marek. Let's not keep these workarounds specific to some 
drivers ;)


In any case, please review the new version, the one called "introduce 
the equivalent of MESA_EXTENSION_OVERRIDE to drirc". I prefer this 
solution better and this one should be dropped.


Sorry for the noise.
Martin

On 30/01/15 23:19, Marek Olšák wrote:

Thanks for adding Gallium support.

Reviewed-by: Marek Olšák 

Marek

On Thu, Jan 29, 2015 at 10:14 PM, Martin Peres
 wrote:

While trying to understand a GLSL pass, curro and I tried running Unigine
Tropics and the GLSL compilers would not compile the shaders.

The reason is due to the fact that the shaders do not specify the needed GLSL
version but also use in the same shader keywords that could never co-exist
because one got deleted when the other one was added (for instance,
gl_TexCoord and gl_InstanceID). The current solution was to use the
force_glsl_extensions_warn workaround but it broke when GL_ARB_gpu_shader5
got introduced as this workaround also enabled this extension which reserved
the name "sample" which is then used by most of Unigine Tropics' shaders.

To fix this, the easiest solution seem to introduce a workaround to
disable GL_ARB_gpu_shader5 in the GLSL compiler. This is what this patch
does along with modifying drirc to enable this workaround on tropics.

This patch has been tested on Haswell. It should also work on Gallium-based
drivers but I did not test it.

I would like to thank curro for helping me understand the whole issue and
directed me to the right place in the code.

Signed-off-by: Martin Peres 
---
  src/gallium/include/state_tracker/st_api.h  | 1 +
  src/gallium/state_trackers/dri/dri_screen.c | 3 +++
  src/glsl/glsl_parser_extras.cpp | 3 +++
  src/mesa/drivers/dri/common/drirc   | 1 +
  src/mesa/drivers/dri/common/xmlpool/t_options.h | 4 
  src/mesa/drivers/dri/i915/intel_screen.c| 1 +
  src/mesa/drivers/dri/i965/brw_context.c | 3 +++
  src/mesa/drivers/dri/i965/intel_screen.c| 1 +
  src/mesa/main/mtypes.h  | 7 +++
  src/mesa/state_tracker/st_extensions.c  | 3 +++
  10 files changed, 27 insertions(+)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 86fdc69..01bc98d 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -246,6 +246,7 @@ struct st_config_options
 unsigned force_glsl_version;
 boolean force_s3tc_enable;
 boolean allow_glsl_extension_directive_midshader;
+   boolean disable_glsl_extension_gpu_shader5;
  };

  /**
diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index 9cdebf8..091aecf 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -70,6 +70,7 @@ const __DRIconfigOptionsExtension gallium_config_options = {
   DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
   DRI_CONF_FORCE_GLSL_VERSION(0)
   DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
+ DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5("false")
DRI_CONF_SECTION_END

DRI_CONF_SECTION_MISCELLANEOUS
@@ -98,6 +99,8 @@ dri_fill_st_options(struct st_config_options *options,
driQueryOptionb(optionCache, "force_s3tc_enable");
 options->allow_glsl_extension_directive_midshader =
driQueryOptionb(optionCache, 
"allow_glsl_extension_directive_midshader");
+   options->disable_glsl_extension_gpu_shader5 =
+  driQueryOptionb(optionCache, "disable_glsl_extension_gpu_shader5");
  }

  static const __DRIconfig **
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index ccdf031..fff04b8 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -217,6 +217,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
gl_context *_ctx,
sizeof(this->atomic_counter_offsets));
 this->allow_extension_directive_midshader =
ctx->Const.AllowGLSLExtensionDirectiveMidShader;
+
+   if (ctx->Const.DisableGLSLExtensionGpuShader5)
+  this->ARB_gpu_shader5_enable = false;
  }

  /**
diff --git a/src/mesa/drivers/dri/common/drirc 
b/src/mesa/drivers/dri/common/drirc
index cecd6a9..3199cfc 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -41,6 +41,7 @@ TODO: document the other workarounds.

  
  
+
  
 

diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h 
b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 4e5a721..d1869d6 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -110,6 +110,10 @@ 
DRI_CONF_OPT_BEGIN_B(allow_glsl_extension_directive_midshader, def) \
  DRI_CONF_DESC(en,gettext("Allow GLSL #extension directives in the middle 
o

Re: [Mesa-dev] [PATCH 1/2] mesa: add a workaround for unigine Tropics

2015-01-30 Thread Marek Olšák
Thanks for adding Gallium support.

Reviewed-by: Marek Olšák 

Marek

On Thu, Jan 29, 2015 at 10:14 PM, Martin Peres
 wrote:
> While trying to understand a GLSL pass, curro and I tried running Unigine
> Tropics and the GLSL compilers would not compile the shaders.
>
> The reason is due to the fact that the shaders do not specify the needed GLSL
> version but also use in the same shader keywords that could never co-exist
> because one got deleted when the other one was added (for instance,
> gl_TexCoord and gl_InstanceID). The current solution was to use the
> force_glsl_extensions_warn workaround but it broke when GL_ARB_gpu_shader5
> got introduced as this workaround also enabled this extension which reserved
> the name "sample" which is then used by most of Unigine Tropics' shaders.
>
> To fix this, the easiest solution seem to introduce a workaround to
> disable GL_ARB_gpu_shader5 in the GLSL compiler. This is what this patch
> does along with modifying drirc to enable this workaround on tropics.
>
> This patch has been tested on Haswell. It should also work on Gallium-based
> drivers but I did not test it.
>
> I would like to thank curro for helping me understand the whole issue and
> directed me to the right place in the code.
>
> Signed-off-by: Martin Peres 
> ---
>  src/gallium/include/state_tracker/st_api.h  | 1 +
>  src/gallium/state_trackers/dri/dri_screen.c | 3 +++
>  src/glsl/glsl_parser_extras.cpp | 3 +++
>  src/mesa/drivers/dri/common/drirc   | 1 +
>  src/mesa/drivers/dri/common/xmlpool/t_options.h | 4 
>  src/mesa/drivers/dri/i915/intel_screen.c| 1 +
>  src/mesa/drivers/dri/i965/brw_context.c | 3 +++
>  src/mesa/drivers/dri/i965/intel_screen.c| 1 +
>  src/mesa/main/mtypes.h  | 7 +++
>  src/mesa/state_tracker/st_extensions.c  | 3 +++
>  10 files changed, 27 insertions(+)
>
> diff --git a/src/gallium/include/state_tracker/st_api.h 
> b/src/gallium/include/state_tracker/st_api.h
> index 86fdc69..01bc98d 100644
> --- a/src/gallium/include/state_tracker/st_api.h
> +++ b/src/gallium/include/state_tracker/st_api.h
> @@ -246,6 +246,7 @@ struct st_config_options
> unsigned force_glsl_version;
> boolean force_s3tc_enable;
> boolean allow_glsl_extension_directive_midshader;
> +   boolean disable_glsl_extension_gpu_shader5;
>  };
>
>  /**
> diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
> b/src/gallium/state_trackers/dri/dri_screen.c
> index 9cdebf8..091aecf 100644
> --- a/src/gallium/state_trackers/dri/dri_screen.c
> +++ b/src/gallium/state_trackers/dri/dri_screen.c
> @@ -70,6 +70,7 @@ const __DRIconfigOptionsExtension gallium_config_options = {
>   DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
>   DRI_CONF_FORCE_GLSL_VERSION(0)
>   DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
> + DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5("false")
>DRI_CONF_SECTION_END
>
>DRI_CONF_SECTION_MISCELLANEOUS
> @@ -98,6 +99,8 @@ dri_fill_st_options(struct st_config_options *options,
>driQueryOptionb(optionCache, "force_s3tc_enable");
> options->allow_glsl_extension_directive_midshader =
>driQueryOptionb(optionCache, 
> "allow_glsl_extension_directive_midshader");
> +   options->disable_glsl_extension_gpu_shader5 =
> +  driQueryOptionb(optionCache, "disable_glsl_extension_gpu_shader5");
>  }
>
>  static const __DRIconfig **
> diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
> index ccdf031..fff04b8 100644
> --- a/src/glsl/glsl_parser_extras.cpp
> +++ b/src/glsl/glsl_parser_extras.cpp
> @@ -217,6 +217,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
> gl_context *_ctx,
>sizeof(this->atomic_counter_offsets));
> this->allow_extension_directive_midshader =
>ctx->Const.AllowGLSLExtensionDirectiveMidShader;
> +
> +   if (ctx->Const.DisableGLSLExtensionGpuShader5)
> +  this->ARB_gpu_shader5_enable = false;
>  }
>
>  /**
> diff --git a/src/mesa/drivers/dri/common/drirc 
> b/src/mesa/drivers/dri/common/drirc
> index cecd6a9..3199cfc 100644
> --- a/src/mesa/drivers/dri/common/drirc
> +++ b/src/mesa/drivers/dri/common/drirc
> @@ -41,6 +41,7 @@ TODO: document the other workarounds.
>
>  
>  
> +
>  
> 
>
> diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h 
> b/src/mesa/drivers/dri/common/xmlpool/t_options.h
> index 4e5a721..d1869d6 100644
> --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
> +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
> @@ -110,6 +110,10 @@ 
> DRI_CONF_OPT_BEGIN_B(allow_glsl_extension_directive_midshader, def) \
>  DRI_CONF_DESC(en,gettext("Allow GLSL #extension directives in the 
> middle of shaders")) \
>  DRI_CONF_OPT_END
>
> +#define DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5(def) \
> +DRI_CONF_OPT_BEGIN_B(disable_glsl_extension_gpu_shader5, def) \
> +   

Re: [Mesa-dev] [PATCH 1/2] mesa: add a workaround for unigine Tropics

2015-01-30 Thread Kenneth Graunke
On Friday, January 30, 2015 11:50:57 AM Martin Peres wrote:
> 
> On 30/01/15 00:26, Kenneth Graunke wrote:
> > On Thursday, January 29, 2015 11:14:26 PM Martin Peres wrote:
> >> While trying to understand a GLSL pass, curro and I tried running Unigine
> >> Tropics and the GLSL compilers would not compile the shaders.
> >>
> >> The reason is due to the fact that the shaders do not specify the needed 
> >> GLSL
> >> version but also use in the same shader keywords that could never co-exist
> >> because one got deleted when the other one was added (for instance,
> >> gl_TexCoord and gl_InstanceID). The current solution was to use the
> >> force_glsl_extensions_warn workaround but it broke when GL_ARB_gpu_shader5
> >> got introduced as this workaround also enabled this extension which 
> >> reserved
> >> the name "sample" which is then used by most of Unigine Tropics' shaders.
> >>
> >> To fix this, the easiest solution seem to introduce a workaround to
> >> disable GL_ARB_gpu_shader5 in the GLSL compiler. This is what this patch
> >> does along with modifying drirc to enable this workaround on tropics.
> >>
> >> This patch has been tested on Haswell. It should also work on Gallium-based
> >> drivers but I did not test it.
> >>
> >> I would like to thank curro for helping me understand the whole issue and
> >> directed me to the right place in the code.
> >>
> >> Signed-off-by: Martin Peres 
> > Hi Martin!
> >
> > Thanks for fixing this.  One small comment...
> >
> > [snip]
> >> diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
> >> b/src/mesa/drivers/dri/i915/intel_screen.c
> >> index 00d8580..748eee7 100644
> >> --- a/src/mesa/drivers/dri/i915/intel_screen.c
> >> +++ b/src/mesa/drivers/dri/i915/intel_screen.c
> >> @@ -74,6 +74,7 @@ DRI_CONF_BEGIN
> >> DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
> >> DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
> >> DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
> >> +  DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5("false")
> >>   
> >> DRI_CONF_OPT_BEGIN_B(shader_precompile, "true")
> >> DRI_CONF_DESC(en, "Perform code generation at shader link time.")
> > You can probably drop the i915 change - it doesn't support ARB_gpu_shader5
> > anyway.
> 
> I do not think this is a good idea for two reasons:
> - Not initialising this variable will lead to an assert whenever some 
> common code will try to read the parameter.
> - This makes the i965/i915 code paths look different when they should 
> actually be shared. To ease the work of the poor soul who will have to 
> factor out all the drirc configuration parsing for all the classic 
> drivers and gallium.
> 
> > With that removed, you can add:
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82897
> 
> Oh no! I should have checked! It would have saved me quite some time!
> 
> > Reviewed-by: Kenneth Graunke 
> Do I still get your RB even if I do not delete it then?

Sure.  It really would be great to move these compiler related things out of
the various drivers and into shared code.

--Ken

signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: add a workaround for unigine Tropics

2015-01-30 Thread Martin Peres


On 30/01/15 00:26, Kenneth Graunke wrote:

On Thursday, January 29, 2015 11:14:26 PM Martin Peres wrote:

While trying to understand a GLSL pass, curro and I tried running Unigine
Tropics and the GLSL compilers would not compile the shaders.

The reason is due to the fact that the shaders do not specify the needed GLSL
version but also use in the same shader keywords that could never co-exist
because one got deleted when the other one was added (for instance,
gl_TexCoord and gl_InstanceID). The current solution was to use the
force_glsl_extensions_warn workaround but it broke when GL_ARB_gpu_shader5
got introduced as this workaround also enabled this extension which reserved
the name "sample" which is then used by most of Unigine Tropics' shaders.

To fix this, the easiest solution seem to introduce a workaround to
disable GL_ARB_gpu_shader5 in the GLSL compiler. This is what this patch
does along with modifying drirc to enable this workaround on tropics.

This patch has been tested on Haswell. It should also work on Gallium-based
drivers but I did not test it.

I would like to thank curro for helping me understand the whole issue and
directed me to the right place in the code.

Signed-off-by: Martin Peres 

Hi Martin!

Thanks for fixing this.  One small comment...

[snip]

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 00d8580..748eee7 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -74,6 +74,7 @@ DRI_CONF_BEGIN
DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
+  DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5("false")
  
DRI_CONF_OPT_BEGIN_B(shader_precompile, "true")

 DRI_CONF_DESC(en, "Perform code generation at shader link time.")

You can probably drop the i915 change - it doesn't support ARB_gpu_shader5
anyway.


I do not think this is a good idea for two reasons:
- Not initialising this variable will lead to an assert whenever some 
common code will try to read the parameter.
- This makes the i965/i915 code paths look different when they should 
actually be shared. To ease the work of the poor soul who will have to 
factor out all the drirc configuration parsing for all the classic 
drivers and gallium.



With that removed, you can add:

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82897


Oh no! I should have checked! It would have saved me quite some time!


Reviewed-by: Kenneth Graunke 

Do I still get your RB even if I do not delete it then?

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: add a workaround for unigine Tropics

2015-01-29 Thread Kenneth Graunke
On Thursday, January 29, 2015 11:14:26 PM Martin Peres wrote:
> While trying to understand a GLSL pass, curro and I tried running Unigine
> Tropics and the GLSL compilers would not compile the shaders.
> 
> The reason is due to the fact that the shaders do not specify the needed GLSL
> version but also use in the same shader keywords that could never co-exist
> because one got deleted when the other one was added (for instance,
> gl_TexCoord and gl_InstanceID). The current solution was to use the
> force_glsl_extensions_warn workaround but it broke when GL_ARB_gpu_shader5
> got introduced as this workaround also enabled this extension which reserved
> the name "sample" which is then used by most of Unigine Tropics' shaders.
> 
> To fix this, the easiest solution seem to introduce a workaround to
> disable GL_ARB_gpu_shader5 in the GLSL compiler. This is what this patch
> does along with modifying drirc to enable this workaround on tropics.
> 
> This patch has been tested on Haswell. It should also work on Gallium-based
> drivers but I did not test it.
> 
> I would like to thank curro for helping me understand the whole issue and
> directed me to the right place in the code.
> 
> Signed-off-by: Martin Peres 

Hi Martin!

Thanks for fixing this.  One small comment...

[snip]
> diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
> b/src/mesa/drivers/dri/i915/intel_screen.c
> index 00d8580..748eee7 100644
> --- a/src/mesa/drivers/dri/i915/intel_screen.c
> +++ b/src/mesa/drivers/dri/i915/intel_screen.c
> @@ -74,6 +74,7 @@ DRI_CONF_BEGIN
>DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
>DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
>DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
> +  DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5("false")
>  
>DRI_CONF_OPT_BEGIN_B(shader_precompile, "true")
>DRI_CONF_DESC(en, "Perform code generation at shader link time.")

You can probably drop the i915 change - it doesn't support ARB_gpu_shader5
anyway.  With that removed, you can add:

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82897
Reviewed-by: Kenneth Graunke 

signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] mesa: add a workaround for unigine Tropics

2015-01-29 Thread Martin Peres
While trying to understand a GLSL pass, curro and I tried running Unigine
Tropics and the GLSL compilers would not compile the shaders.

The reason is due to the fact that the shaders do not specify the needed GLSL
version but also use in the same shader keywords that could never co-exist
because one got deleted when the other one was added (for instance,
gl_TexCoord and gl_InstanceID). The current solution was to use the
force_glsl_extensions_warn workaround but it broke when GL_ARB_gpu_shader5
got introduced as this workaround also enabled this extension which reserved
the name "sample" which is then used by most of Unigine Tropics' shaders.

To fix this, the easiest solution seem to introduce a workaround to
disable GL_ARB_gpu_shader5 in the GLSL compiler. This is what this patch
does along with modifying drirc to enable this workaround on tropics.

This patch has been tested on Haswell. It should also work on Gallium-based
drivers but I did not test it.

I would like to thank curro for helping me understand the whole issue and
directed me to the right place in the code.

Signed-off-by: Martin Peres 
---
 src/gallium/include/state_tracker/st_api.h  | 1 +
 src/gallium/state_trackers/dri/dri_screen.c | 3 +++
 src/glsl/glsl_parser_extras.cpp | 3 +++
 src/mesa/drivers/dri/common/drirc   | 1 +
 src/mesa/drivers/dri/common/xmlpool/t_options.h | 4 
 src/mesa/drivers/dri/i915/intel_screen.c| 1 +
 src/mesa/drivers/dri/i965/brw_context.c | 3 +++
 src/mesa/drivers/dri/i965/intel_screen.c| 1 +
 src/mesa/main/mtypes.h  | 7 +++
 src/mesa/state_tracker/st_extensions.c  | 3 +++
 10 files changed, 27 insertions(+)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 86fdc69..01bc98d 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -246,6 +246,7 @@ struct st_config_options
unsigned force_glsl_version;
boolean force_s3tc_enable;
boolean allow_glsl_extension_directive_midshader;
+   boolean disable_glsl_extension_gpu_shader5;
 };
 
 /**
diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index 9cdebf8..091aecf 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -70,6 +70,7 @@ const __DRIconfigOptionsExtension gallium_config_options = {
  DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
  DRI_CONF_FORCE_GLSL_VERSION(0)
  DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
+ DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5("false")
   DRI_CONF_SECTION_END
 
   DRI_CONF_SECTION_MISCELLANEOUS
@@ -98,6 +99,8 @@ dri_fill_st_options(struct st_config_options *options,
   driQueryOptionb(optionCache, "force_s3tc_enable");
options->allow_glsl_extension_directive_midshader =
   driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
+   options->disable_glsl_extension_gpu_shader5 =
+  driQueryOptionb(optionCache, "disable_glsl_extension_gpu_shader5");
 }
 
 static const __DRIconfig **
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index ccdf031..fff04b8 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -217,6 +217,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
gl_context *_ctx,
   sizeof(this->atomic_counter_offsets));
this->allow_extension_directive_midshader =
   ctx->Const.AllowGLSLExtensionDirectiveMidShader;
+
+   if (ctx->Const.DisableGLSLExtensionGpuShader5)
+  this->ARB_gpu_shader5_enable = false;
 }
 
 /**
diff --git a/src/mesa/drivers/dri/common/drirc 
b/src/mesa/drivers/dri/common/drirc
index cecd6a9..3199cfc 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -41,6 +41,7 @@ TODO: document the other workarounds.
 
 
 
+
 

 
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h 
b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 4e5a721..d1869d6 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -110,6 +110,10 @@ 
DRI_CONF_OPT_BEGIN_B(allow_glsl_extension_directive_midshader, def) \
 DRI_CONF_DESC(en,gettext("Allow GLSL #extension directives in the 
middle of shaders")) \
 DRI_CONF_OPT_END
 
+#define DRI_CONF_DISABLE_GLSL_EXTENSION_GPU_SHADER5(def) \
+DRI_CONF_OPT_BEGIN_B(disable_glsl_extension_gpu_shader5, def) \
+DRI_CONF_DESC(en,gettext("Disable GLSL support for the 
GL_ARB_gpu_shader5")) \
+DRI_CONF_OPT_END
 
 
 /**
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 00d8580..748eee7 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@