Hi Trajce,

I have noticed issues with Shader compilation on 256 (and above) series on 
Windows 7. Some fragment shaders using gl_LightSource fields were generating 
internal compiler errors. In fact I also posted a bug report to NVidia. These 
errors were normally reported by OSG with compilation log showing assembly cg 
output that was causing trouble for compiler. You don't see any compilation 
errors even with OSG_NOTIFY_LEVEL=DEBUG_INFO ? 

I have attached the bug report I posted to NVidia you can check if it could 
related.

Cheers,
Wojtek




From: Trajce (Nick) Nikolov 
Sent: Thursday, August 05, 2010 8:47 AM
To: OpenSceneGraph Users 
Subject: [osg-users] latest NVIDIA drivers


Hi community, 


anyone has experienced some weirdness with the latest drivers from NVIDIA? My 
shaders just stopped working with them without any warning/error from OSG ...

-Nick



--------------------------------------------------------------------------------


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Any OpenGL program doing pixel shader lighting using standard 
OpenGL state variables may encounter this problem.
Compilation of pretty standard fragment shaders doing pixel lighting math 
using gl_LightSource / gl_FrontMaterial uniforms 
fail with internal GLSL compiler error: 

        Internal error: assembly compile error for fragment shader at offset 
13132:
        -- error message --
        line 254, column 1:  error: binding in multiple relative-addressedarrays
        
After examination it looks like gl_LightSource.attenuation factors are multiply 
generated into intermediate shader constants. This problem was not present on 
Windows drivers before 256 series. I observed the error with driver versions 
257.15 and 
recent WHQL 257.21 on GeForce FX 280 / GeForce FX 8800 GTS and Quadro 5800 
(Quadro Plex D2).
 I have not tested other boards. So it was happening on every board I tested. 

Below are simplified example shaders and generated GLSL compiler error output 
showing the error. 
My program uses 3 lights. Using 1 or 2 lights does not generate error:

Compiling VERTEX source:
  1: varying vec3 position;
  2: varying vec3 normal;
  3:
  4: void main(void)
  5: {
  6:  gl_Position = ftransform();
  7:  position = vec3(gl_ModelViewMatrix * gl_Vertex);
  8:  normal = normalize(gl_NormalMatrix * gl_Normal.xyz);
  9: }


Compiling FRAGMENT source:
  1: varying vec3 position;
  2: varying vec3 normal;
  3:
  4: void main( )
  5: {
  6:  vec4 ambient = vec4(0.0, 0.0, 0.0, 0.0);
  7:  vec4 diffuse = vec4(0.0, 0.0, 0.0, 0.0);
  8:  vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);
  9:
 10:  vec3 normalizedNormal = normalize(normal);
 11:
 12:  for(int lightId = 0; lightId < 3; lightId++)
 13:  {
 14:    vec3 lightVector = gl_LightSource[lightId].position.xyz;
 15:
 16:    float attenuation = 1.0;
 17:
 18:    if( gl_LightSource[lightId].position.w != 0.0 )
 19:    {
 20:       lightVector -= position;
 21:       float distance = length(lightVector);
 22:       attenuation = 1.0 / (gl_LightSource[lightId].constantAttenuation +
 23:          gl_LightSource[lightId].linearAttenuation * distance +
 24:          gl_LightSource[lightId].quadraticAttenuation * distance * 
distance)
 25:    }
 26:
 27:    ambient += attenuation * gl_LightSource[lightId].ambient;
 28:
 29:    vec3 normalizedLightVector = normalize(lightVector);
 30:
 31:    float nDotL = dot(normalizedNormal, normalizedLightVector);
 32:
 33:    if( nDotL > 0.0 )
 34:    {
 35:      diffuse += attenuation * nDotL * gl_LightSource[lightId].diffuse;
 36:
 37:      if(gl_FrontMaterial.shininess > 0.0) {
 38:        float nDotHV = 0.0001;
 39:        float pf = pow( nDotHV, gl_FrontMaterial.shininess );
 40:        specular += attenuation * pf * gl_LightSource[lightId].specular;
 41:      }
 42:    }
 43:  }
 44:
 45:  gl_FragColor =
 46:     gl_FrontLightModelProduct.sceneColor +
 47:     gl_FrontMaterial.emission +
 48:     ambient * gl_FrontMaterial.ambient +
 49:     diffuse * gl_FrontMaterial.diffuse +
 50:     specular * gl_FrontMaterial.specular;
 51: }
 52:

