From 9480bea9c034467814e807dd30d54086930134a1 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sun, 31 Jan 2021 18:34:51 +1300 Subject: [PATCH] Use sampler state (cherry picked from commit ab2064ef690179560761d29eed53fd5b756b5dc7) --- .../hle/D3D8/Direct3D9/CxbxPixelShaderTemplate.hlsl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/core/hle/D3D8/Direct3D9/CxbxPixelShaderTemplate.hlsl b/src/core/hle/D3D8/Direct3D9/CxbxPixelShaderTemplate.hlsl index b6a93fd3b..96346cb8e 100644 --- a/src/core/hle/D3D8/Direct3D9/CxbxPixelShaderTemplate.hlsl +++ b/src/core/hle/D3D8/Direct3D9/CxbxPixelShaderTemplate.hlsl @@ -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;