From 41bcf657f89d912bb048247767c211f63eb13e94 Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 23 Mar 2012 23:20:19 +1100 Subject: [PATCH] Adjusted the DX9 offset of the Sampling address to more closely match what we are seeing in games. Fixes issue 5305. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 3ef923dc3e..da78c01741 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -1106,9 +1106,9 @@ void SampleTexture(char *&p, const char *destination, const char *texcoords, con WRITE(p, "%s=Tex%d.Sample(samp%d, %s.xy * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap,texmap, texcoords, texmap, texswap); else if (ApiType & API_D3D9) { - // D3D9 uses different pixel to texel mapping, so we need to offset our sampling address by half a pixel (assuming native and virtual texture dimensions match each other, otherwise some math is involved). + // D3D9 uses different pixel to texel mapping, so we need to offset our sampling address. // Read the MSDN article "Directly Mapping Texels to Pixels (Direct3D 9)" for further info. - WRITE(p, "%s=tex2D(samp%d, (%s.xy + 0.5f*"I_VTEXSCALE"[%d].%s) * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap, texcoords, texmap/2, (texmap&1)?"zw":"xy", texmap, texswap); + WRITE(p, "%s=tex2D(samp%d, (%s.xy + 0.0005f*"I_VTEXSCALE"[%d].%s) * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap, texcoords, texmap/2, (texmap&1)?"zw":"xy", texmap, texswap); } else WRITE(p, "%s=tex2D(samp%d, %s.xy * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap, texcoords, texmap, texswap);