Linking osg::Program "" id=1 contextID=0
glLinkProgram "" FAILED
Program "" infolog:
Fragment info
-------------
Internal error: assembly compile error for fragment shader at offset 13132:
-- error message --
line 254, column 1:  error: binding in multiple relative-addressedarrays
-- internal assembly text --
!!NVfp4.0
OPTION NV_parameter_buffer_object2;
# cgc version 3.0.0001, build date Jun  7 2010
# command line args:
#vendor NVIDIA Corporation
#version 3.0.0.1
#profile gp4fp
#program main
#semantic gl_LightSource : state.light
#semantic gl_FrontMaterial : state.material.front
#semantic gl_FrontLightModelProduct : state.lightmodel.front
#var float4 gl_LightSource[0].ambient : state.light[0].ambient : c[0] : -1 : 1
#var float4 gl_LightSource[0].diffuse : state.light[0].diffuse : c[1] : -1 : 1
#var float4 gl_LightSource[0].specular : state.light[0].specular : c[2] : -1 : 1
#var float4 gl_LightSource[0].position : state.light[0].position : c[3] : -1 : 1
#var float4 gl_LightSource[0].halfVector : state.light[0].half : c[4] : -1 : 0
#var float3 gl_LightSource[0].spotDirection : state.light[0].spot.direction : 
c[5] : -1 : 0
#var float gl_LightSource[0].spotExponent : state.light[0].attenuation.w : c[6] 
: -1 : 0
#var float gl_LightSource[0].spotCutoff : state.light[0].spot.cutoff.x : c[7] : 
-1 : 0
#var float gl_LightSource[0].spotCosCutoff : state.light[0].spot.direction.w : 
c[8] : -1 : 0
#var float gl_LightSource[0].constantAttenuation : state.light[0].attenuation.x 
: c[9] : -1 : 1
#var float gl_LightSource[0].linearAttenuation : state.light[0].attenuation.y : 
c[10] : -1 : 1
#var float gl_LightSource[0].quadraticAttenuation : 
state.light[0].attenuation.z : c[11] : -1 : 1
#var float4 gl_LightSource[1].ambient : state.light[1].ambient : c[12] : -1 : 1
#var float4 gl_LightSource[1].diffuse : state.light[1].diffuse : c[13] : -1 : 1
#var float4 gl_LightSource[1].specular : state.light[1].specular : c[14] : -1 : 
1
#var float4 gl_LightSource[1].position : state.light[1].position : c[15] : -1 : 
1
#var float4 gl_LightSource[1].halfVector : state.light[1].half : c[16] : -1 : 0
#var float3 gl_LightSource[1].spotDirection : state.light[1].spot.direction : 
c[17] : -1 : 0
#var float gl_LightSource[1].spotExponent : state.light[1].attenuation.w : 
c[18] : -1 : 0
#var float gl_LightSource[1].spotCutoff : state.light[1].spot.cutoff.x : c[19] 
: -1 : 0
#var float gl_LightSource[1].spotCosCutoff : state.light[1].spot.direction.w : 
c[20] : -1 : 0
#var float gl_LightSource[1].constantAttenuation : state.light[1].attenuation.x 
: c[21] : -1 : 1
#var float gl_LightSource[1].linearAttenuation : state.light[1].attenuation.y : 
c[22] : -1 : 1
#var float gl_LightSource[1].quadraticAttenuation : 
state.light[1].attenuation.z : c[23] : -1 : 1
#var float4 gl_LightSource[2].ambient : state.light[2].ambient : c[24] : -1 : 1
#var float4 gl_LightSource[2].diffuse : state.light[2].diffuse : c[25] : -1 : 1
#var float4 gl_LightSource[2].specular : state.light[2].specular : c[26] : -1 : 
1
#var float4 gl_LightSource[2].position : state.light[2].position : c[27] : -1 : 
1
#var float4 gl_LightSource[2].halfVector : state.light[2].half : c[28] : -1 : 0
#var float3 gl_LightSource[2].spotDirection : state.light[2].spot.direction : 
c[29] : -1 : 0
#var float gl_LightSource[2].spotExponent : state.light[2].attenuation.w : 
c[30] : -1 : 0
#var float gl_LightSource[2].spotCutoff : state.light[2].spot.cutoff.x : c[31] 
: -1 : 0
#var float gl_LightSource[2].spotCosCutoff : state.light[2].spot.direction.w : 
c[32] : -1 : 0
#var float gl_LightSource[2].constantAttenuation : state.light[2].attenuation.x 
: c[33] : -1 : 1
#var float gl_LightSource[2].linearAttenuation : state.light[2].attenuation.y : 
c[34] : -1 : 1
#var float gl_LightSource[2].quadraticAttenuation : 
state.light[2].attenuation.z : c[35] : -1 : 1
#var float4 gl_LightSource[3].ambient : state.light[3].ambient : c[36] : -1 : 1
#var float4 gl_LightSource[3].diffuse : state.light[3].diffuse : c[37] : -1 : 1
#var float4 gl_LightSource[3].specular : state.light[3].specular : c[38] : -1 : 
1
#var float4 gl_LightSource[3].position : state.light[3].position : c[39] : -1 : 
1
#var float4 gl_LightSource[3].halfVector : state.light[3].half : c[40] : -1 : 0
#var float3 gl_LightSource[3].spotDirection : state.light[3].spot.direction : 
c[41] : -1 : 0
#var float gl_LightSource[3].spotExponent : state.light[3].attenuation.w : 
c[42] : -1 : 0
#var float gl_LightSource[3].spotCutoff : state.light[3].spot.cutoff.x : c[43] 
: -1 : 0
#var float gl_LightSource[3].spotCosCutoff : state.light[3].spot.direction.w : 
c[44] : -1 : 0
#var float gl_LightSource[3].constantAttenuation : state.light[3].attenuation.x 
: c[45] : -1 : 1
#var float gl_LightSource[3].linearAttenuation : state.light[3].attenuation.y : 
c[46] : -1 : 1
#var float gl_LightSource[3].quadraticAttenuation : 
state.light[3].attenuation.z : c[47] : -1 : 1
#var float4 gl_LightSource[4].ambient : state.light[4].ambient : c[48] : -1 : 1
#var float4 gl_LightSource[4].diffuse : state.light[4].diffuse : c[49] : -1 : 1
#var float4 gl_LightSource[4].specular : state.light[4].specular : c[50] : -1 : 
1
#var float4 gl_LightSource[4].position : state.light[4].position : c[51] : -1 : 
1
#var float4 gl_LightSource[4].halfVector : state.light[4].half : c[52] : -1 : 0
#var float3 gl_LightSource[4].spotDirection : state.light[4].spot.direction : 
c[53] : -1 : 0
#var float gl_LightSource[4].spotExponent : state.light[4].attenuation.w : 
c[54] : -1 : 0
#var float gl_LightSource[4].spotCutoff : state.light[4].spot.cutoff.x : c[55] 
: -1 : 0
#var float gl_LightSource[4].spotCosCutoff : state.light[4].spot.direction.w : 
c[56] : -1 : 0
#var float gl_LightSource[4].constantAttenuation : state.light[4].attenuation.x 
: c[57] : -1 : 1
#var float gl_LightSource[4].linearAttenuation : state.light[4].attenuation.y : 
c[58] : -1 : 1
#var float gl_LightSource[4].quadraticAttenuation : 
state.light[4].attenuation.z : c[59] : -1 : 1
#var float4 gl_LightSource[5].ambient : state.light[5].ambient : c[60] : -1 : 1
#var float4 gl_LightSource[5].diffuse : state.light[5].diffuse : c[61] : -1 : 1
#var float4 gl_LightSource[5].specular : state.light[5].specular : c[62] : -1 : 
1
#var float4 gl_LightSource[5].position : state.light[5].position : c[63] : -1 : 
1
#var float4 gl_LightSource[5].halfVector : state.light[5].half : c[64] : -1 : 0
#var float3 gl_LightSource[5].spotDirection : state.light[5].spot.direction : 
c[65] : -1 : 0
#var float gl_LightSource[5].spotExponent : state.light[5].attenuation.w : 
c[66] : -1 : 0
#var float gl_LightSource[5].spotCutoff : state.light[5].spot.cutoff.x : c[67] 
: -1 : 0
#var float gl_LightSource[5].spotCosCutoff : state.light[5].spot.direction.w : 
c[68] : -1 : 0
#var float gl_LightSource[5].constantAttenuation : state.light[5].attenuation.x 
: c[69] : -1 : 1
#var float gl_LightSource[5].linearAttenuation : state.light[5].attenuation.y : 
c[70] : -1 : 1
#var float gl_LightSource[5].quadraticAttenuation : 
state.light[5].attenuation.z : c[71] : -1 : 1
#var float4 gl_LightSource[6].ambient : state.light[6].ambient : c[72] : -1 : 1
#var float4 gl_LightSource[6].diffuse : state.light[6].diffuse : c[73] : -1 : 1
#var float4 gl_LightSource[6].specular : state.light[6].specular : c[74] : -1 : 
1
#var float4 gl_LightSource[6].position : state.light[6].position : c[75] : -1 : 
1
#var float4 gl_LightSource[6].halfVector : state.light[6].half : c[76] : -1 : 0
#var float3 gl_LightSource[6].spotDirection : state.light[6].spot.direction : 
c[77] : -1 : 0
#var float gl_LightSource[6].spotExponent : state.light[6].attenuation.w : 
c[78] : -1 : 0
#var float gl_LightSource[6].spotCutoff : state.light[6].spot.cutoff.x : c[79] 
: -1 : 0
#var float gl_LightSource[6].spotCosCutoff : state.light[6].spot.direction.w : 
c[80] : -1 : 0
#var float gl_LightSource[6].constantAttenuation : state.light[6].attenuation.x 
: c[81] : -1 : 1
#var float gl_LightSource[6].linearAttenuation : state.light[6].attenuation.y : 
c[82] : -1 : 1
#var float gl_LightSource[6].quadraticAttenuation : 
state.light[6].attenuation.z : c[83] : -1 : 1
#var float4 gl_LightSource[7].ambient : state.light[7].ambient : c[84] : -1 : 1
#var float4 gl_LightSource[7].diffuse : state.light[7].diffuse : c[85] : -1 : 1
#var float4 gl_LightSource[7].specular : state.light[7].specular : c[86] : -1 : 
1
#var float4 gl_LightSource[7].position : state.light[7].position : c[87] : -1 : 
1
#var float4 gl_LightSource[7].halfVector : state.light[7].half : c[88] : -1 : 0
#var float3 gl_LightSource[7].spotDirection : state.light[7].spot.direction : 
c[89] : -1 : 0
#var float gl_LightSource[7].spotExponent : state.light[7].attenuation.w : 
c[90] : -1 : 0
#var float gl_LightSource[7].spotCutoff : state.light[7].spot.cutoff.x : c[91] 
: -1 : 0
#var float gl_LightSource[7].spotCosCutoff : state.light[7].spot.direction.w : 
c[92] : -1 : 0
#var float gl_LightSource[7].constantAttenuation : state.light[7].attenuation.x 
: c[93] : -1 : 1
#var float gl_LightSource[7].linearAttenuation : state.light[7].attenuation.y : 
c[94] : -1 : 1
#var float gl_LightSource[7].quadraticAttenuation : 
state.light[7].attenuation.z : c[95] : -1 : 1
#var float4 gl_FrontMaterial.emission : state.material.front.emission : c[96] : 
-1 : 1
#var float4 gl_FrontMaterial.ambient : state.material.front.ambient : c[97] : 
-1 : 1
#var float4 gl_FrontMaterial.diffuse : state.material.front.diffuse : c[98] : 
-1 : 1
#var float4 gl_FrontMaterial.specular : state.material.front.specular : c[99] : 
-1 : 1
#var float gl_FrontMaterial.shininess : state.material.front.shininess : c[100] 
: -1 : 1
#var float4 gl_FragColor : $vout.COLOR : COL0[0] : -1 : 1
#var float4 gl_FrontLightModelProduct.sceneColor : 
state.lightmodel.front.sceneColor : c[101] : -1
#var float3 position : $vin.ATTR0 : ATTR0 : -1 : 1
#var float3 normal : $vin.ATTR1 : ATTR1 : -1 : 1
PARAM c[102] = { state.light[0].ambient,
                state.light[0].diffuse,
                state.light[0].specular,
                state.light[0].position,
                program.local[4..8],
                state.light[0].attenuation,
                state.light[0].attenuation,
                state.light[0].attenuation,
                state.light[1].ambient,
                state.light[1].diffuse,
                state.light[1].specular,
                state.light[1].position,
                program.local[16..20],
                state.light[1].attenuation,
                state.light[1].attenuation,
                state.light[1].attenuation,
                state.light[2].ambient,
                state.light[2].diffuse,
                state.light[2].specular,
                state.light[2].position,
                program.local[28..32],
                state.light[2].attenuation,
                state.light[2].attenuation,
                state.light[2].attenuation,
                state.light[3].ambient,
                state.light[3].diffuse,
                state.light[3].specular,
                state.light[3].position,
                program.local[40..44],
                state.light[3].attenuation,
                state.light[3].attenuation,
                state.light[3].attenuation,
                state.light[4].ambient,
                state.light[4].diffuse,
                state.light[4].specular,
                state.light[4].position,
                program.local[52..56],
                state.light[4].attenuation,
                state.light[4].attenuation,
                state.light[4].attenuation,
                state.light[5].ambient,
                state.light[5].diffuse,
                state.light[5].specular,
                state.light[5].position,
                program.local[64..68],
                state.light[5].attenuation,
                state.light[5].attenuation,
                state.light[5].attenuation,
                state.light[6].ambient,
                state.light[6].diffuse,
                state.light[6].specular,
                state.light[6].position,
                program.local[76..80],
                state.light[6].attenuation,
                state.light[6].attenuation,
                state.light[6].attenuation,
                state.light[7].ambient,
                state.light[7].diffuse,
                state.light[7].specular,
                state.light[7].position,
                program.local[88..92],
                state.light[7].attenuation,
                state.light[7].attenuation,
                state.light[7].attenuation,
                state.material.front.emission,
                state.material.front.ambient,
                state.material.front.diffuse,
                state.material.front.specular,
                state.material.front.shininess,
                state.lightmodel.front.scenecolor };
