Gaussian blur, software fallback on GMA950

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
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?
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #2
Could you possibly be exceeding the maximum number of dependent texture reads? Or MAX_PROGRAM_TEX_INDIRECTIONS_ARB of 4? Just some ideas.

-Jon
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
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).
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
...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
Quote this message in a reply
Member
Posts: 81
Joined: 2007.05
Post: #5
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
Quote this message in a reply
Member
Posts: 320
Joined: 2003.06
Post: #6
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.

Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
Quote this message in a reply
Member
Posts: 87
Joined: 2006.08
Post: #7
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.
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #8
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.
Quote this message in a reply
Member
Posts: 320
Joined: 2003.06
Post: #9
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.

Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #10
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.
Quote this message in a reply
Member
Posts: 320
Joined: 2003.06
Post: #11
Cool, good effort Fenris. I must figure out how to file radars one day.

Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #12
http://bugreport.apple.com/

It should be burned into your brain >Sad
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Gaussian blur g00se 0 2,431 Oct 3, 2011 12:58 PM
Last Post: g00se
  fbo causes software fallback? aBabyRabbit 5 4,322 Apr 5, 2008 12:00 AM
Last Post: aBabyRabbit
  GLSL fragment program limits on GMA950 (MacBook) memon 12 9,147 Oct 26, 2007 05:18 PM
Last Post: arekkusu
  Tell me about separable gaussian convolutions... TomorrowPlusX 11 6,287 Jul 17, 2006 03:48 PM
Last Post: Jones
  openGL blur kelvin 7 7,102 Mar 10, 2003 06:34 PM
Last Post: Tycho