From e00c3ce363b200b31a38a7d2596204539d155139 Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 13 Jan 2014 12:10:17 +0100 Subject: [PATCH] TextureConverter: remove implicit int->float convertion They was used to check if we're writing to the first or second part of one pixel. So this is now done with a boolean and a ternary operator. --- Source/Core/VideoCommon/TextureConversionShader.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index 45ad73f160..209b7e4ab7 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -374,8 +374,7 @@ void WriteRGBA8Encoder(char* p,API_TYPE ApiType) { WriteSwizzler(p, GX_TF_RGBA8, ApiType); - WRITE(p, " float cl1 = xb - (halfxb * 2.0);\n"); - WRITE(p, " float cl0 = 1.0 - cl1;\n"); + WRITE(p, " bool first = xb == (halfxb * 2);\n"); WRITE(p, " float4 texSample;\n"); WRITE(p, " float4 color0;\n"); @@ -393,7 +392,7 @@ void WriteRGBA8Encoder(char* p,API_TYPE ApiType) WRITE(p, " color1.r = texSample.g;\n"); WRITE(p, " color1.a = texSample.b;\n"); - WRITE(p, " ocol0 = (cl0 * color0) + (cl1 * color1);\n"); + WRITE(p, " ocol0 = first ? color0 : color1;\n"); WriteEncoderEnd(p, ApiType); } @@ -565,7 +564,7 @@ void WriteZ24Encoder(char* p, API_TYPE ApiType) { WriteSwizzler(p, GX_TF_Z24X8, ApiType); - WRITE(p, " float cl = xb - (halfxb * 2.0);\n"); + WRITE(p, " bool first = xb == (halfxb * 2);\n"); WRITE(p, " float depth0;\n"); WRITE(p, " float depth1;\n"); @@ -586,7 +585,7 @@ void WriteZ24Encoder(char* p, API_TYPE ApiType) WRITE(p, " expanded%i.b = depth%i;\n", i, i); } - WRITE(p, " if(cl > 0.5) {\n"); + WRITE(p, " if(!first) {\n"); // upper 16 WRITE(p, " ocol0.b = expanded0.g / 255.0;\n"); WRITE(p, " ocol0.g = expanded0.b / 255.0;\n");