From b01ca1794a81435c215519ef42b5ffd056a54170 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sat, 15 Aug 2015 13:46:34 +0200 Subject: Revert "VideoCommon: Clamp integer conversions." This reverts commit 0f2c72f0f844c219e168faa7de8dd515f8723fdc. --- Source/Core/VideoCommon/TextureConversionShader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp') diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index f93d465a16..2d8b7ef9c9 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -492,7 +492,7 @@ static void WriteZ16Encoder(char*& p,API_TYPE ApiType) WriteSampleColor(p, "r", "depth", 0, ApiType); if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); - WRITE(p, " depth = clamp(depth * 16777216.0, 0.0, float(0xFFFFFF));\n"); + WRITE(p, " depth *= 16777216.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"); @@ -503,7 +503,7 @@ static void WriteZ16Encoder(char*& p,API_TYPE ApiType) WriteSampleColor(p, "r", "depth", 1, ApiType); if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); - WRITE(p, " depth = clamp(depth * 16777216.0, 0.0, float(0xFFFFFF));\n"); + WRITE(p, " depth *= 16777216.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"); @@ -526,7 +526,7 @@ static void WriteZ16LEncoder(char*& p,API_TYPE ApiType) WriteSampleColor(p, "r", "depth", 0, ApiType); if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); - WRITE(p, " depth = clamp(depth * 16777216.0, 0.0, float(0xFFFFFF));\n"); + WRITE(p, " depth *= 16777216.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"); @@ -539,7 +539,7 @@ static void WriteZ16LEncoder(char*& p,API_TYPE ApiType) WriteSampleColor(p, "r", "depth", 1, ApiType); if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); - WRITE(p, " depth = clamp(depth * 16777216.0, 0.0, float(0xFFFFFF));\n"); + WRITE(p, " depth *= 16777216.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"); @@ -568,7 +568,7 @@ static void WriteZ24Encoder(char*& p, API_TYPE ApiType) for (int i = 0; i < 2; i++) { - WRITE(p, " depth%i = clamp(depth%i * 16777216.0, 0.0, float(0xFFFFFF));\n", i, i); + WRITE(p, " depth%i *= 16777216.0;\n", 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); -- cgit v1.2.3 From 8e17c710f3268e250293fd900e1c462c3536f044 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 21:10:54 -0400 Subject: TextureConversionShader: Remove an unused parameter --- .../Core/VideoCommon/TextureConversionShader.cpp | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp') diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index f93d465a16..df6879a8f8 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -148,7 +148,7 @@ static void WriteToBitDepth(char*& p, u8 depth, const char* src, const char* des WRITE(p, " %s = floor(%s * 255.0 / exp2(8.0 - %d.0));\n", dest, src, depth); } -static void WriteEncoderEnd(char*& p, API_TYPE ApiType) +static void WriteEncoderEnd(char*& p) { WRITE(p, "}\n"); IntensityConstantAdded = false; @@ -173,7 +173,7 @@ static void WriteI8Encoder(char*& p, API_TYPE ApiType) WRITE(p, " ocol0.rgba += IntensityConst.aaaa;\n"); // see WriteColorToIntensity - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteI4Encoder(char*& p, API_TYPE ApiType) @@ -214,7 +214,7 @@ static void WriteI4Encoder(char*& p, API_TYPE ApiType) WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteIA8Encoder(char*& p,API_TYPE ApiType) @@ -232,7 +232,7 @@ static void WriteIA8Encoder(char*& p,API_TYPE ApiType) WRITE(p, " ocol0.ga += IntensityConst.aa;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteIA4Encoder(char*& p,API_TYPE ApiType) @@ -264,7 +264,7 @@ static void WriteIA4Encoder(char*& p,API_TYPE ApiType) WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteRGB565Encoder(char*& p,API_TYPE ApiType) @@ -287,7 +287,7 @@ static void WriteRGB565Encoder(char*& p,API_TYPE ApiType) WRITE(p, " ocol0.ga = ocol0.ga + gLower * 32.0;\n"); WRITE(p, " ocol0 = ocol0 / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteRGB5A3Encoder(char*& p,API_TYPE ApiType) @@ -353,7 +353,7 @@ static void WriteRGB5A3Encoder(char*& p,API_TYPE ApiType) WRITE(p, "}\n"); WRITE(p, " ocol0 = ocol0 / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteRGBA8Encoder(char*& p,API_TYPE ApiType) @@ -378,7 +378,7 @@ static void WriteRGBA8Encoder(char*& p,API_TYPE ApiType) WRITE(p, " ocol0 = first ? color0 : color1;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteC4Encoder(char*& p, const char* comp,API_TYPE ApiType) @@ -400,7 +400,7 @@ static void WriteC4Encoder(char*& p, const char* comp,API_TYPE ApiType) WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteC8Encoder(char*& p, const char* comp,API_TYPE ApiType) @@ -412,7 +412,7 @@ static void WriteC8Encoder(char*& p, const char* comp,API_TYPE ApiType) WriteSampleColor(p, comp, "ocol0.r", 2, ApiType); WriteSampleColor(p, comp, "ocol0.a", 3, ApiType); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteCC4Encoder(char*& p, const char* comp,API_TYPE ApiType) @@ -442,7 +442,7 @@ static void WriteCC4Encoder(char*& p, const char* comp,API_TYPE ApiType) WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteCC8Encoder(char*& p, const char* comp, API_TYPE ApiType) @@ -452,7 +452,7 @@ static void WriteCC8Encoder(char*& p, const char* comp, API_TYPE ApiType) WriteSampleColor(p, comp, "ocol0.bg", 0, ApiType); WriteSampleColor(p, comp, "ocol0.ra", 1, ApiType); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteZ8Encoder(char*& p, const char* multiplier,API_TYPE ApiType) @@ -477,7 +477,7 @@ static void WriteZ8Encoder(char*& p, const char* multiplier,API_TYPE ApiType) if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); WRITE(p, "ocol0.a = frac(depth * %s);\n", multiplier); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteZ16Encoder(char*& p,API_TYPE ApiType) @@ -511,7 +511,7 @@ static void WriteZ16Encoder(char*& p,API_TYPE ApiType) WRITE(p, " ocol0.r = expanded.g / 255.0;\n"); WRITE(p, " ocol0.a = expanded.r / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteZ16LEncoder(char*& p,API_TYPE ApiType) @@ -549,7 +549,7 @@ static void WriteZ16LEncoder(char*& p,API_TYPE ApiType) WRITE(p, " ocol0.r = expanded.b / 255.0;\n"); WRITE(p, " ocol0.a = expanded.g / 255.0;\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } static void WriteZ24Encoder(char*& p, API_TYPE ApiType) @@ -591,7 +591,7 @@ static void WriteZ24Encoder(char*& p, API_TYPE ApiType) WRITE(p, " ocol0.a = expanded1.r / 255.0;\n"); WRITE(p, " }\n"); - WriteEncoderEnd(p, ApiType); + WriteEncoderEnd(p); } const char *GenerateEncodingShader(u32 format,API_TYPE ApiType) -- cgit v1.2.3 From b9be3245e1bcd3929baf4d1c66fe5a14b336cdbc Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sat, 5 Sep 2015 02:45:29 +1200 Subject: Move common EFB copy code into VideoCommon Addded a few duplicated depth copy texture formats to the enum in TextureDecoder.h. These texture formats were already implemented in TextureCacheBase and the ogl/dx11 texture cache implementations. --- Source/Core/VideoCommon/TextureConversionShader.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp') diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index 9375a984c8..033a56b4aa 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -650,9 +650,11 @@ const char *GenerateEncodingShader(u32 format,API_TYPE ApiType) case GX_CTF_GB8: WriteCC8Encoder(p, "gb", ApiType); break; + case GX_CTF_Z8H: case GX_TF_Z8: WriteC8Encoder(p, "r", ApiType); break; + case GX_CTF_Z16R: case GX_TF_Z16: WriteZ16Encoder(p, ApiType); break; -- cgit v1.2.3