Sign in to follow this  
RDragon1

sampler_state defaults via reflection?

Recommended Posts

Is there a way to get the values of the sampler_state object on a sampler as specified in the shader by using the d3d11 shader reflection system?

Ie if I have:


sampler samp = sampler_state
{
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
};

I can loop over the BoundResources of the fragment shader and get a D3D11_SHADER_INPUT_BIND_DESC that has a type of D3D_SIT_SAMPLER with the name "samp", but I don't see any method of extracting the filter/address settings?

Share this post


Link to post
Share on other sites
Native HLSL shaders don't have inline sampler states, that's part of the effects framework. If you want that info you can just ask the effect for the actual ID3D11Sampler and then call GetDesc.

Share this post


Link to post
Share on other sites
Ah okay, thanks. I'm not using the effects framework, so I will handle these parameters myself in the material system.

If this isn't supported I would have hoped this code would result in a shader compile error (using "ps_5_0" profile), but it doesn't. (using D3DX11CompileFromFile)

Share this post


Link to post
Share on other sites
Yeah it's kinda weird...there are certain things (like sampler_state) that are built into the language so that the effects framework can use it but have no meaning to native shaders. I don't even know of a way to query that information.

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