summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureConversionShader.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2014-02-25 16:06:55 +0100
committerdegasus <wickmarkus@web.de>2014-02-26 11:37:29 +0100
commit11efa88157f02e1e79edf947041cb0c6f2ca6c30 (patch)
tree95ee5a12a33e85ece5213f31f390e807f07401f1 /Source/Core/VideoCommon/TextureConversionShader.cpp
parent8a4aa8c1f5ff0db2b531405bb087c1f53d2da4be (diff)
calculate constant values on shader compilation
Diffstat (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureConversionShader.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp
index c85c028b93..ce7f907bed 100644
--- a/Source/Core/VideoCommon/TextureConversionShader.cpp
+++ b/Source/Core/VideoCommon/TextureConversionShader.cpp
@@ -90,18 +90,18 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
" float2 uv0 = float2(0.0, 0.0);\n"
);
- WRITE(p, " int y_block_position = uv1.y & ~(%d - 1);\n", blkH);
- WRITE(p, " int y_offset_in_block = uv1.y & (%d - 1);\n", blkH);
+ WRITE(p, " int y_block_position = uv1.y & %d;\n", ~(blkH - 1));
+ WRITE(p, " int y_offset_in_block = uv1.y & %d;\n", blkH - 1);
WRITE(p, " int x_virtual_position = (uv1.x << %d) + y_offset_in_block * position.z;\n", Log2(samples));
- WRITE(p, " int x_block_position = (x_virtual_position >> %d) & ~(%d - 1);\n", Log2(blkH), blkW);
+ WRITE(p, " int x_block_position = (x_virtual_position >> %d) & %d;\n", Log2(blkH), ~(blkW - 1));
if (samples == 1)
{
// 32 bit textures (RGBA8 and Z24) are store in 2 cache line increments
WRITE(p, " bool first = 0 == (x_virtual_position & %d);\n", 8 * samples); // first cache line, used in the encoders
WRITE(p, " x_virtual_position = x_virtual_position << 1;\n");
}
- WRITE(p, " int x_offset_in_block = x_virtual_position & (%d - 1);\n", blkW);
- WRITE(p, " int y_offset = (x_virtual_position >> %d) & (%d - 1);\n", Log2(blkW), blkH);
+ WRITE(p, " int x_offset_in_block = x_virtual_position & %d;\n", blkW - 1);
+ WRITE(p, " int y_offset = (x_virtual_position >> %d) & %d;\n", Log2(blkW), blkH - 1);
WRITE(p, " sampleUv.x = x_offset_in_block + x_block_position;\n");
WRITE(p, " sampleUv.y = y_block_position + y_offset;\n");