Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Basic HLSL texture question

$
0
0
Is the slot pointed to by a Texture2D/SamplerState in a pixel shader assigned at compile time and immutable? So on the HLSL side I'd have: Texture2D tex0 : register(t0); Texture2D tex1 : register(t1); SamplerState smp0 : register(s0); SamplerState smp1 : register(s1); And then on the host side: context->PSSetShaderResource( 0, 1, textureA ) context->PSSetShaderResource( 1, 1, textureB ) context->PSSetSamplers( 0, 1, samplerA ); context->PSSetSamplers( 1, 1, samplerB ); When the program is run tex0 would refer to textureA, tex1 to textureB and so on with the samplers. What if I wanted to switch them around on the HLSL side. So in OpenGL I could do glUniform1i( tex0, 1 ) and glUniform( tex1, 0 ). This would make tex0 refer to textureB and tex1 refer to textureA. Can the same be done with DX11? If so what is the call to modify tex0/tex0 - and the smp0/smp1?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>