Jump to content
  • Advertisement
Sign in to follow this  

What's wrong with this shader? Works only with DX10+8800

This topic is 3901 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! Could anyone explain to me why does this shader require DX10 and/or an nVidia8800 to run?
texture2D vectorField;
sampler2D vectorSampler = sampler_state
	Texture = <vectorField>;
	MipFilter = POINT;
	MinFilter = POINT;
	MagFilter = POINT;
	AddressU = CLAMP;
	AddressV = CLAMP;		

struct vertexInput {
    float4 position		: POSITION;

struct vertexOutput {
    float4 position		: POSITION;
    float4 colour		: COLOR0;

float4x4 View : View;
float4x4 Projection : Projection;

float scale;
float4 pos;
float4 colour;

const float2 plusminus = float2(1,-1);

vertexOutput vsArrow(vertexInput IN) 
    vertexOutput OUT;
    float4 p = float4(0,0,0,1);
    float2 vect = tex2Dlod(vectorSampler, pos).xy;
    p.x = dot(IN.position.xy, vect*plusminus);
    p.y = dot(IN.position.xy, vect.yx);
    p *= scale;
    pos.xy = (pos.xy-float2(0.5,0.5))*plusminus;
    OUT.position = mul( p+pos, View);
    OUT.position = mul( OUT.position, Projection);
    OUT.colour = colour;

    return OUT;

It works as supposed with the config above. Produces empty screen on XP SP2 with nVidia6??? and 7????. The FX composer compiles it as a valid VS_3_0 vertex shader. Any ideas? shinjin

Share this post

Link to post
Share on other sites
Well, you are doing a vertex shader texture lookup, which isn't supported on all cards. Check if the geforce6/7 cards you are using support that or not.

If they support it, then maybe check your texture creation flags? I seem to recall there being some restrictions on how the texture is created/stored. The 8800 might be letting you get away with this due to its unified shaders.

Now, I've never actually used vertex shader texture lookup before in dx9. I looked into it once, but, my card didn't support it at all.

Share this post

Link to post
Share on other sites
tex2Dlod is definitely works with VS_3_0, that's a mistake in the SDK docs.

In the meantime I've managed to figure it out: the used texture format (D3DFMT_A16B16G16R16F) is not supported as vertex texture on those cards, switching to D3DFMT_A32B32G32R32F solved the problem

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!