Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
degasus committed Jan 13, 2014
1 parent 9aff16e commit e00c3ce
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Source/Core/VideoCommon/TextureConversionShader.cpp
Expand Up @@ -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");
Expand All @@ -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);
}
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit e00c3ce

Please sign in to comment.