Sign in to follow this  

PixelShader Samplers ?

This topic is 3550 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 guys, I want my pixel shader to have access to two (or more) textures: // app g_d3d_device->SetTexture(0,texture_0); g_d3d_device->SetTexture(1,texture_1); // shader sampler2D image0; // I can't find a sematic for here sampler2D image1; // this should output texture_0 output.color=tex2D(image0,input.uv); // and this should output texture_1 output.color=tex2D(image1,input.uv); ...but they both output the same thing, whatever is in stage0 I see tons of HLSL examples but they rarely show you how to get stuff into the shader. Thanks.

Share this post


Link to post
Share on other sites
Something like:
sampler image : register(s0);

should do what you want.

But I would also rather suggest using the sampler state parameters.
If you also need to set filtering or addressing parameters, they can be set by global integer variables.


int g_TexFilter;
int g_TexAnisotropy;

texture g_Texture;
sampler g_sTex = sampler_state
{
Texture = <g_Texture>;
AddressU = Wrap;
AddressV = Wrap;
MipFilter = LINEAR;
MagFilter = LINEAR;
MinFilter = (g_TexFilter);
MaxAnisotropy = (g_TexAnisotropy);
}

Share this post


Link to post
Share on other sites

This topic is 3550 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.

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