[Mesa-dev] [PATCH 1/8] meta: Fix blit shader compile on non-glsl-130 drivers.

Kenneth Graunke kenneth at whitecape.org
Fri Feb 14 20:01:17 PST 2014


On 02/14/2014 07:04 PM, Ian Romanick wrote:
> On 02/14/2014 05:09 PM, Kenneth Graunke wrote:
>> On 02/14/2014 03:00 PM, Eric Anholt wrote:
>>> Compare this VS to the one for the post-130 case.  Fixes piglit 
>>> glsl-lod-bias, and presumably tons of other code (I haven't done
>>> a full piglit run on swrast).
>>>
>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74911 --- 
>>> src/mesa/drivers/common/meta.c | 2 +- 1 file changed, 1
>>> insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/drivers/common/meta.c
>>> b/src/mesa/drivers/common/meta.c index d3ca3b7..dd905dd 100644 
>>> --- a/src/mesa/drivers/common/meta.c +++
>>> b/src/mesa/drivers/common/meta.c @@ -193,7 +193,7 @@
>>> _mesa_meta_setup_blit_shader(struct gl_context *ctx, ||
>>> ctx->Const.GLSLVersion < 130) { vs_source = "attribute vec2
>>> position;\n" -         "attribute vec3 textureCoords;\n" +
>>> "attribute vec4 textureCoords;\n" "varying vec4 texCoords;\n" 
>>> "void main()\n" "{\n"
>>>
> 
>> This is obviously: Reviewed-by: Kenneth Graunke
>> <kenneth at whitecape.org>
> 
>> But I wonder, would it be terribly harmful to just override 
>> ctx->Const.GLSLVersion to 130 in Meta so #version 130 works?
> 
> ctx->Const.GLSLVersion is already (proably) 130 or greater.  There are
> checks in the compiler against API to validate the version in the
> shader.  Otherwise applications with an OpenGL ES 3.0 context could
> compile desktop GLSL 1.30 shaders, and that seems bad. :)

I think you misunderstand.

This patch is fixing a bug in a block of code which is:

if (ctx->Const.GLSLVersion < 130) {
   ...do version 110 shaders...
} else {
   ...do version 130 or 300 es shaders...
}

So, the duplication is precisely for drivers that don't do 1.30.  Like
Gen4-5...

--Ken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140214/6759491c/attachment-0001.pgp>


More information about the mesa-dev mailing list