Jump to content
  • Advertisement
Sign in to follow this  
Bouga

Shader going into software mode?

This topic is 5059 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

Hi, I'm writing a skeletal animation vertex shader. The most simple version -no lighting, just one bone per vertex- of it works fine (well except the model looks all "jaggy" cos theres really 4 bones per vertex). This is the shader:
attribute vec2 TexCoord;
attribute vec3 Normal;
attribute vec4 Indexes;
attribute vec4 Weights;

uniform vec4 BoneMatrix[87];

void main(void)
{
gl_TexCoord[0].xy = TexCoord;
vec3 Temp=Normal;
vec4 RealVertex=gl_Vertex;
vec4 TempVert1,TempVert2,TempVert3,TempVert4;
ivec4 RealIndexes=ivec4(Indexes)*3;

gl_FrontColor=vec4(1.0,1.0,1.0,1.0);

TempVert1.x=dot(RealVertex,BoneMatrix[RealIndexes.x]);
TempVert1.y=dot(RealVertex,BoneMatrix[RealIndexes.x+1]);
TempVert1.z=dot(RealVertex,BoneMatrix[RealIndexes.x+2]);

TempVert1=TempVert1*Weights.x;
TempVert1.w=1.0;

gl_Position = gl_ModelViewProjectionMatrix * TempVert1;
}
But when I add the second vertex, like so:
attribute vec2 TexCoord;
attribute vec3 Normal;
attribute vec4 Indexes;
attribute vec4 Weights;

uniform vec4 BoneMatrix[87];

void main(void)
{
gl_TexCoord[0].xy = TexCoord;
vec3 Temp=Normal;
vec4 RealVertex=gl_Vertex;
vec4 TempVert1,TempVert2,TempVert3,TempVert4;
ivec4 RealIndexes=ivec4(Indexes)*3;

gl_FrontColor=vec4(1.0,1.0,1.0,1.0);

TempVert1.x=dot(RealVertex,BoneMatrix[RealIndexes.x]);
TempVert1.y=dot(RealVertex,BoneMatrix[RealIndexes.x+1]);
TempVert1.z=dot(RealVertex,BoneMatrix[RealIndexes.x+2]);


TempVert2.x=dot(RealVertex,BoneMatrix[RealIndexes.y]);
TempVert2.y=dot(RealVertex,BoneMatrix[RealIndexes.y+1]);
TempVert2.z=dot(RealVertex,BoneMatrix[RealIndexes.y+2]);
	
TempVert1=TempVert1*Weights.x;
TempVert1=TempVert1+TempVert2*Weights.y;
TempVert1.w=1.0;

gl_Position = gl_ModelViewProjectionMatrix * TempVert1;
}
The model goes all black and the frame rate drops to like a frame every 2-3 seconds. What could be the reason? I was told this could be caused by ogl going into soft ware rendering mode, becouse the shader is too complex. But why? Is that shader really complex? Dont think so, becouse I've seen a shader do 4 bones per vertex and 2 bones for the normal, but only it was written in gpu asm. So I was thinking - maybe my drivers are compiling the asm version in some wierd way? I have a R9500 128mb with the latest drivers, or I think its the latest drivers, I updated 2 weeks ago i think. Can I somehow see the assembler version of the shader, after compilation, using some glsl command or some outside tool? Or could there be another reason? Am I using some stuff that glsl really doesnt like in hw mode? Any suggestions would be most welcome! Thanks! [Edited by - Bouga on January 5, 2005 4:19:38 PM]

Share this post


Link to post
Share on other sites
Advertisement
after the shader compiles output the build log, that'll tell you whats going on and why its dropped into software mode.

Currently with ATI's drivers there isnt a way to get the assembler version back, heck I dont even know if they do an assembler version, it could very well go GLSL=>IL=>gpu mircocode (IL being an intermedatry languge after the front end has tokensied the input).

btw, you'll want to use [ source ][ /source ] to put your code in (without the spaces)

Share this post


Link to post
Share on other sites
Ahh, thanks, now I know the reason is: going into software becouse availeable number of temporary registers exceeded... any ideas how to fix that? I already seem to be creating a variable for all the neccessary in-the-middle values, where could it be adding some extra ones?

Share this post


Link to post
Share on other sites
i honestly dont know, but it could be related to the compiler not being up to the task, optermisation wise, right now so it might be using more temps than is really required.

Off the top of my head i cant think of a way to fix it, might wanna try asking on the OpenGL.org GLSL forum if they can help/confim what I think [smile]

Share this post


Link to post
Share on other sites
Hehe, I have thread there too: http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000576 , maybe you can post there ;)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!