[Bug 30007] Regression in r300g

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Sep 12 19:42:14 PDT 2010


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

--- Comment #23 from Tom Stellard <tstellar at gmail.com> 2010-09-12 19:42:14 PDT ---
I've created a new bug for kwin blur effect:
https://bugs.freedesktop.org/show_bug.cgi?id=30152

(In reply to comment #21)
> 
> The shader used for scaling the thumbnails is indeed indexing with a loop
> counter. That shader looks like this:
> 
> uniform sampler2D texUnit;
> uniform vec2 offsets[25];
> uniform vec4 kernel[25];
> uniform int kernelSize;
> 
> void main(void)
> {
>     vec4 sum = texture2D(texUnit, gl_TexCoord[0].st) * kernel[0];
>     for (int i = 1; i < kernelSize; i++) {
>         sum += texture2D(texUnit, gl_TexCoord[0].st - offsets[i]) * kernel[i];
>         sum += texture2D(texUnit, gl_TexCoord[0].st + offsets[i]) * kernel[i];
>     }
>     gl_FragColor = sum;
> }
> 
> That's why I think it's this shader that failed to compile. But this is not the
> shader that's used by the blur effect (which this bug report was about). So I
> believe we're looking at two separate issues here.


The r500 should be able to execute this, but there are two things that are
currently preventing correct executions:
1. Relative addressing in loops is not yet supported.
2. The frontend declares the variable "i" as a regular constant and not an
immediate, so the r300 compiler has no idea what its initial value is, or what
is incremented by, so  even with relative addressing in loops, this would still
fail

Does kernelSize have to be a uniform?  If it is always the same then adding it
as a constant would allow the loop to be unrolled which would get around both
of the above issue.  Even something like this would be better:

uniform sampler2D texUnit;
uniform vec2 offsets[25];
uniform vec4 kernel[25];
uniform int kernelSize;

void main(void)
{
    vec4 sum = texture2D(texUnit, gl_TexCoord[0].st) * kernel[0];
    for (int i = 1; i < 25; i++) {

sum += texture2D(texUnit, gl_TexCoord[0].st - offsets[i]) * kernel[i];
        sum += texture2D(texUnit, gl_TexCoord[0].st + offsets[i]) * kernel[i];
    }
    gl_FragColor = sum;
}

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the dri-devel mailing list