Shader Issues

I am trying to come up with a platform independant way of handling shaders, and really struggling.

You may or may not be able to compile on the target device.

You may or may not be able to use binary shaders

You may or may not be able to use the OES extensions.

If you can compile on the device, then on some machines it may take up to 90 seconds to compile a shader.

If you can use binary shaders, then you may have to use an external sdk to do the actual compilation

So it’s a mess.

I tried to work out how many different binary formats there are, I have found ten, but I have no way to work out if this is definitive.

At the moment it looks to me that OpenGLES 1.0 is a platform independant API, and due to shader issues OpenGLES 2.0 is not.

I am really struggling to come up with a solution to this issue.

Has anyone got…

  1. A definitive list of binary formats
  2. A platform independant way of doing shaders
  3. A device list with details of supported API’s

Without some way of handling shaders. Why would you expend the effort to develop games when the real market size is some small percentage of the total OpenGLES market?

I have never come across a machine where it took more than a small fraction of a second to compile a single shader. If it’s taking 90 seconds then you have something truly outrageous going on somewhere.

That said, if you have a large number of shaders to compile, then the time can get kinda large. In such situations, I cache the shaders in a local file. So the shader is compiled locally the first time the program runs (typically during installation) - and the binary loaded thereafter. That way you only have to worry about the binary for the one specific format that this computer supports.

If subsequently there are errors - then it might be that the user updated their graphics card or something - and you’ll have to re-compile shaders. You can use the various glGetString stuff to figure out when this has happened.

At any rate - the trick is to do it on the users’ own machine - then you only have to consider a single format.

Unfortunately that’s not an option.

A lot of the platforms I am looking at don’t support source code compilation, they only support binary shaders. So you have to use a SDK to precompile them.

I originally thought as you do, but expierience has proved me wrong.

By the way it was the nokia n900 that was taking 90 seconds for a single compile

Guys the more I look at this, the more it concerns me.

Unless a change is made in the OpenGLes 2.0 specification, I have to say it is unfit for purpose.

You simply cannot call it platform independant if this issue is not dealt with.

Either devices HAVE to support source code compilation, or we have to come up with a way of dealing with multiple binary shader formats. Like a change to the link phase that converts the compiled binary format into real gpu shader code for the platform.

Simply ignoring the issue will reduce the number of adopters, especially now we have XNA on windows mobile.

I’m curious, what platforms are these?

The vast majority of OpenGL ES 2.0 implementations support compiling shaders from source, especially those that represent a viable market for games.

I’m having the guys in the office put together a list of all the devices we have to support and there shader capabilities.

Once they have done that, I will publish it here.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.