Jump to content
  • Advertisement
Sign in to follow this  
Seabolt

Shaders Failed to link on new computer

This topic is 2106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I'm hoping someone here has experience with this:

 

I recently got a new computer. I've moved over all my code, and when I try to run, my shaders fail to link. They work on my previous computer. I've installed the latest nVidia drivers, and I successfully create my shader context. But It says that I'm not writing to gl_Position when I know I am. 

 

Any ideas?

Share this post


Link to post
Share on other sites
Advertisement

Probably some small error in your code that your old driver was tolerating, but your new driver is being strict about mellow.png

 

Post the code and errors?

Share this post


Link to post
Share on other sites

The error I got was

 

Failed to Link VS_RenderFlatNoTex, errors:
 
Vertex info
-----------
(0) : error C5145: must write to gl_Position
 
The shader code is
 

uniform mat4	g_mWorldViewProjection;


attribute vec3	Input_Position;
attribute vec4	Input_Color0;

varying vec4	IO_Color0;

void M44xV3(mat4 Matrix_In, vec3 Vector_In, out vec4 Result)
{
        Result=(Matrix_In * vec4(Vector_In, 1.0));
}

void main()
{
	vec4 M44xV3_4_Result;
	M44xV3(g_mWorldViewProjection, Input_Position, M44xV3_4_Result);
					
					
	gl_Position = M44xV3_4_Result;
	IO_Color0 = Input_Color0;
}

(Note the code is a bit shortened. Sorry for the strange functions for multiplying, the shaders are generated.)

Also this linker error is happening to all of my shaders, not just this one. 

Share this post


Link to post
Share on other sites

Interesting, now it's saying it can't find void main()... I'm looking at the string of code I send it, and it definitely is there...

Share this post


Link to post
Share on other sites

I think I solved it, for some reason glShaderSource wasn't accepting the '0' length for the shader code. According to the spec that means that the array will be NULL terminated, and that it would use the length of the string as the code length. But if I just use a simple strlen on the code and pass that size it works... That's a bit worrying. 

Now I get to figure out why nothing is drawing anymore, and why there are no errors because of it! Yipee!

Share this post


Link to post
Share on other sites

I think I solved it, for some reason glShaderSource wasn't accepting the '0' length for the shader code. According to the spec that means that the array will be NULL terminated, and that it would use the length of the string as the code length. But if I just use a simple strlen on the code and pass that size it works... That's a bit worrying. 

Now I get to figure out why nothing is drawing anymore, and why there are no errors because of it! Yipee!

The specification says that the string is assumed to be null terminated if the length is less than zero. Strictly according to the specification, a length of zero actually means a zero-length string. You have to use a negative value to indicate an individually null-terminated string in the length vector.

Share this post


Link to post
Share on other sites

Huh that's interesting. I was previously using zero as my length and it was working.

I suppose either way one driver or another was messing it up.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!