Bug 30752 - [r300g] Too many texture indirections. Strange behavior.
Summary: [r300g] Too many texture indirections. Strange behavior.
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r300 (show other bugs)
Version: git
Hardware: All Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-10 07:50 UTC by Ivan Sukin
Modified: 2010-11-22 02:03 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Ivan Sukin 2010-10-10 07:50:29 UTC
I have the naive blur convolution shader implementation:

uniform sampler2DRect tex;

void main(void)
{
    vec3 color11 = texture2DRect(tex, gl_TexCoord[0].st +
                                 vec2(-1.0, -1.0)).rgb;

    vec3 color12 = texture2DRect(tex, gl_TexCoord[0].st +
                                 vec2(0.0, -1.0)).rgb;

    vec3 color13 = texture2DRect(tex, gl_TexCoord[0].st +
                                 vec2(1.0, -1.0)).rgb;

    vec3 color21 = texture2DRect(tex, gl_TexCoord[0].st +
                                 vec2(-1.0, 0.0)).rgb;

    vec3 color22 = texture2DRect(tex, gl_TexCoord[0].st).rgb;

    vec3 color23 = texture2DRect(tex, gl_TexCoord[0].st + 
                                 vec2(1.0, 0.0)).rgb;
   
    vec3 color31 = texture2DRect(tex, gl_TexCoord[0].st +
                                 vec2(-1.0, 1.0)).rgb;

    vec3 color32 = texture2DRect(tex, gl_TexCoord[0].st + 
                                 vec2(0.0, 1.0)).rgb;

    vec3 color33 = texture2DRect(tex, gl_TexCoord[0].st +
                                 vec2(1.0, 1.0)).rgb;

    vec3 color = (color11 + color12 + color13 +
                  color21 + color22 + color23 +
                  color31 + color32 + color33);
            
    gl_FragColor = vec4(color / 9.0, 1);
}

It doesn't work, saying that there are too many texture indirections. But if I assign to vec3 color the value:
(2.0 * color11 + 2.0 * color12 + 2.0 * color13 +
 2.0 * color21 + 2.0 * color22 + 2.0 * color23 +
 2.0 * color31 + 2.0 * color32 + 2.0 * color33);
the shader will work. Is it the bug or the normal behavior?
Comment 1 Marek Olšák 2010-10-10 09:13:00 UTC
This is surely a bug.
Comment 2 Ivan Sukin 2010-10-10 23:08:33 UTC
I've noticed that it happens only with enabled GLSL optimizations. When I set MESA_GLSL=nopt, it doesn't happen.
Comment 3 Tom Stellard 2010-10-10 23:43:41 UTC
This is a very tricky bug.  I think the r300 instruction scheduler needs a major overhaul in order to correctly handle all of these "too many texture indirections" situations.  I'll see what I can do about this one.
Comment 4 Tom Stellard 2010-11-21 21:54:53 UTC
Can you try this again with the latest git master?
Comment 5 Ivan Sukin 2010-11-22 02:03:00 UTC
Thanks, this kind of shaders is working now.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.