diff options
Diffstat (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureConversionShader.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index fac5a0823c..f93d465a16 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -462,15 +462,19 @@ static void WriteZ8Encoder(char*& p, const char* multiplier,API_TYPE ApiType) WRITE(p, " float depth;\n"); WriteSampleColor(p, "r", "depth", 0, ApiType); + if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); WRITE(p, "ocol0.b = frac(depth * %s);\n", multiplier); WriteSampleColor(p, "r", "depth", 1, ApiType); + if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); WRITE(p, "ocol0.g = frac(depth * %s);\n", multiplier); WriteSampleColor(p, "r", "depth", 2, ApiType); + if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); WRITE(p, "ocol0.r = frac(depth * %s);\n", multiplier); WriteSampleColor(p, "r", "depth", 3, ApiType); + if (ApiType == API_D3D) WRITE(p, "depth = 1.0f - depth;\n"); WRITE(p, "ocol0.a = frac(depth * %s);\n", multiplier); WriteEncoderEnd(p, ApiType); @@ -486,6 +490,7 @@ static void WriteZ16Encoder(char*& p,API_TYPE ApiType) // byte order is reversed 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, " expanded.r = floor(depth / (256.0 * 256.0));\n"); @@ -496,6 +501,7 @@ static void WriteZ16Encoder(char*& p,API_TYPE ApiType) WRITE(p, " ocol0.g = expanded.r / 255.0;\n"); 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, " expanded.r = floor(depth / (256.0 * 256.0));\n"); @@ -518,6 +524,7 @@ static void WriteZ16LEncoder(char*& p,API_TYPE ApiType) // byte order is reversed 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, " expanded.r = floor(depth / (256.0 * 256.0));\n"); @@ -530,6 +537,7 @@ static void WriteZ16LEncoder(char*& p,API_TYPE ApiType) WRITE(p, " ocol0.g = expanded.g / 255.0;\n"); 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, " expanded.r = floor(depth / (256.0 * 256.0));\n"); @@ -554,7 +562,9 @@ static void WriteZ24Encoder(char*& p, API_TYPE ApiType) WRITE(p, " float3 expanded1;\n"); WriteSampleColor(p, "r", "depth0", 0, ApiType); + if (ApiType == API_D3D) WRITE(p, "depth0 = 1.0f - depth0;\n"); WriteSampleColor(p, "r", "depth1", 1, ApiType); + if (ApiType == API_D3D) WRITE(p, "depth1 = 1.0f - depth1;\n"); for (int i = 0; i < 2; i++) { |
