From 12443da00cdd6ab54744cfe58723bd0c30e07f84 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 10 Apr 2016 11:27:56 +0200 Subject: [PATCH] GSdx ogl: ouch the typo exp != exp2 Fix some rounding issue on depth effect (shadow in Dot hack games) --- plugins/GSdx/res/glsl/convert.glsl | 4 ++-- plugins/GSdx/res/glsl_source.h | 4 ++-- plugins/GSdx_legacy/res/glsl/convert.glsl | 4 ++-- plugins/GSdx_legacy/res/glsl_source.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/GSdx/res/glsl/convert.glsl b/plugins/GSdx/res/glsl/convert.glsl index 18bd32aeeb..afa59e8816 100644 --- a/plugins/GSdx/res/glsl/convert.glsl +++ b/plugins/GSdx/res/glsl/convert.glsl @@ -178,7 +178,7 @@ void ps_main13() { // Convert a RRGBA texture into a float depth texture // FIXME: I'm afraid of the accuracy - const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp(-8.0f)) * vec4(255.0); + const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp2(-8.0f)) * vec4(255.0); gl_FragDepth = dot(sample_c(), bitSh); } #endif @@ -212,7 +212,7 @@ void ps_main16() { // Convert a RGB5A1 (saved as RGBA8) color to a 16 bit Z // FIXME: I'm afraid of the accuracy - const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp(-17.0f)); + const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp2(-17.0f)); // Trunc color to drop useless lsb vec4 color = trunc(sample_c() * vec4(255.0f) / vec4(8.0f, 8.0f, 8.0f, 128.0f)); gl_FragDepth = dot(vec4(color), bitSh); diff --git a/plugins/GSdx/res/glsl_source.h b/plugins/GSdx/res/glsl_source.h index c2dc7af8d6..18781b2b77 100644 --- a/plugins/GSdx/res/glsl_source.h +++ b/plugins/GSdx/res/glsl_source.h @@ -203,7 +203,7 @@ static const char* convert_glsl = "{\n" " // Convert a RRGBA texture into a float depth texture\n" " // FIXME: I'm afraid of the accuracy\n" - " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp(-8.0f)) * vec4(255.0);\n" + " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp2(-8.0f)) * vec4(255.0);\n" " gl_FragDepth = dot(sample_c(), bitSh);\n" "}\n" "#endif\n" @@ -237,7 +237,7 @@ static const char* convert_glsl = "{\n" " // Convert a RGB5A1 (saved as RGBA8) color to a 16 bit Z\n" " // FIXME: I'm afraid of the accuracy\n" - " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp(-17.0f));\n" + " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp2(-17.0f));\n" " // Trunc color to drop useless lsb\n" " vec4 color = trunc(sample_c() * vec4(255.0f) / vec4(8.0f, 8.0f, 8.0f, 128.0f));\n" " gl_FragDepth = dot(vec4(color), bitSh);\n" diff --git a/plugins/GSdx_legacy/res/glsl/convert.glsl b/plugins/GSdx_legacy/res/glsl/convert.glsl index 18bd32aeeb..afa59e8816 100644 --- a/plugins/GSdx_legacy/res/glsl/convert.glsl +++ b/plugins/GSdx_legacy/res/glsl/convert.glsl @@ -178,7 +178,7 @@ void ps_main13() { // Convert a RRGBA texture into a float depth texture // FIXME: I'm afraid of the accuracy - const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp(-8.0f)) * vec4(255.0); + const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp2(-8.0f)) * vec4(255.0); gl_FragDepth = dot(sample_c(), bitSh); } #endif @@ -212,7 +212,7 @@ void ps_main16() { // Convert a RGB5A1 (saved as RGBA8) color to a 16 bit Z // FIXME: I'm afraid of the accuracy - const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp(-17.0f)); + const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp2(-17.0f)); // Trunc color to drop useless lsb vec4 color = trunc(sample_c() * vec4(255.0f) / vec4(8.0f, 8.0f, 8.0f, 128.0f)); gl_FragDepth = dot(vec4(color), bitSh); diff --git a/plugins/GSdx_legacy/res/glsl_source.h b/plugins/GSdx_legacy/res/glsl_source.h index 2c86638ffb..f2fc92f1be 100644 --- a/plugins/GSdx_legacy/res/glsl_source.h +++ b/plugins/GSdx_legacy/res/glsl_source.h @@ -203,7 +203,7 @@ static const char* convert_glsl = "{\n" " // Convert a RRGBA texture into a float depth texture\n" " // FIXME: I'm afraid of the accuracy\n" - " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp(-8.0f)) * vec4(255.0);\n" + " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-24.0f), exp2(-16.0f), exp2(-8.0f)) * vec4(255.0);\n" " gl_FragDepth = dot(sample_c(), bitSh);\n" "}\n" "#endif\n" @@ -237,7 +237,7 @@ static const char* convert_glsl = "{\n" " // Convert a RGB5A1 (saved as RGBA8) color to a 16 bit Z\n" " // FIXME: I'm afraid of the accuracy\n" - " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp(-17.0f));\n" + " const vec4 bitSh = vec4(exp2(-32.0f), exp2(-27.0f), exp2(-22.0f), exp2(-17.0f));\n" " // Trunc color to drop useless lsb\n" " vec4 color = trunc(sample_c() * vec4(255.0f) / vec4(8.0f, 8.0f, 8.0f, 128.0f));\n" " gl_FragDepth = dot(vec4(color), bitSh);\n"