From 92189823f3d07045431191267c807cf898a066b5 Mon Sep 17 00:00:00 2001 From: magumagu Date: Sun, 25 Jan 2015 22:53:30 -0800 Subject: [PATCH] Fix RGBA8 encoding. --- Source/Core/VideoCommon/TextureConversionShader.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index ebb3b065fd..1c56621dc2 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -90,14 +90,15 @@ static void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) WRITE(p, " int x_block_position = (uv1.x >> %d) << %d;\n", IntLog2(blkH * blkW / samples), IntLog2(blkW)); WRITE(p, " int y_block_position = uv1.y << %d;\n", IntLog2(blkH)); + if (samples == 1) + { + // With samples == 1, we write out pairs of blocks; one A8R8, one G8B8. + WRITE(p, " bool first = !(uv1.x & %d);\n", blkH * blkW / 2); + samples = 2; + } WRITE(p, " int offset_in_block = uv1.x & %d;\n", (blkH * blkW / samples) - 1); WRITE(p, " int y_offset_in_block = offset_in_block >> %d;\n", IntLog2(blkW / samples)); WRITE(p, " int x_offset_in_block = (offset_in_block & %d) << %d;\n", (blkW / samples) - 1, IntLog2(samples)); - if (samples == 1) - { - WRITE(p, " bool first = 0 == (x_block_position & %d);\n", blkW); - WRITE(p, " x_block_position >>= 1;\n", blkW); - } WRITE(p, " sampleUv.x = x_block_position + x_offset_in_block;\n"); WRITE(p, " sampleUv.y = y_block_position + y_offset_in_block;\n");