iDevGames Forums
Gaussian blur, software fallback on GMA950 - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Gaussian blur, software fallback on GMA950 (/thread-3166.html)



Gaussian blur, software fallback on GMA950 - Fenris - Jul 21, 2007 09:04 AM

I've got a pretty trivial shader that falls back to software rendering:

Code:
uniform sampler2D bloomTexture;
void main ()
{
    const float halfPixel = 0.5 / 256.0;
    const vec2 left = vec2 (-1.0/256.0 + halfPixel, 0.0);
    const vec2 right = vec2 (1.0/256.0 + halfPixel, 0.0);
    const vec2 up = vec2 (0.0, -1.0/256.0 + halfPixel);
    const vec2 down = vec2 (0.0, 1.0/256.0 + halfPixel);

    float brightness0 = texture2D (bloomTexture, gl_TexCoord[0].st + right).a;
    float brightness1 = texture2D (bloomTexture, gl_TexCoord[0].st + left).a;
    float brightness2 = texture2D (bloomTexture, gl_TexCoord[0].st).a * 2.0;
    float brightness3 = texture2D (bloomTexture, gl_TexCoord[0].st + up).a;
    float brightness4 = texture2D (bloomTexture, gl_TexCoord[0].st + down).a;

    float a = (brightness0 + brightness1 + brightness2 + brightness3 + brightness4) / 6.0;

    gl_FragColor = vec4(vec3(1,1,1), a);
}

This one falls back when I accumulate the brightnesses - I can add the first three terms, but the fourth causes fallback. It does suggest that I'm breaking the max instruction limit, but it does seem as a pretty low limit in that case? Does it seem like an explanation anyway?


Gaussian blur, software fallback on GMA950 - aarku - Jul 21, 2007 10:54 AM

Could you possibly be exceeding the maximum number of dependent texture reads? Or MAX_PROGRAM_TEX_INDIRECTIONS_ARB of 4? Just some ideas.

-Jon


Gaussian blur, software fallback on GMA950 - OneSadCookie - Jul 21, 2007 02:16 PM

I know Reubert was having problems yesterday with a shader on the GMA 950 that did four texture reads, and his final solution was to have it do 3.

I know theoretically many more than four should work, but perhaps there is a bug in the driver...

In your case you could also be breaking the eight temporaries limit. You can try reordering the shader (which shouldn't matter, but might) and you can try writing an equivalent ARBfp program (to see whether it's a hardware issue or a GLSL compiler issue).


Gaussian blur, software fallback on GMA950 - Fenris - Jul 21, 2007 03:06 PM

...or, since this most likely only affects the crap GMA950 in my MacBook, just silently kill the bloom effect if it can't run in hardware. Thanks for the insight though, but I'm nearing some sort of deadline and really can't be bothered with this kind of feature creep. Smile


Gaussian blur, software fallback on GMA950 - macnib - Jul 22, 2007 07:55 AM

I see a divide by 6. Is that suppose to be a divide by 5? Its an average. Unless, there is a zero term in there.

I think this is a good bloom tutorial.

http://prideout.net/bloom/index.html


Gaussian blur, software fallback on GMA950 - reubert - Jul 22, 2007 01:34 PM

There definitely seems to be something wrong with the driver as I did find that 3 was the limit. I'm not sure about texture dependencies or indirects, or exactly what that means, but your shader looks a lot like mine. ie. calculate some tex coords, do some lookups, do some math, spit out a color. It's not like any texture lookup depends on any previous lookup or anything like that.


Gaussian blur, software fallback on GMA950 - Frogblast - Jul 22, 2007 10:06 PM

To remove the texture indirections, you can modify all of the texture coordinates up in the vertex shader and pass texcoords for non-dependent reads down in several varyings.

Please file a radar on this issue as well. A max of 3 seems a bit low.


Gaussian blur, software fallback on GMA950 - Hog - Jul 22, 2007 11:16 PM

macnib Wrote:I see a divide by 6. Is that suppose to be a divide by 5? Its an average. Unless, there is a zero term in there.

i see 6 values, the center is twice.


Gaussian blur, software fallback on GMA950 - reubert - Jul 27, 2007 05:14 PM

Frogblast Wrote:To remove the texture indirections, you can modify all of the texture coordinates up in the vertex shader and pass texcoords for non-dependent reads down in several varyings.

Unfortunately this made no difference, no matter what I do I am limited to 3 reads.

I believe in my case it may be to do with FBOs. I am both reading from an FBO and writing to an FBO.


Gaussian blur, software fallback on GMA950 - Fenris - Jul 28, 2007 01:36 AM

I did try Frogblasts' suggestion too, and no improvement. I've filed a radar on it, which got upclassed from "Performance issue" (my submission) to "Serious bug", which might be a good indication.


Gaussian blur, software fallback on GMA950 - reubert - Jul 28, 2007 04:55 PM

Cool, good effort Fenris. I must figure out how to file radars one day.


Gaussian blur, software fallback on GMA950 - OneSadCookie - Jul 28, 2007 05:00 PM

http://bugreport.apple.com/

It should be burned into your brain >Sad