Jump to content
  • Advertisement
Sign in to follow this  
AnAss

Extremely annoying ID3DXEffect problem

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

I am having a very annoying problem using an effect file.
texture g_a;
sampler A= sampler_state 
{ 
	Texture = <g_a>; 
	MinFilter = Point; 
	MagFilter = Point; 
	MipFilter = Point;
	AddressU = Wrap;	
	AddressV = Wrap;	
};

texture g_s0, g_s1, g_s2, g_s3, g_s4;
sampler S[5] = {
	sampler_state { Texture = <g_s0>; MinFilter = Point; MagFilter = Point; MipFilter = Point;	AddressU = Clamp;	AddressV = Clamp;	},
	sampler_state { Texture = <g_s1>; MinFilter = Point; MagFilter = Point; MipFilter = Point;	AddressU = Clamp;	AddressV = Clamp;	},
	sampler_state { Texture = <g_s2>; MinFilter = Point; MagFilter = Point; MipFilter = Point;	AddressU = Clamp;	AddressV = Clamp;	},
	sampler_state { Texture = <g_s3>; MinFilter = Point; MagFilter = Point; MipFilter = Point;	AddressU = Clamp;	AddressV = Clamp;	},
	sampler_state { Texture = <g_s4>; MinFilter = Point; MagFilter = Point; MipFilter = Point;	AddressU = Clamp;	AddressV = Clamp;	} 
};
I have several techniques that each use one more of the S array than the previous, i.e. I have a Technique1 which uses just S[0], Technique2 which uses S[0] and S[1], etc. All the techniques are the exact same HLSL code, but with a uniform int parameter that specifies N (the size of my operation = number of S samplers used), i.e.:
Technique T1
{ Pass P { ... PixelShader = compile ps_3_0 PS(1); } }
Technique T2
{ Pass P { ... PixelShader = compile ps_3_0 PS(2); } }
All techniques use the sampler A. T1 works fine. T2 fails, saying 'Direct3D9: (ERROR) :Unsupported min filter.' when I call BeginPass. I have other effects that use just as large of operations (in some cases I use all the supported 16 texture units, this is using 3). What is going wrong here?

Share this post


Link to post
Share on other sites
Advertisement
I haven't experienced this particular one in my case (never needed an array of samplers) but I have found limitations with the parser/compiler in similar circumstances.

My general conclusion was that the uniform keyword was great but not as robust as you might expect coming from, say, const-correctness in C++. I've had a few cases where I had to resort to the evils of #define to get the compiler to generate the code I wanted.

Two options:

1. Manually define the sampler_state constants - pretty sure they're the same as the API values. Seems pointless I know, but I've had success with seemingly trivial changes like this!

2. Examine the HLSL code it outputs and see if you can spot what its having trouble with. Make sure you emit debug statement as well.

hth
Jack

Share this post


Link to post
Share on other sites
Thanks for the reply.

I had good luck with just simply removing all of the sampler state variables except for the Texture = <g_sx>. When I deleted all of the filter values, it gave the same error with the texture addressing mode, so I think it is a bug in the effect compiler.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!