ATTRIB fragment_attrib[] = { fragment.attrib[0..1] };
TEMP R0, R1, R2, R3, R4, R5;
TEMP RC, HC;
OUTPUT result_color0 = result.color;
DP3.F R2.x, fragment.attrib[1], fragment.attrib[1];
RSQ.F R3.x, R2.x;
MOV.F R0, {0, 0, 0, 0}.x;
MOV.F R1, {0, 0, 0, 0}.x;
MOV.F R2, {0, 0, 0, 0}.x;
MUL.F R4.xyz, R3.x, fragment.attrib[1];
MOV.S R4.w, {0, 0, 0, 0}.x;
REP.S {3, 0, 0, 0};
MUL.S R3.x, R4.w, {12, 0, 0, 0};
MOV.U R3.x, R3;
MOV.F R3, c[R3.x + 3];
MOV.F R5.x, {0, 0, 0, 0};
SNE.F R5.x, R3.w, R5;
TRUNC.U.CC HC.x, R5;
MOV.F R3.w, {1, 0, 0, 0}.x;
IF    NE.x;
ADD.F R3.xyz, R3, -fragment.attrib[0];
DP3.F R3.w, R3, R3;
RSQ.F R5.x, R3.w;
MUL.S R5.y, R4.w, {12, 0, 0, 0}.x;
MOV.U R5.y, R5;
RCP.F R3.w, R5.x;
MUL.F R5.z, R3.w, c[R5.y + 10].y;
ADD.F R5.z, R5, c[R5.y + 9].x;
DIV.F R5.x, c[R5.y + 11].z, R5.x;
MAD.F R3.w, R5.x, R3, R5.z;
RCP.F R3.w, R3.w;
ENDIF;
DP3.F R5.x, R3, R3;
RSQ.F R5.x, R5.x;
MUL.F R3.xyz, R5.x, R3;
DP3.F R3.x, R4, R3;
MUL.S R5.x, R4.w, {12, 0, 0, 0};
MOV.U R3.y, R5.x;
SGT.F R3.z, R3.x, {0, 0, 0, 0}.x;
TRUNC.U.CC HC.x, R3.z;
MAD.F R0, R3.w, c[R3.y], R0;
IF    NE.x;
MUL.F R3.y, R3.w, R3.x;
MUL.S R3.z, R4.w, {12, 0, 0, 0}.x;
MOV.F R3.x, {0, 0, 0, 0};
MOV.U R3.z, R3;
SGT.F R3.x, c[100], R3;
TRUNC.U.CC HC.x, R3;
MAD.F R1, R3.y, c[R3.z + 1], R1;
IF    NE.x;
MOV.F R3.x, c[100];
MUL.S R3.y, R4.w, {12, 0, 0, 0}.x;
POW.F R3.x, {9.9999997e-005, 0, 0, 0}.x, R3.x;
MOV.U R3.y, R3;
MUL.F R3.x, R3.w, R3;
MAD.F R2, R3.x, c[R3.y + 2], R2;
ENDIF;
ENDIF;
ADD.S R4.w, R4, {1, 0, 0, 0}.x;
ENDREP;
MOV.F R3, c[96];
ADD.F R3, R3, c[101];
MAD.F R0, R0, c[97], R3;
MAD.F R0, R1, c[98], R0;
MAD.F result_color0, R2, c[99], R0;
END
# 61 instructions, 6 R-regs
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to