https://bugs.freedesktop.org/show_bug.cgi?id=31499 --- Comment #6 from Tom Stellard <tstellar@xxxxxxxxx> 2010-11-20 00:07:55 PST --- As the shader is currently written, it should use 50 constants, your hardware only supports 32. So unless the KDE devs can modify the shader to use less constants, it won't work with your hardware. It might be possible to rewrite it to use 32 or fewer constants. It looks like there are only two possibilities for values in the offset array (although I could be wrong about this), so rewriting it like this might work: uniform sampler2D texUnit; uniform vec4 offsetValues[6]; uniform vec4 kernel[25]; unifrom vec4 offsetsAandB; void main(void) { vec2 offsetValueA = offsetsAandB.xy; vec2 offsetValueB = offsetsAandB.zw; vec4 sum = texture2D(texUnit, gl_TexCoord[0].st) * kernel[0]; for (int i = 1; i < 25; i++) { vec2 offset; int index = (i - 1) / 4; vec4 offsetIndexValues = offsetValues[index]; switch((i - 1) % 4) { case 0: offset = (offsetIndexValues.x == 1.0 ? offsetValueA : offsetValueB); break; case 1: offset = (offsetIndexValues.y == 1.0 ? offsetValueA : offsetValueB); break; case 2: offset = (offsetIndexValues.z == 1.0 ? offsetValueA : offsetValueB); break; case 3: offset = (offsetIndexValues.w == 1.0 ? offsetValueA : offsetValueB); break; } sum += texture2D(texUnit, gl_TexCoord[0].st - offset) * kernel[i]; sum += texture2D(texUnit, gl_TexCoord[0].st + offset) * kernel[i]; } gl_FragColor = sum; } The basic idea is to store an array of boolean values (1.0 and 0.0) that tell you what offset value (offsetValueA or offsetValueB) to choose for each value of i. So for i = 1, check offsetValues[0].x and for i = 2, check offsetValues[0].y, i = 5, check offsetValues[1].x, etc. If the compiler is smart enough, the above shader will only have 32 constants. The KDE developers might be able to spot some simpler ways to reduce the number of constants, since they have a better idea of what the code is doing. At the very least, the vec2 offset array could be packed into a vec4 array, that would reduce the number of constants by 12. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel