aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2018-02-18 12:25:07 +0100
committerRainer Hochecker <fernetmenta@online.de>2018-02-18 12:25:07 +0100
commit5c1f8b3b7ac45f5b4913880e6a9c7754f2213851 (patch)
tree2264e5d88e0446ef4dc6f3388363adb0909e3d8d /system
parent8f6277794463afcb03a4b3b7713a6b71dcbef18a (diff)
OpenGL: fix NaN in shaders
Diffstat (limited to 'system')
-rw-r--r--system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl2
-rw-r--r--system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl6
-rw-r--r--system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl2
3 files changed, 3 insertions, 7 deletions
diff --git a/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl b/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl
index e4ea964a72..08d4f5e241 100644
--- a/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl
+++ b/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl
@@ -123,7 +123,7 @@ vec4 process()
#if defined(XBMC_COL_CONVERSION)
rgb.rgb = pow(rgb.rgb, vec3(m_gammaSrc));
- rgb.rgb = m_primMat * rgb.rgb;
+ rgb.rgb = max(vec3(0), m_primMat * rgb.rgb);
rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv));
#endif
diff --git a/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl b/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl
index b4fb012910..48ce685e69 100644
--- a/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl
+++ b/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl
@@ -89,16 +89,12 @@ vec4 process()
#endif
-#if defined(XBMC_TONE_MAPPING)
- //float scale = tonemap(yuv.x) / yuv.x;
-#endif
-
rgb = m_yuvmat * yuv;
rgb.a = m_alpha;
#if defined(XBMC_COL_CONVERSION)
rgb.rgb = pow(rgb.rgb, vec3(m_gammaSrc));
- rgb.rgb = m_primMat * rgb.rgb;
+ rgb.rgb = max(vec3(0), m_primMat * rgb.rgb);
rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv));
#if defined(XBMC_TONE_MAPPING)
diff --git a/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl b/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl
index bbcfe19a96..4e473dfc18 100644
--- a/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl
+++ b/system/shaders/GL/4.0/gl_yuv2rgb_filter4.glsl
@@ -112,7 +112,7 @@ vec4 process()
#if defined(XBMC_COL_CONVERSION)
rgb.rgb = pow(rgb.rgb, vec3(m_gammaSrc));
- rgb.rgb = m_primMat * rgb.rgb;
+ rgb.rgb = max(vec3(0), m_primMat * rgb.rgb);
rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv));
#if defined(XBMC_TONE_MAPPING)