Sign in to follow this  
Patrick Huot

Can't use ps_3_0 shaders with null vertex shader

Recommended Posts

I am coding several effects in HLSL using the effect framework and when I try to do this : technique MyTech { pass p0 { VertexShader = NULL; PixelShader = compile ps_3_0 PS(16); } } I get the following error when the Debug Version of Direct3D is used : Direct3D9: (ERROR) :ps_3_0 shader can only be used with vs_3_0+ shader (SWVP or HWVP), or transformed vertices. If I use the Retail version, everything is ok and my shader if doing the expected job. I can get rid of the error by coding a dummy pass thru vertex shader but then I get a significant performance penality. I am using the lastest DirectX SDK (feb 2007). I've spent a couple of days on this problem so any help would be greatly appreciated. Thanks

Share this post


Link to post
Share on other sites
I'm just wondering how can you get it working without a 3.0 vertex shader, because the specifications are saying that you can't :)
Are you gettin a performance penalty with a simple 3.0VS? How big?

Share this post


Link to post
Share on other sites
Well it’s against the spec but only the debug runtime does strict checks. The release runtime let the driver decide and they are more tolerant but it’s not guaranteed that it will still work with the next driver release.

A pass thru shader should not be slower than the fixed function vertex processing as the driver converts it anyway. You should use some profiler tools like PIX or NVPerfHUD to see what’s going wrong.

Share this post


Link to post
Share on other sites
FYI, one of the reasons for this restriction is that VS.3.0 supports 10 texture coordinates, but the fixed function pipeline only outputs 8 sets of texture coordinates.

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
Why not just use transformed vertices?


I have to admit I don't know how to specify that I want to use the transformed vertices in an effect file (DX9). The thing is some of my effects require a pass thru Vertex Shader and some real Vertex Shader.

Share this post


Link to post
Share on other sites
You can't specify you're using Transformed vertices in the .fx file, you can only do so from the Declaration/FVF. You seem to have your design a bit messed up, the .fx file shouldn't be determining which input data it is getting from the VB (transformed or untransformed), that should be handled by your own code.

Sounds like you just need 2 .fx files, or two techniques in the same file, one for each case. Trying to set the VS to null is not recommended as a method of bypassing the VS.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this