Created
February 13, 2017 12:13
-
-
Save aras-p/a5d727524cf60884397bcc71630fe058 to your computer and use it in GitHub Desktop.
Default sampler states in HLSL :(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HLSL does allow initializing sampler states with a syntax | |
// like this. However the state settings themselves are nowhere | |
// to be found in the compiled shader bytecode (as of d3dcompiler_47.dll | |
// 10.0.14393 from Win10 SDK), and can't be accessed via ID3D11ShaderReflection | |
// either. | |
// | |
// Looks like the compiler only emits the sampler default values if compiling | |
// the deprecated "effect file" target. | |
// | |
// SAD! | |
SamplerState smp { AddressU = Clamp; AddressV = Wrap; }; | |
Texture2D tx; | |
float4 frag (float2 uv : TEXCOORD0) : SV_Target | |
{ | |
return tx.Sample(smp, uv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment