Shader limitation

Started by Thomas., May 05, 2013, 12:08:57 PM

Previous topic - Next topic

Thomas.

In javadoc for GLSLShader class are mentioned four texture layers, but most of newer mobile GPUs support 8 texture units. Is supported more than four texture units?
What is maximal length of arrays in shader? In javadoc are arrays with length of 8. Is it maximal size? When I set array length of 16, will I get 16 positions of lights?

EgonOlsen

Quote from: Thomas. on May 05, 2013, 12:08:57 PM
...but most of newer mobile GPUs support 8 texture units.
Sure? At least the Adreno 320 still reports 4 for GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS. Support for more units is kinda build-in, but has never been activated or tested. Even most desktop gpus don't support more, so i fail to see the point somehow to bother with that ATM.
Quote from: Thomas. on May 05, 2013, 12:08:57 PM
What is maximal length of arrays in shader? In javadoc are arrays with length of 8. Is it maximal size? When I set array length of 16, will I get 16 positions of lights?
Regarding lights, you have 8 available (because there are 8 hardware lights in ES 1.x). If you write your own shader, you can set as many lights as you want. Where in the docs am i talking about a limit of 8 for an array's length? I can't anything like that... ???

Thomas.

#2
I probably looked at another number, maybe at texture processor units. No, but every array for light is length of 8 (ex. uniform vec3 lightPositions[8]). Ok, thanks for info.

Thomas.

#3
Quote from: EgonOlsen on May 05, 2013, 08:18:21 PM
...If you write your own shader, you can set as many lights as you want...
Are you sure? More than 8 lights do not work (9th light does nothing)

EgonOlsen

That's not what i meant. If you rely on jPCT's light implementation, 8 is the limit (per object, you can have more in the scene). If you want to use more, you have to manage them yourself in your own data structures and uniforms.

Thomas.

#5
OK, I just do not like, when is anything in my code limited from unknown reasons (I have to also limit number of lights in shader). Anyway, more than 8 per-pixel lights are to expensive for mobile devices, but if I ever need more, I can simple manage myself.

edit: You probably know how I generate light shader. Will be faster (+0.5ms) if I manage lights myself? I need to speed up the rendering process. Real map is running on SGS3 about 40fps and on Tegra3 and other lower devices it is unplayable...

EgonOlsen

Quote from: Thomas. on May 06, 2013, 05:21:44 PM
edit: You probably know how I generate light shader. Will be faster (+0.5ms) if I manage lights myself?
I see no reason, why it should be any faster...