Sign in to follow this  
MARS_999

Odd error with GLSL in VS with 6800

Recommended Posts

MARS_999    1627
I am trying to check for a height in the VS like this
//temp is a varying float

    if(gl_Vertex.y <= .02)
       temp = gl_Vertex.y;

and I get a compile error in RenderMonkey and my code. The code above is the problem and once removed it runs fine? Any ideas thanks... Oh if I remember right it runs fine on my ATI card.. :(

Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by SirKnight
Well what's the error??


Well as of now I am now away from my desktop so I can't look it up, but I am on my laptop with the ATI card and it works fine...

code on ATI

//VS
varying float temp;
if(gl_Vertex.y <= .02)
temp = gl_Vertex.y;



Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by dbzprogrammer
.02 to 0.02. That could be the problem...


Hmm not sure why that would be, but I can try it once I get back to my desktop.

Share this post


Link to post
Share on other sites
dbzprogrammer    100
Quote:
Original post by MARS_999
Quote:
Original post by dbzprogrammer
.02 to 0.02. That could be the problem...


Hmm not sure why that would be, but I can try it once I get back to my desktop.


Neither am I, but it's the only thing I see wrong. Why is RenderMonkey not giving you an error on your ATI but not your GeForce? Or what error are you getting? (List specifcally please)

Share this post


Link to post
Share on other sites
GOCP    122
ATI's GLSL compiler can be a bit picky. Make sure all numbers are correctly formated and of the correct type... i.e

float * int

on a Nvidia will compile but will fail on an ATI (in my experience)

Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by GOCP
ATI's GLSL compiler can be a bit picky. Make sure all numbers are correctly formated and of the correct type... i.e

float * int

on a Nvidia will compile but will fail on an ATI (in my experience)



Not to be rude, but my post stated my ATI version works. ;) The Nvidia is messing up. I will later today try them out and get the error RM is spitting out and post it. But thanks for everyones help so far...

Share this post


Link to post
Share on other sites
derodo    122
I suffered a lot of weird behaviours from RenderMonkey too...have you tried changing that ".02" by "0.02"?...believe it or not, it can make a difference...

I have an ATI 9700Pro and use to get lots of silly error messages like that one

Share this post


Link to post
Share on other sites
MARS_999    1627
Ok, I tried the 0.02 and no dice. Here is the message in RM, mind you this code is 100% same as the ATI code I am using and the ATI card runs fine.


