diff options
Diffstat (limited to 'system/shaders/GL')
-rw-r--r-- | system/shaders/GL/1.2/gl_shader_vert.glsl | 2 | ||||
-rw-r--r-- | system/shaders/GL/1.2/gl_shader_vert_clip.glsl | 4 | ||||
-rw-r--r-- | system/shaders/GL/1.2/gl_shader_vert_default.glsl | 1 | ||||
-rw-r--r-- | system/shaders/GL/1.2/gl_shader_vert_simple.glsl | 2 | ||||
-rw-r--r-- | system/shaders/GL/1.2/gl_yuv2rgb_vertex.glsl | 1 | ||||
-rw-r--r-- | system/shaders/GL/1.5/gl_shader_vert.glsl | 2 | ||||
-rw-r--r-- | system/shaders/GL/1.5/gl_shader_vert_clip.glsl | 4 | ||||
-rw-r--r-- | system/shaders/GL/1.5/gl_shader_vert_default.glsl | 1 | ||||
-rw-r--r-- | system/shaders/GL/1.5/gl_shader_vert_simple.glsl | 2 | ||||
-rw-r--r-- | system/shaders/GL/1.5/gl_yuv2rgb_vertex.glsl | 1 |
10 files changed, 20 insertions, 0 deletions
diff --git a/system/shaders/GL/1.2/gl_shader_vert.glsl b/system/shaders/GL/1.2/gl_shader_vert.glsl index 7c10b5f1bf..fef2d2d94e 100644 --- a/system/shaders/GL/1.2/gl_shader_vert.glsl +++ b/system/shaders/GL/1.2/gl_shader_vert.glsl @@ -29,11 +29,13 @@ varying vec4 m_cord1; varying vec4 m_colour; uniform mat4 m_proj; uniform mat4 m_model; +uniform float m_depth; void main () { mat4 mvp = m_proj * m_model; gl_Position = mvp * m_attrpos; + gl_Position.z = m_depth * gl_Position.w; m_colour = m_attrcol; m_cord0 = m_attrcord0; m_cord1 = m_attrcord1; diff --git a/system/shaders/GL/1.2/gl_shader_vert_clip.glsl b/system/shaders/GL/1.2/gl_shader_vert_clip.glsl index 37d67946f5..959f8ad46b 100644 --- a/system/shaders/GL/1.2/gl_shader_vert_clip.glsl +++ b/system/shaders/GL/1.2/gl_shader_vert_clip.glsl @@ -18,6 +18,7 @@ varying vec4 m_colour; uniform mat4 m_matrix; uniform vec4 m_shaderClip; uniform vec4 m_cordStep; +uniform float m_depth; // this shader can be used in cases where clipping via glScissor() is not // possible (e.g. when rotating). it can't discard triangles, but it may @@ -30,6 +31,9 @@ void main () position.xy = clamp(position.xy, m_shaderClip.xy, m_shaderClip.zw); gl_Position = m_matrix * position; + // set rendering depth + gl_Position.z = m_depth * gl_Position.w; + // correct texture coordinates for clipped vertices vec2 clipDist = m_attrpos.xy - position.xy; m_cord0.xy = m_attrcord0.xy - clipDist * m_cordStep.xy; diff --git a/system/shaders/GL/1.2/gl_shader_vert_default.glsl b/system/shaders/GL/1.2/gl_shader_vert_default.glsl index 554e15c3fd..bbb06cb5fe 100644 --- a/system/shaders/GL/1.2/gl_shader_vert_default.glsl +++ b/system/shaders/GL/1.2/gl_shader_vert_default.glsl @@ -28,4 +28,5 @@ void main () { mat4 mvp = m_proj * m_model; gl_Position = mvp * m_attrpos; + gl_Position.z = -1. * gl_Position.w; } diff --git a/system/shaders/GL/1.2/gl_shader_vert_simple.glsl b/system/shaders/GL/1.2/gl_shader_vert_simple.glsl index f06893a085..91fbae0b75 100644 --- a/system/shaders/GL/1.2/gl_shader_vert_simple.glsl +++ b/system/shaders/GL/1.2/gl_shader_vert_simple.glsl @@ -16,10 +16,12 @@ varying vec4 m_cord0; varying vec4 m_cord1; varying vec4 m_colour; uniform mat4 m_matrix; +uniform float m_depth; void main () { gl_Position = m_matrix * m_attrpos; + gl_Position.z = m_depth * gl_Position.w; m_colour = m_attrcol; m_cord0 = m_attrcord0; m_cord1 = m_attrcord1; diff --git a/system/shaders/GL/1.2/gl_yuv2rgb_vertex.glsl b/system/shaders/GL/1.2/gl_yuv2rgb_vertex.glsl index cdf3c56a71..8d7e0c3530 100644 --- a/system/shaders/GL/1.2/gl_yuv2rgb_vertex.glsl +++ b/system/shaders/GL/1.2/gl_yuv2rgb_vertex.glsl @@ -32,6 +32,7 @@ void main () { mat4 mvp = m_proj * m_model; gl_Position = mvp * m_attrpos; + gl_Position.z = -1. * gl_Position.w; m_cordY = m_attrcordY; m_cordU = m_attrcordU; m_cordV = m_attrcordV; diff --git a/system/shaders/GL/1.5/gl_shader_vert.glsl b/system/shaders/GL/1.5/gl_shader_vert.glsl index a8568310c2..c66c804788 100644 --- a/system/shaders/GL/1.5/gl_shader_vert.glsl +++ b/system/shaders/GL/1.5/gl_shader_vert.glsl @@ -9,11 +9,13 @@ out vec4 m_cord1; out vec4 m_colour; uniform mat4 m_proj; uniform mat4 m_model; +uniform float m_depth; void main () { mat4 mvp = m_proj * m_model; gl_Position = mvp * m_attrpos; + gl_Position.z = m_depth * gl_Position.w; m_colour = m_attrcol; m_cord0 = m_attrcord0; m_cord1 = m_attrcord1; diff --git a/system/shaders/GL/1.5/gl_shader_vert_clip.glsl b/system/shaders/GL/1.5/gl_shader_vert_clip.glsl index 2fa1c63da1..0cb2a8f1d8 100644 --- a/system/shaders/GL/1.5/gl_shader_vert_clip.glsl +++ b/system/shaders/GL/1.5/gl_shader_vert_clip.glsl @@ -18,6 +18,7 @@ out vec4 m_colour; uniform mat4 m_matrix; uniform vec4 m_shaderClip; uniform vec4 m_cordStep; +uniform float m_depth; // this shader can be used in cases where clipping via glScissor() is not // possible (e.g. when rotating). it can't discard triangles, but it may @@ -30,6 +31,9 @@ void main () position.xy = clamp(position.xy, m_shaderClip.xy, m_shaderClip.zw); gl_Position = m_matrix * position; + // set rendering depth + gl_Position.z = m_depth * gl_Position.w; + // correct texture coordinates for clipped vertices vec2 clipDist = m_attrpos.xy - position.xy; m_cord0.xy = m_attrcord0.xy - clipDist * m_cordStep.xy; diff --git a/system/shaders/GL/1.5/gl_shader_vert_default.glsl b/system/shaders/GL/1.5/gl_shader_vert_default.glsl index e4f2d7c9ee..b68ef12925 100644 --- a/system/shaders/GL/1.5/gl_shader_vert_default.glsl +++ b/system/shaders/GL/1.5/gl_shader_vert_default.glsl @@ -8,4 +8,5 @@ void main () { mat4 mvp = m_proj * m_model; gl_Position = mvp * m_attrpos; + gl_Position.z = -1. * gl_Position.w; } diff --git a/system/shaders/GL/1.5/gl_shader_vert_simple.glsl b/system/shaders/GL/1.5/gl_shader_vert_simple.glsl index 9c1552d7a4..953cdfcf8b 100644 --- a/system/shaders/GL/1.5/gl_shader_vert_simple.glsl +++ b/system/shaders/GL/1.5/gl_shader_vert_simple.glsl @@ -16,10 +16,12 @@ out vec4 m_cord0; out vec4 m_cord1; out vec4 m_colour; uniform mat4 m_matrix; +uniform float m_depth; void main () { gl_Position = m_matrix * m_attrpos; + gl_Position.z = m_depth * gl_Position.w; m_colour = m_attrcol; m_cord0 = m_attrcord0; m_cord1 = m_attrcord1; diff --git a/system/shaders/GL/1.5/gl_yuv2rgb_vertex.glsl b/system/shaders/GL/1.5/gl_yuv2rgb_vertex.glsl index 4772bd4172..257aacfcc2 100644 --- a/system/shaders/GL/1.5/gl_yuv2rgb_vertex.glsl +++ b/system/shaders/GL/1.5/gl_yuv2rgb_vertex.glsl @@ -14,6 +14,7 @@ void main () { mat4 mvp = m_proj * m_model; gl_Position = mvp * m_attrpos; + gl_Position.z = -1. * gl_Position.w; m_cordY = m_attrcordY; m_cordU = m_attrcordU; m_cordV = m_attrcordV; |