aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorsarbes <sarbes@kodi.tv>2024-04-28 20:16:28 +0200
committerGitHub <noreply@github.com>2024-04-28 20:16:28 +0200
commitce7e6a36f1c6d197ddba6c886d71a6dd2485fe0a (patch)
tree91868f12cb45cd7c7f2d43dbb2afeb059965ab6e /system
parentbb95c1e3f63d6f9504d1d2104a81279c7a19812c (diff)
Implement front to back rendering (#22919)
Implement front to back rendering
Diffstat (limited to 'system')
-rw-r--r--system/shaders/GL/1.2/gl_shader_vert.glsl2
-rw-r--r--system/shaders/GL/1.2/gl_shader_vert_clip.glsl4
-rw-r--r--system/shaders/GL/1.2/gl_shader_vert_default.glsl1
-rw-r--r--system/shaders/GL/1.2/gl_shader_vert_simple.glsl2
-rw-r--r--system/shaders/GL/1.2/gl_yuv2rgb_vertex.glsl1
-rw-r--r--system/shaders/GL/1.5/gl_shader_vert.glsl2
-rw-r--r--system/shaders/GL/1.5/gl_shader_vert_clip.glsl4
-rw-r--r--system/shaders/GL/1.5/gl_shader_vert_default.glsl1
-rw-r--r--system/shaders/GL/1.5/gl_shader_vert_simple.glsl2
-rw-r--r--system/shaders/GL/1.5/gl_yuv2rgb_vertex.glsl1
-rw-r--r--system/shaders/GLES/2.0/gles_shader.vert2
-rw-r--r--system/shaders/GLES/2.0/gles_shader_clip.vert4
-rw-r--r--system/shaders/GLES/2.0/gles_shader_simple.vert4
-rw-r--r--system/shaders/GLES/2.0/gles_yuv2rgb.vert1
14 files changed, 31 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;
diff --git a/system/shaders/GLES/2.0/gles_shader.vert b/system/shaders/GLES/2.0/gles_shader.vert
index 890acbbb81..17b4ad7b48 100644
--- a/system/shaders/GLES/2.0/gles_shader.vert
+++ b/system/shaders/GLES/2.0/gles_shader.vert
@@ -30,11 +30,13 @@ varying lowp vec4 m_colour;
uniform mat4 m_proj;
uniform mat4 m_model;
uniform mat4 m_coord0Matrix;
+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_coord0Matrix * m_attrcord0;
m_cord1 = m_attrcord1;
diff --git a/system/shaders/GLES/2.0/gles_shader_clip.vert b/system/shaders/GLES/2.0/gles_shader_clip.vert
index 513a24456c..1b1cf3f91e 100644
--- a/system/shaders/GLES/2.0/gles_shader_clip.vert
+++ b/system/shaders/GLES/2.0/gles_shader_clip.vert
@@ -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/GLES/2.0/gles_shader_simple.vert b/system/shaders/GLES/2.0/gles_shader_simple.vert
index 6d49788b65..2f34f8bf28 100644
--- a/system/shaders/GLES/2.0/gles_shader_simple.vert
+++ b/system/shaders/GLES/2.0/gles_shader_simple.vert
@@ -16,10 +16,14 @@ 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;
+
+ // set rendering depth
+ 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/GLES/2.0/gles_yuv2rgb.vert b/system/shaders/GLES/2.0/gles_yuv2rgb.vert
index bc437afdc3..c96a6a9585 100644
--- a/system/shaders/GLES/2.0/gles_yuv2rgb.vert
+++ b/system/shaders/GLES/2.0/gles_yuv2rgb.vert
@@ -34,6 +34,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;