Use sampler state
(cherry picked from commit ab2064ef690179560761d29eed53fd5b756b5dc7)
This commit is contained in:
parent
65734fac9d
commit
9480bea9c0
|
@ -226,9 +226,7 @@ float m21(const float input)
|
|||
|
||||
// Declare one sampler per each {Sampler Type, Texture Stage} combination
|
||||
// TODO : Generate sampler status?
|
||||
sampler2D _sampler2D[4];
|
||||
sampler3D _sampler3D[4];
|
||||
samplerCUBE _sampler6F[4];
|
||||
sampler samplers[4] : register(s0);
|
||||
|
||||
// Generated alphakill contents are based on X_D3DTSS_ALPHAKILL (we avoid using a constant, to allow false's to be optimized away)
|
||||
// bool alphakill[4] = {false, false, false, false}; // Generated by PixelShader.cpp::BuildShader()
|
||||
|
@ -237,7 +235,7 @@ samplerCUBE _sampler6F[4];
|
|||
// abstracting away the specifics of accessing above sampler declarations (usefull for future Direct3D 10+ sampler arrays)
|
||||
float4 Sample2D(int st, float3 s)
|
||||
{
|
||||
float4 result = tex2D(_sampler2D[st], s.xy); // Ignores s.z (and whatever it's set to, will be optimized away by the compiler, see [1] below)
|
||||
float4 result = tex2D(samplers[st], s.xy); // Ignores s.z (and whatever it's set to, will be optimized away by the compiler, see [1] below)
|
||||
if (alphakill[st])
|
||||
if (result.a == 0)
|
||||
discard;
|
||||
|
@ -247,7 +245,7 @@ float4 Sample2D(int st, float3 s)
|
|||
|
||||
float4 Sample3D(int st, float3 s)
|
||||
{
|
||||
float4 result = tex3D(_sampler3D[st], s.xyz);
|
||||
float4 result = tex3D(samplers[st], s.xyz);
|
||||
if (alphakill[st])
|
||||
if (result.a == 0)
|
||||
discard;
|
||||
|
@ -257,7 +255,7 @@ float4 Sample3D(int st, float3 s)
|
|||
|
||||
float4 Sample6F(int st, float3 s)
|
||||
{
|
||||
float4 result = texCUBE(_sampler6F[st], s.xyz);
|
||||
float4 result = texCUBE(samplers[st], s.xyz);
|
||||
if (alphakill[st])
|
||||
if (result.a == 0)
|
||||
discard;
|
||||
|
|
Loading…
Reference in New Issue