Jump to content
  • Advertisement
Sign in to follow this  
Gamat

Problems with Vertex shader

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

Hello there I'm having problems when trying to load a vertex shader from a file. When I use the ShaderLoader class and "fromfile" method, an exception is thrown eventhough the vertex shader i wrote, (ascii) is a valid one (or at least that's what it seems). Additional info: the vertex shader (saved in file 1.txt): vs.1.0 mov oPos,v0 ------------------------------------------------------------- the code in vb.net: Dim ExtShd As New VertexShader(Device, ShaderLoader.FromFile(Application.StartupPath & "\1.txt", Nothing, ShaderFlags.None)) ------------------------------------------------------------- the exception: "An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidDataException' occurred in microsoft.directx.direct3dx.dll Additional information: Error in the application." ------------------------------------------------------------- Other attempts: I have also tried to load a vertex shader sample written by microsoft, and the result is the same. I have succeded though to load a pixel shader with the same class, ShaderLoader, the same way. My video card has a programmable piepline (GeForceFx 5200) and supports VertexShader vs.3.0 and pixelshader ps.2.0 I have installed the latest drivers and the august SDK for DirectX9 Thank you

Share this post


Link to post
Share on other sites
Advertisement
No cards support vs.1.0, though I guess you can use it as a target. You might as well use vs.1.1 as it's the lowest version ever actually used in hardware.

Between DX8 and DX9 there were some changes to shaders. You need to specify what V0 holds in DX9. This is used to map your vertex data into the registers you're expecting the data to go into.


vs.1.1
dcl_position v0
dcl_color0 v5
dcl_texcoord0 v7
m4x4 oPos, v0, c0 // Transform position
mov oT0, v7 // Base texture coordinates
mov oD0, v5 // Pass vertex light to PS



Any problems related to ShaderLoader are, I'm guessing, C#, so I can't help with those. You could always try the command line shader assembler (C:\Program Files\Microsoft DirectX 9.0 SDK (June 2005)\Utilities\Bin\x86, called vsa). You may get more useful error messages from that.

Share this post


Link to post
Share on other sites
Thanks a lot. It worked perfectly. So i guess that if I use shderloader.fromfile() method, i have to specify that "declaration token " after the vs.x.x. I am curios because i haven't found those directives (decl_....) documented anywhere. Now it makes sense. The parser used by "FromFile" method constructs the DeclarationToken from the shader file. Thank you again. As you said there is a "slight" :) diffrence between DX8 and DX9. If I have misunderstand please reply. Thank you again....

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!