From 64a1969e36960ab066c2130a276d005aa272bba9 Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 25 Nov 2013 16:34:08 +0100 Subject: [PATCH] TextureConverter: fix scoping --- .../Src/TextureConversionShader.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp index bf625223dd..92c38ca77d 100644 --- a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp @@ -89,7 +89,9 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) WRITE(p, "{\n" " int2 sampleUv;\n" - " int2 uv1 = int2(gl_FragCoord.xy);\n"); + " int2 uv1 = int2(gl_FragCoord.xy);\n" + " float2 uv0 = float2(0.0, 0.0);\n" + ); WRITE(p, " uv1.x = uv1.x * %d;\n", samples); @@ -110,16 +112,14 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) void WriteSampleColor(char*& p, const char* colorComp, const char* dest, API_TYPE ApiType) { - WRITE(p, - "{\n" // sampleUv is the sample position in (int)gx_coords - "float2 uv = float2(sampleUv) + int2(%d,0);\n" // pixel offset (if more than one pixel is samped) - "uv *= " I_COLORS".w;\n" // scale by two (if wanted) - "uv += " I_COLORS".xy;\n" // move to copyed rect - "uv += float2(0.5, 0.5);\n" // move to center of pixel - "uv /= float2(%d, %d);\n" // normlize to [0:1] - "uv.y = 1.0-uv.y;\n" // ogl foo (disable this line for d3d) - "%s = texture(samp0, uv).%s;\n" - "}\n", + WRITE(p, // sampleUv is the sample position in (int)gx_coords + "uv0 = float2(sampleUv) + int2(%d,0);\n" // pixel offset (if more than one pixel is samped) + "uv0 *= " I_COLORS".w;\n" // scale by two (if wanted) + "uv0 += " I_COLORS".xy;\n" // move to copyed rect + "uv0 += float2(0.5, 0.5);\n" // move to center of pixel + "uv0 /= float2(%d, %d);\n" // normlize to [0:1] + "uv0.y = 1.0-uv0.y;\n" // ogl foo (disable this line for d3d) + "%s = texture(samp0, uv0).%s;\n", s_incrementSampleXCount, EFB_WIDTH, EFB_HEIGHT, dest, colorComp ); }