Pixel shader runs, but vertex doesn't

Started by
8 comments, last by M4573R 14 years, 5 months ago
I've never run into this problem before. I have a shader set and the vertex shader doesn't do anything, but the pixel shader still runs. It compiles fine, and all the function calls I checked returned S_OK. I may have missed something, but I can't imagine it half working.
Advertisement
Why wouldn't the pixel shader run? And what makes you say your vertex shader isn't running?
Are you using D3DFVF_XYZRHW by any chance?
I'm not using D3DFVF_XYZRHW. My vertex shader isn't running because my animations no longer work and the camera doesn't work unless I set the view matrix inside directx.
I've narrowed it down to a chunk of code. Depending on what I comment out, the vertex shader will start to work. BUT I still don't get ANY compile errors!
What in the code would cause the vertex shader to not run!?

  float4 pos = IN.position;  float3 nrm = IN.normal;      if( gSkin )  {		float3 Pos = float3(0,0,0);		nrm = float3(0,0,0);	 		float BlendWeightsArray[4] = (float[4])IN.BlendWeights;		int   IndexArray[4]        = (int[4])IN.BlendIndices;				for( int iBone = 0; iBone < NumBones; iBone++ )		{       				Pos += mul(IN.position , WorldMatrixArray[IndexArray[iBone]]) * BlendWeightsArray[iBone];				nrm += mul(IN.normal   , WorldMatrixArray[IndexArray[iBone]]) * BlendWeightsArray[iBone];		}				pos = float4(Pos,1.0);	}
Upon further fiddling, I've noticed my vertex shader breaks whenever I try to use TEXCOORD3 and above. I have other programs that use shaders with more texcoords than that on many different computers. Why would my shader break like that? From what I can see, the device is set up the same way I've done it before and there's nothing fishy in the shader.
What shader model are you using? Your card may be struggling with the loop. Try using a constant value instead of NumBones and see if that changes anything.
[size="1"]
I tried that. This same loop and shader code runs fine in other programs. I'm using shader 2.0. Numbones is passed to the vertex shader as 4 all the time btw. Its bone weights per vertex.
Could be a driver related issue. Have you got the latest ones?

You could also try using ATI's Shader Analyzer (ATI card not required) and PIX to try and work out what's going on.
That's the odd part, I have other programs with more complex shaders that run on all the same computers. I've tried 2 different laptops, and 3 different desktops. There's got to be some massive problem I'm missing. However I've heard the latest shader compiler in the SDK is bugged somewhat; maybe this is another problem. Is there ANY way that the device could be set up in a specific way that would cause the shader to break with a certain number of texcoords? I still get no compile errors and no shader errors when using the direct3d debugger.

This topic is closed to new replies.

Advertisement