PDA

View Full Version : Standard Pipeline GLSL



azcoder
03-21-2005, 02:45 PM
Would it be possible for the ARB to create an Open-Source reference implementation of the standard fixed-function pipeline that works on all OpenGL 2.0 platforms?

How much worse would the performace be than using the actual pipleine?

Is the general consensus with GLSL that you write one shader for all cards, rather than an ATI specific and NVidia specific shader that does the same thing?

Thanks for any input.....

ZbuffeR
03-21-2005, 04:41 PM
You mean something like this Shader Gen (http://developer.3dlabs.com/downloads/shadergen/index.htm) ?

About performance, I heard it is a bit slower, not that much.

And yes, GLSL is one language for all cards. In practice, because of bugs/unoffical extensions you can have uncompatible shaders for some cards.
To avoid creating non strictly GLSL shaders, see
http://developer.3dlabs.com/downloads/index.htm for GLSLvalidate and GLSLParserTest.

zed
03-21-2005, 05:34 PM
About performance, I heard it is a bit slower, not that muchim no expert but isnt the fixed pipeline on ati done with the shader pipeline anyways.
one cause of fps loss might be that glsl requires 32bit color and fixed normally uses less than that as standard.
anyways ild alos be interested of the results if anyones done any tests

azcoder
03-22-2005, 01:28 PM
Thanks for the link ZBuffer - That is similar to what I was looking for.

Funny thing is it works on my desktop(Nvidia 6800). But on the Laptop(Mobility Radeon 9800) I get an error:

Vertex shader failed to compile
InfoLog:ERROR: 0:17: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:26: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:27: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:28: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:38: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:39: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:40: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 7 compilation errors. No code generated.

In the long run, perhaps there might be benefit to have an ARB standard reference suite of GLSL shaders that all vendors work with.

azcoder
03-22-2005, 01:56 PM
For the record the shader in question that it doen't like is:

void pointLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
float nDotVP; // normal . light direction
float nDotHV; // normal . light half vector
float pf; // power factor
float attenuation; // computed attenuation factor
float d; // distance from surface to light source
vec3 VP; // direction from surface to light position
vec3 halfVector; // direction of maximum highlights

// Compute vector from surface to light position
VP = vec3 (gl_LightSource[i].position) - ecPosition3;

Seems like an issue using gl_LightSource[i] when i is passed as a parameter. Hardcoding gl_LightSource[0] eliminates the error.