Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shaders under OSX
02-26-2008, 04:22 AM,
#3
 
thelusiv Wrote:I'm interested in the cleanup work you've done on the shaders - I think we (Joe & I) as coders tend to think of unrolling loops and other kinds of optimization is best left up to the compiler - but maybe this kind of thing doesn't apply to shaders. (Again I'm more or less ignorant on the subject of shaders...)

In other threads discussing OS X issues with graphics, and falling back on software rendering, it has been mentioned that there are still problems with OS X's implementation of OpenGL 2.0. Are you sure the problems lie within the shader code and not within OS X? (More grains of salt with reading this: I don't have any Apple machines...)

In the case of this code the arrays and loops consist of only two entries/iterations. It's unfortunate that different implementations of OpenGL (not just Apple's) treat optimisations in different ways.

In Apple's case there is a distinct problem with assigning heap space within loops or within conditional branches within GLSL, so unrolling these simple cases provides an instant fix.

I'll decruft the other shaders and see what I can do to fix full/fragment.glsl by comparing it with full-noshadow/fragment.glsl and see if Apple's software fallback can be prevented entirely without affecting the function of the shaders on other hardware. If I can manage this I'll put forward the patch.


Moving the variable declarations to the start of a code block is mostly just a style thing - it's what the orange book does. I only mention it because it helped me understand how the shaders worked and was part of the code that showed an increase in speed.


If I get a chance I'll also look at how the shaders are being used. I assume brake lights are working on other platform (I tried installing a windows XP version but haven't yet got the installation to work - more another time), so looking at how this is implemented may help clue me in to the problem.
Reply


Messages In This Thread
Shaders under OSX - by aegidian - 02-25-2008, 08:45 PM
[No subject] - by thelusiv - 02-25-2008, 09:45 PM
[No subject] - by aegidian - 02-26-2008, 04:22 AM
Re: Shaders under OSX - by abs1nth - 02-26-2008, 03:04 PM
Re: Shaders under OSX - by aegidian - 02-26-2008, 07:37 PM
[No subject] - by joevenzon_phpbb2_import3 - 02-26-2008, 09:28 PM
[No subject] - by joevenzon_phpbb2_import3 - 03-01-2008, 01:48 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)