Shader bug driving me crazy

Started by
3 comments, last by Shnoutz 21 years, 10 months ago
Hi, I''m about to turn crazy! I have this SIMPLE shader (code will follow), I compile it with D3DXAssembleShaderFromFile then I take the declarator and the compiled code and I store it in a new file the, in my engine, I load this file, extract the declarator, the complied code and pass it to CreateVertexShader. That was working perfecly for all my shaders, but now, I got this stupid shader that is not working for no apparent reason... Here is the code : vs.1.1 // world position mul r0, v0.x, c0 mad r0, v0.y, c1, r0 mad r0, v0.z, c2, r0 mad r0, v0.w, c3, r0 // world normal mul r1.xyz, v2.x, c0.xyz // *** mad r1.xyz, v2.y, c1.xyz, r1.xyz // *** mad r1.xyz, v2.z, c2.xyz, r1.xyz // *** // projected position mul r1, r0.x, c9 mad r1, r0.y, c10, r1 mad r1, r0.z, c11, r1 mad oPos, r0.w, c12, r1 Here are some precisions : - D3DXAssembleShaderFromFile GIVE ME NO ERRORS - CreateVertexShader is crashing telling me that I''m using vertex shader version 48.46 where max is 1.1 (!?! wtf !?!) - You noticed that the line marked with *** are useless but I will need them later, I compiled the shader without thoses lines and CreateVertexShader did not crashed (darn!) - I really am pissed, all my other shaders that are about 100x more complicated are working, and this simple one is not! - A friend of mine already had same kind of weird bug with assemblesahderfromfile (he was never able to fix it and commited suicide) did you? PLEASE HELP! It''s 3:30 in the morning and I wont find sleep until its fixed!
Advertisement
Try to use NVASM. It speeds up the development process and gives you extensive error messages.
Check out the second shader tutorial here on Gamedev.net on how to configure it.

- Wolf
Is v2 really your normal?
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
You might want to post your declarator as well as your vertex structure.



Jim Adams
home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX
Also, it's always a good idea to strip off the complexity and find the real problem. Hardcode the declaration and the shader in the code. If the shader assembles and works, then you know it's your loader. If not, start stripping complexity off the shader until you find the problem.

What is the shader supposed to be doing? If you are trying to do what I think you're trying to do, there is an easier way.

[edited by - CrazedGenius on May 31, 2002 12:23:52 AM]
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials

This topic is closed to new replies.

Advertisement