summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/TextureConversionShader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoCommon/Src/TextureConversionShader.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/TextureConversionShader.cpp146
1 files changed, 73 insertions, 73 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp
index bf2f2737ea..fec8b8afde 100644
--- a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp
+++ b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp
@@ -142,7 +142,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
if (ApiType != API_OPENGL)
{
- WRITE(p, " sampleUv = sampleUv + float2(0.0f,1.0f);\n");// still to determine the reason for this
+ WRITE(p, " sampleUv = sampleUv + float2(0.0,1.0);\n");// still to determine the reason for this
WRITE(p, " sampleUv = sampleUv / " I_COLORS"[0].zw;\n");
}
}
@@ -204,14 +204,14 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
WRITE(p, " float yb = yl * %f;\n", blkH);
WRITE(p, " float yoff = uv1.y - yb;\n");
WRITE(p, " float xp = uv1.x + (yoff * " I_COLORS"[1].x);\n");
- WRITE(p, " float xel = floor(xp / 2.0f);\n");
+ WRITE(p, " float xel = floor(xp / 2.0);\n");
WRITE(p, " float xb = floor(xel / %f);\n", blkH);
WRITE(p, " float xoff = xel - (xb * %f);\n", blkH);
- WRITE(p, " float x2 = uv1.x * 2.0f;\n");
+ WRITE(p, " float x2 = uv1.x * 2.0;\n");
WRITE(p, " float xl = floor(x2 / %f);\n", blkW);
WRITE(p, " float xib = x2 - (xl * %f);\n", blkW);
- WRITE(p, " float halfxb = floor(xb / 2.0f);\n");
+ WRITE(p, " float halfxb = floor(xb / 2.0);\n");
WRITE(p, " sampleUv.x = xib + (halfxb * %f);\n", blkW);
WRITE(p, " sampleUv.y = yb + xoff;\n");
@@ -224,7 +224,7 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
if (ApiType != API_OPENGL)
{
- WRITE(p, " sampleUv = sampleUv + float2(0.0f,1.0f);\n");// still to determine the reason for this
+ WRITE(p, " sampleUv = sampleUv + float2(0.0,1.0);\n");// still to determine the reason for this
WRITE(p, " sampleUv = sampleUv / " I_COLORS"[0].zw;\n");
}
}
@@ -246,7 +246,7 @@ void WriteSampleColor(char*& p, const char* colorComp, const char* dest, API_TYP
else
texSampleIncrementUnit = I_COLORS"[0].x";
- WRITE(p, " %s = %s(samp0, sampleUv + float2(%d.0f * (%s), 0.0f)).%s;\n",
+ WRITE(p, " %s = %s(samp0, sampleUv + float2(%d.0 * (%s), 0.0)).%s;\n",
dest, texSampleOpName, s_incrementSampleXCount, texSampleIncrementUnit, colorComp);
}
@@ -282,7 +282,7 @@ void WriteIncrementSampleX(char*& p,API_TYPE ApiType)
void WriteToBitDepth(char*& p, u8 depth, const char* src, const char* dest)
{
- float result = 255 / pow(2.0f, (8 - depth));
+ float result = 255 / pow(2.0, (8 - depth));
WRITE(p, " %s = floor(%s * %ff);\n", dest, src, result);
}
@@ -362,7 +362,7 @@ void WriteI4Encoder(char* p, API_TYPE ApiType)
WriteToBitDepth(p, 4, "color0", "color0");
WriteToBitDepth(p, 4, "color1", "color1");
- WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n");
+ WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -416,7 +416,7 @@ void WriteIA4Encoder(char* p,API_TYPE ApiType)
WriteToBitDepth(p, 4, "color0", "color0");
WriteToBitDepth(p, 4, "color1", "color1");
- WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n");
+ WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -432,15 +432,15 @@ void WriteRGB565Encoder(char* p,API_TYPE ApiType)
WRITE(p, " float2 texBs = float2(texSample0.b, texSample1.b);\n");
WriteToBitDepth(p, 6, "texGs", "float2 gInt");
- WRITE(p, " float2 gUpper = floor(gInt / 8.0f);\n");
- WRITE(p, " float2 gLower = gInt - gUpper * 8.0f;\n");
+ WRITE(p, " float2 gUpper = floor(gInt / 8.0);\n");
+ WRITE(p, " float2 gLower = gInt - gUpper * 8.0;\n");
WriteToBitDepth(p, 5, "texRs", "ocol0.br");
- WRITE(p, " ocol0.br = ocol0.br * 8.0f + gUpper;\n");
+ WRITE(p, " ocol0.br = ocol0.br * 8.0 + gUpper;\n");
WriteToBitDepth(p, 5, "texBs", "ocol0.ga");
- WRITE(p, " ocol0.ga = ocol0.ga + gLower * 32.0f;\n");
+ WRITE(p, " ocol0.ga = ocol0.ga + gLower * 32.0;\n");
- WRITE(p, " ocol0 = ocol0 / 255.0f;\n");
+ WRITE(p, " ocol0 = ocol0 / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -459,13 +459,13 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
WRITE(p, "if(texSample.a > 0.878f) {\n");
WriteToBitDepth(p, 5, "texSample.g", "color0");
- WRITE(p, " gUpper = floor(color0 / 8.0f);\n");
- WRITE(p, " gLower = color0 - gUpper * 8.0f;\n");
+ WRITE(p, " gUpper = floor(color0 / 8.0);\n");
+ WRITE(p, " gLower = color0 - gUpper * 8.0;\n");
WriteToBitDepth(p, 5, "texSample.r", "ocol0.b");
- WRITE(p, " ocol0.b = ocol0.b * 4.0f + gUpper + 128.0f;\n");
+ WRITE(p, " ocol0.b = ocol0.b * 4.0 + gUpper + 128.0;\n");
WriteToBitDepth(p, 5, "texSample.b", "ocol0.g");
- WRITE(p, " ocol0.g = ocol0.g + gLower * 32.0f;\n");
+ WRITE(p, " ocol0.g = ocol0.g + gLower * 32.0;\n");
WRITE(p, "} else {\n");
@@ -473,9 +473,9 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
WriteToBitDepth(p, 4, "texSample.b", "ocol0.g");
WriteToBitDepth(p, 3, "texSample.a", "color0");
- WRITE(p, "ocol0.b = ocol0.b + color0 * 16.0f;\n");
+ WRITE(p, "ocol0.b = ocol0.b + color0 * 16.0;\n");
WriteToBitDepth(p, 4, "texSample.g", "color0");
- WRITE(p, "ocol0.g = ocol0.g + color0 * 16.0f;\n");
+ WRITE(p, "ocol0.g = ocol0.g + color0 * 16.0;\n");
WRITE(p, "}\n");
@@ -487,13 +487,13 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
WRITE(p, "if(texSample.a > 0.878f) {\n");
WriteToBitDepth(p, 5, "texSample.g", "color0");
- WRITE(p, " gUpper = floor(color0 / 8.0f);\n");
- WRITE(p, " gLower = color0 - gUpper * 8.0f;\n");
+ WRITE(p, " gUpper = floor(color0 / 8.0);\n");
+ WRITE(p, " gLower = color0 - gUpper * 8.0;\n");
WriteToBitDepth(p, 5, "texSample.r", "ocol0.r");
- WRITE(p, " ocol0.r = ocol0.r * 4.0f + gUpper + 128.0f;\n");
+ WRITE(p, " ocol0.r = ocol0.r * 4.0 + gUpper + 128.0;\n");
WriteToBitDepth(p, 5, "texSample.b", "ocol0.a");
- WRITE(p, " ocol0.a = ocol0.a + gLower * 32.0f;\n");
+ WRITE(p, " ocol0.a = ocol0.a + gLower * 32.0;\n");
WRITE(p, "} else {\n");
@@ -501,13 +501,13 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
WriteToBitDepth(p, 4, "texSample.b", "ocol0.a");
WriteToBitDepth(p, 3, "texSample.a", "color0");
- WRITE(p, "ocol0.r = ocol0.r + color0 * 16.0f;\n");
+ WRITE(p, "ocol0.r = ocol0.r + color0 * 16.0;\n");
WriteToBitDepth(p, 4, "texSample.g", "color0");
- WRITE(p, "ocol0.a = ocol0.a + color0 * 16.0f;\n");
+ WRITE(p, "ocol0.a = ocol0.a + color0 * 16.0;\n");
WRITE(p, "}\n");
- WRITE(p, " ocol0 = ocol0 / 255.0f;\n");
+ WRITE(p, " ocol0 = ocol0 / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -533,7 +533,7 @@ void WriteRGBA4443Encoder(char* p,API_TYPE ApiType)
WriteToBitDepth(p, 4, "texSample.g", "color0.a");
WriteToBitDepth(p, 4, "texSample.b", "color1.a");
- WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n");
+ WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -541,8 +541,8 @@ void WriteRGBA8Encoder(char* p,API_TYPE ApiType)
{
Write32BitSwizzler(p, GX_TF_RGBA8, ApiType);
- WRITE(p, " float cl1 = xb - (halfxb * 2.0f);\n");
- WRITE(p, " float cl0 = 1.0f - cl1;\n");
+ WRITE(p, " float cl1 = xb - (halfxb * 2.0);\n");
+ WRITE(p, " float cl0 = 1.0 - cl1;\n");
WRITE(p, " float4 texSample;\n");
WRITE(p, " float4 color0;\n");
@@ -599,7 +599,7 @@ void WriteC4Encoder(char* p, const char* comp,API_TYPE ApiType)
WriteToBitDepth(p, 4, "color0", "color0");
WriteToBitDepth(p, 4, "color1", "color1");
- WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n");
+ WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -650,7 +650,7 @@ void WriteCC4Encoder(char* p, const char* comp,API_TYPE ApiType)
WriteToBitDepth(p, 4, "color0", "color0");
WriteToBitDepth(p, 4, "color1", "color1");
- WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n");
+ WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -701,25 +701,25 @@ void WriteZ16Encoder(char* p,API_TYPE ApiType)
WriteSampleColor(p, "b", "depth", ApiType);
- WRITE(p, " depth *= 16777215.0f;\n");
- WRITE(p, " expanded.r = floor(depth / (256.0f * 256.0f));\n");
- WRITE(p, " depth -= expanded.r * 256.0f * 256.0f;\n");
- WRITE(p, " expanded.g = floor(depth / 256.0f);\n");
+ WRITE(p, " depth *= 16777215.0;\n");
+ WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
+ WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
+ WRITE(p, " expanded.g = floor(depth / 256.0);\n");
- WRITE(p, " ocol0.b = expanded.g / 255.0f;\n");
- WRITE(p, " ocol0.g = expanded.r / 255.0f;\n");
+ WRITE(p, " ocol0.b = expanded.g / 255.0;\n");
+ WRITE(p, " ocol0.g = expanded.r / 255.0;\n");
WriteIncrementSampleX(p, ApiType);
WriteSampleColor(p, "b", "depth", ApiType);
- WRITE(p, " depth *= 16777215.0f;\n");
- WRITE(p, " expanded.r = floor(depth / (256.0f * 256.0f));\n");
- WRITE(p, " depth -= expanded.r * 256.0f * 256.0f;\n");
- WRITE(p, " expanded.g = floor(depth / 256.0f);\n");
+ WRITE(p, " depth *= 16777215.0;\n");
+ WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
+ WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
+ WRITE(p, " expanded.g = floor(depth / 256.0);\n");
- WRITE(p, " ocol0.r = expanded.g / 255.0f;\n");
- WRITE(p, " ocol0.a = expanded.r / 255.0f;\n");
+ WRITE(p, " ocol0.r = expanded.g / 255.0;\n");
+ WRITE(p, " ocol0.a = expanded.r / 255.0;\n");
WriteEncoderEnd(p, ApiType);
}
@@ -735,25 +735,25 @@ void WriteZ16LEncoder(char* p,API_TYPE ApiType)
WriteSampleColor(p, "b", "depth", ApiType);
- WRITE(p, " depth *= 16777215.0f;\n");
- WRITE(p, " expanded.r = floor(depth / (256.0f * 256.0f));\n");
- WRITE(p, " depth -= expanded.r * 256.0f * 256.0f;\n");
- WRITE(p, " expanded.g = floor(depth / 256.0f);\n");
- WRITE(p, " depth -= expanded.g * 256.0f;\n");
+ WRITE(p, " depth *= 16777215.0;\n");
+ WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
+ WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
+ WRITE(p, " expanded.g = floor(depth / 256.0);\n");
+ WRITE(p, " depth -= expanded.g * 256.0;\n");
WRITE(p, " expanded.b = depth;\n");
- WRITE(p, " ocol0.b = expanded.b / 255.0f;\n");
- WRITE(p, " ocol0.g = expanded.g / 255.0f;\n");
+ WRITE(p, " ocol0.b = expanded.b / 255.0;\n");
+ WRITE(p, " ocol0.g = expanded.g / 255.0;\n");
WriteIncrementSampleX(p, ApiType);
WriteSampleColor(p, "b", "depth", ApiType);
- WRITE(p, " depth *= 16777215.0f;\n");
- WRITE(p, " expanded.r = floor(depth / (256.0f * 256.0f));\n");
- WRITE(p, " depth -= expanded.r * 256.0f * 256.0f;\n");
- WRITE(p, " expanded.g = floor(depth / 256.0f);\n");
- WRITE(p, " depth -= expanded.g * 256.0f;\n");
+ WRITE(p, " depth *= 16777215.0;\n");
+ WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
+ WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
+ WRITE(p, " expanded.g = floor(depth / 256.0);\n");
+ WRITE(p, " depth -= expanded.g * 256.0;\n");
WRITE(p, " expanded.b = depth;\n");
WRITE(p, " ocol0.r = expanded.b;\n");
@@ -766,7 +766,7 @@ void WriteZ24Encoder(char* p, API_TYPE ApiType)
{
Write32BitSwizzler(p, GX_TF_Z24X8, ApiType);
- WRITE(p, " float cl = xb - (halfxb * 2.0f);\n");
+ WRITE(p, " float cl = xb - (halfxb * 2.0);\n");
WRITE(p, " float depth0;\n");
WRITE(p, " float depth1;\n");
@@ -779,27 +779,27 @@ void WriteZ24Encoder(char* p, API_TYPE ApiType)
for (int i = 0; i < 2; i++)
{
- WRITE(p, " depth%i *= 16777215.0f;\n", i);
+ WRITE(p, " depth%i *= 16777215.0;\n", i);
- WRITE(p, " expanded%i.r = floor(depth%i / (256.0f * 256.0f));\n", i, i);
- WRITE(p, " depth%i -= expanded%i.r * 256.0f * 256.0f;\n", i, i);
- WRITE(p, " expanded%i.g = floor(depth%i / 256.0f);\n", i, i);
- WRITE(p, " depth%i -= expanded%i.g * 256.0f;\n", i, i);
+ WRITE(p, " expanded%i.r = floor(depth%i / (256.0 * 256.0));\n", i, i);
+ WRITE(p, " depth%i -= expanded%i.r * 256.0 * 256.0;\n", i, i);
+ WRITE(p, " expanded%i.g = floor(depth%i / 256.0);\n", i, i);
+ WRITE(p, " depth%i -= expanded%i.g * 256.0;\n", i, i);
WRITE(p, " expanded%i.b = depth%i;\n", i, i);
}
- WRITE(p, " if(cl > 0.5f) {\n");
+ WRITE(p, " if(cl > 0.5) {\n");
// upper 16
- WRITE(p, " ocol0.b = expanded0.g / 255.0f;\n");
- WRITE(p, " ocol0.g = expanded0.b / 255.0f;\n");
- WRITE(p, " ocol0.r = expanded1.g / 255.0f;\n");
- WRITE(p, " ocol0.a = expanded1.b / 255.0f;\n");
+ WRITE(p, " ocol0.b = expanded0.g / 255.0;\n");
+ WRITE(p, " ocol0.g = expanded0.b / 255.0;\n");
+ WRITE(p, " ocol0.r = expanded1.g / 255.0;\n");
+ WRITE(p, " ocol0.a = expanded1.b / 255.0;\n");
WRITE(p, " } else {\n");
// lower 8
- WRITE(p, " ocol0.b = 1.0f;\n");
- WRITE(p, " ocol0.g = expanded0.r / 255.0f;\n");
- WRITE(p, " ocol0.r = 1.0f;\n");
- WRITE(p, " ocol0.a = expanded1.r / 255.0f;\n");
+ WRITE(p, " ocol0.b = 1.0;\n");
+ WRITE(p, " ocol0.g = expanded0.r / 255.0;\n");
+ WRITE(p, " ocol0.r = 1.0;\n");
+ WRITE(p, " ocol0.a = expanded1.r / 255.0;\n");
WRITE(p, " }\n");
WriteEncoderEnd(p, ApiType);
@@ -878,10 +878,10 @@ const char *GenerateEncodingShader(u32 format,API_TYPE ApiType)
WriteC4Encoder(p, "b", ApiType);
break;
case GX_CTF_Z8M:
- WriteZ8Encoder(p, "256.0f", ApiType);
+ WriteZ8Encoder(p, "256.0", ApiType);
break;
case GX_CTF_Z8L:
- WriteZ8Encoder(p, "65536.0f" , ApiType);
+ WriteZ8Encoder(p, "65536.0" , ApiType);
break;
case GX_CTF_Z16L:
WriteZ16LEncoder(p, ApiType);