OpenGL Preview Window: Compiling vertex shader API(OpenGL) /Effect Group 1/Effect1/Pass 0/Vertex Program/ ... success
OpenGL Preview Window: Compiling fragment shader API(OpenGL) /Effect Group 1/Effect1/Pass 0/Fragment Program/ ... success
OpenGL Preview Window: Linking program .. failure
Vertex info
-----------
Internal error: assembly compile error for vertex shader at offset 7296:
-- error message --
line 149, column 29: error: invalid operand variable
-- internal assembly text --
!!ARBvp1.0
OPTION NV_vertex_program3;
# cgc version 1.5.0000, build date Nov 11 2005 14:12:07
# command line args:
#vendor NVIDIA Corporation
#version 1.0.02
#profile vp40
#program main
#semantic gl_ModelViewMatrix
#semantic gl_NormalMatrix
#semantic gl_ModelViewProjectionMatrixTranspose
#semantic gl_LightSource
#semantic tileAmount
#var float3 gl_Normal : $vin.NORMAL : NORMAL : -1 : 1
#var float4 gl_Vertex : $vin.POSITION : POSITION : -1 : 1
#var float4 gl_MultiTexCoord0 : $vin.TEXCOORD0 : TEXCOORD0 : -1 : 1
#var float4 gl_Position : $vout.POSITION : HPOS : -1 : 1
#var float4x4 gl_ModelViewMatrix : : c[0], 4 : -1 : 1
#var float3x3 gl_NormalMatrix : : c[4], 3 : -1 : 1
#var float4x4 gl_ModelViewProjectionMatrixTranspose : : c[7], 4 : -1 : 1
#var float4 gl_LightSource[0].ambient : : : -1 : 0
#var float4 gl_LightSource[0].diffuse : : : -1 : 0
#var float4 gl_LightSource[0].specular : : : -1 : 0
#var float4 gl_LightSource[0].position : : c[12] : -1 : 1
#var float4 gl_LightSource[0].halfVector : : : -1 : 0
#var float3 gl_LightSource[0].spotDirection : : : -1 : 0
#var float gl_LightSource[0].spotExponent : : : -1 : 0
#var float gl_LightSource[0].spotCutoff : : : -1 : 0
#var float gl_LightSource[0].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[0].constantAttenuation : : : -1 : 0
#var float gl_LightSource[0].linearAttenuation : : : -1 : 0
#var float gl_LightSource[0].quadraticAttenuation : : : -1 : 0
#var float4 gl_LightSource[1].ambient : : : -1 : 0
#var float4 gl_LightSource[1].diffuse : : : -1 : 0
#var float4 gl_LightSource[1].specular : : : -1 : 0
#var float4 gl_LightSource[1].position : : : -1 : 0
#var float4 gl_LightSource[1].halfVector : : : -1 : 0
#var float3 gl_LightSource[1].spotDirection : : : -1 : 0
#var float gl_LightSource[1].spotExponent : : : -1 : 0
#var float gl_LightSource[1].spotCutoff : : : -1 : 0
#var float gl_LightSource[1].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[1].constantAttenuation : : : -1 : 0
#var float gl_LightSource[1].linearAttenuation : : : -1 : 0
#var float gl_LightSource[1].quadraticAttenuation : : : -1 : 0
#var float4 gl_LightSource[2].ambient : : : -1 : 0
#var float4 gl_LightSource[2].diffuse : : : -1 : 0
#var float4 gl_LightSource[2].specular : : : -1 : 0
#var float4 gl_LightSource[2].position : : : -1 : 0
#var float4 gl_LightSource[2].halfVector : : : -1 : 0
#var float3 gl_LightSource[2].spotDirection : : : -1 : 0
#var float gl_LightSource[2].spotExponent : : : -1 : 0
#var float gl_LightSource[2].spotCutoff : : : -1 : 0
#var float gl_LightSource[2].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[2].constantAttenuation : : : -1 : 0
#var float gl_LightSource[2].linearAttenuation : : : -1 : 0
#var float gl_LightSource[2].quadraticAttenuation : : : -1 : 0
#var float4 gl_LightSource[3].ambient : : : -1 : 0
#var float4 gl_LightSource[3].diffuse : : : -1 : 0
#var float4 gl_LightSource[3].specular : : : -1 : 0
#var float4 gl_LightSource[3].position : : : -1 : 0
#var float4 gl_LightSource[3].halfVector : : : -1 : 0
#var float3 gl_LightSource[3].spotDirection : : : -1 : 0
#var float gl_LightSource[3].spotExponent : : : -1 : 0
#var float gl_LightSource[3].spotCutoff : : : -1 : 0
#var float gl_LightSource[3].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[3].constantAttenuation : : : -1 : 0
#var float gl_LightSource[3].linearAttenuation : : : -1 : 0
#var float gl_LightSource[3].quadraticAttenuation : : : -1 : 0
#var float4 gl_LightSource[4].ambient : : : -1 : 0
#var float4 gl_LightSource[4].diffuse : : : -1 : 0
#var float4 gl_LightSource[4].specular : : : -1 : 0
#var float4 gl_LightSource[4].position : : : -1 : 0
#var float4 gl_LightSource[4].halfVector : : : -1 : 0
#var float3 gl_LightSource[4].spotDirection : : : -1 : 0
#var float gl_LightSource[4].spotExponent : : : -1 : 0
#var float gl_LightSource[4].spotCutoff : : : -1 : 0
#var float gl_LightSource[4].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[4].constantAttenuation : : : -1 : 0
#var float gl_LightSource[4].linearAttenuation : : : -1 : 0
#var float gl_LightSource[4].quadraticAttenuation : : : -1 : 0
#var float4 gl_LightSource[5].ambient : : : -1 : 0
#var float4 gl_LightSource[5].diffuse : : : -1 : 0
#var float4 gl_LightSource[5].specular : : : -1 : 0
#var float4 gl_LightSource[5].position : : : -1 : 0
#var float4 gl_LightSource[5].halfVector : : : -1 : 0
#var float3 gl_LightSource[5].spotDirection : : : -1 : 0
#var float gl_LightSource[5].spotExponent : : : -1 : 0
#var float gl_LightSource[5].spotCutoff : : : -1 : 0
#var float gl_LightSource[5].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[5].constantAttenuation : : : -1 : 0
#var float gl_LightSource[5].linearAttenuation : : : -1 : 0
#var float gl_LightSource[5].quadraticAttenuation : : : -1 : 0
#var float4 gl_LightSource[6].ambient : : : -1 : 0
#var float4 gl_LightSource[6].diffuse : : : -1 : 0
#var float4 gl_LightSource[6].specular : : : -1 : 0
#var float4 gl_LightSource[6].position : : : -1 : 0
#var float4 gl_LightSource[6].halfVector : : : -1 : 0
#var float3 gl_LightSource[6].spotDirection : : : -1 : 0
#var float gl_LightSource[6].spotExponent : : : -1 : 0
#var float gl_LightSource[6].spotCutoff : : : -1 : 0
#var float gl_LightSource[6].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[6].constantAttenuation : : : -1 : 0
#var float gl_LightSource[6].linearAttenuation : : : -1 : 0
#var float gl_LightSource[6].quadraticAttenuation : : : -1 : 0
#var float4 gl_LightSource[7].ambient : : : -1 : 0
#var float4 gl_LightSource[7].diffuse : : : -1 : 0
#var float4 gl_LightSource[7].specular : : : -1 : 0
#var float4 gl_LightSource[7].position : : : -1 : 0
#var float4 gl_LightSource[7].halfVector : : : -1 : 0
#var float3 gl_LightSource[7].spotDirection : : : -1 : 0
#var float gl_LightSource[7].spotExponent : : : -1 : 0
#var float gl_LightSource[7].spotCutoff : : : -1 : 0
#var float gl_LightSource[7].spotCosCutoff : : : -1 : 0
#var float gl_LightSource[7].constantAttenuation : : : -1 : 0
#var float gl_LightSource[7].linearAttenuation : : : -1 : 0
#var float gl_LightSource[7].quadraticAttenuation : : : -1 : 0
#var float tileAmount : : c[13] : -1 : 1
#var float3 lightVec : $vout.TEX2 : TEX2 : -1 : 1
#var float waterColorHeight : $vout.TEX3 : TEX3 : -1 : 1
#var float2 blendmap_texCoord : $vout.TEX0 : TEX0 : -1 : 1
#var float3 normal : $vout.TEX1 : TEX1 : -1 : 1
#var float3 viewVec : $vout.TEX4 : TEX4 : -1 : 1
#var float3 tangent : : : -1 : 0
#var float2 texture_coord : $vout.TEX5 : TEX5 : -1 : 1
#const c[11] = 0.04
PARAM c[14] = { program.local[0..10],
{ 0.039999999 },
program.local[12..13] };
TEMP R0;
TEMP R1;
TEMP R2;
TEMP CC;
BB1:
MUL R0, vertex.position.y, c[1];
MAD R0, vertex.position.x, c[0], R0;
MAD R0, vertex.position.z, c[2], R0;
MAD R0, vertex.position.w, c[3], R0;
ADD R1, -R0, c[12];
DP4 R1.w, R1, R1;
RSQ R1.w, R1.w;
MUL result.texcoord[2].xyz, R1.w, R1;
DP4 R1.w, -R0, -R0;
MUL R2.xyz, vertex.normal.y, c[5];
MAD R2.xyz, vertex.normal.x, c[4], R2;
MAD R1.xyz, vertex.normal.z, c[6], R2;
DP3 R0.w, R1, R1;
RSQ R1.w, R1.w;
RSQ R0.w, R0.w;
MOV result.texcoord[3].x, result.texcoord[3];
SLEC CC.x, vertex.position.y, c[11];
MOV result.texcoord[3].x(GT), vertex.position.y;
MUL result.texcoord[4].xyz, R1.w, -R0;
MUL result.texcoord[1].xyz, R0.w, R1;
MOV result.texcoord[0].xy, vertex.texcoord[0];
MUL result.texcoord[5].xy, vertex.texcoord[0], c[13].x;
DP4 result.position.w, vertex.position, c[10];
DP4 result.position.z, vertex.position, c[9];
DP4 result.position.y, vertex.position, c[8];
DP4 result.position.x, vertex.position, c[7];
END
# 26 instructions, 3 R-regs


Share this post


Link to post
Share on other sites
MARS_999    1627
bump...

Not sure if this is right but looks like to me that the output from RM shows that it store the const for the if as a const variable and the local parameters is .0399999 which looks like a rounding error????

Share this post


Link to post
Share on other sites
_the_phantom_    11250
To be honest, if its having problems at such a level its probably worth poking someone at NV devrel about it, because to my untrained eye it looks like the compiler is crapping up somewhere..

If you do contact them then make sure you give some sample code which easily reproduces the problem, you stand a better chance of getting a responce.

Share this post


Link to post
Share on other sites
MARS_999    1627
Well I got an answer back. The issue is that I didn't write to my varying variable in all paths... On the ATI card this works fine but not NVIDIA. I was under the assumption that the variable would be set to zero kind of like a static variable since it is global... Oh well lesson learned and hope it helps someone else...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this