summaryrefslogtreecommitdiff
path: root/src/render/shaders
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2026-01-07 19:53:42 +0100
committerGitHub <noreply@github.com>2026-01-07 19:53:42 +0100
commit918e2bb9be0e1d233f9394f1d569137788c43c01 (patch)
treea1623c8cd20c7ad625f65adb05cfe82a9e06ee8c /src/render/shaders
parenta383ca1866b04d175bc2cf208859147d22a6968e (diff)
renderer/gl: add internal gl formats and reduce internal driver format conversions (#12879)
* format: add internal formats for drm formats cross referenced with weston and added internal formats and types for a lot of missing ones. also added a isFormatYUV helper. * framebuffer: ensure we use right internalformat ensure we use the right internal format to avoid internal driver blitting, also since we only attach the GL_STENCIL_ATTACHMENT we might just aswell only use the GL_STENCIL_INDEX8 to not confuse drivers that we want a depth aswell. * texture: use external on yuv or non linear mods using external makes us use the gpu's internal detiler. and this is makes intel a lot happier then having to format convert it to a linear format internally. * shaders: add external support to CM frag add external support to CM frag, and correct ext.frag typo. * formats: remove duplicates and fix a typo in cm.frag remove duplicate formats and a typo in cm.frag * formats: add swizzle logic to all formats add swizzle logic from weston for all formats and use it in shm texture paths. * format: more format changes use monitor drm format instead of forcing something different. * shader: remove external from cm.frag drivers want this resolved at compiletime cant use both samplerExternalOES and sampler2d and then runtime branch it. * screencopy: swizzle textures in screencopy swizzle textures in screencopy, to get the right colors when copying. * screencopy: restore old behaviour try restore old behaviour before the gles3 format changes. glReadPixels had the wrong format, so i went to far trying to mitigate it. should be like before now.
Diffstat (limited to 'src/render/shaders')
-rw-r--r--src/render/shaders/glsl/CM.frag6
-rw-r--r--src/render/shaders/glsl/ext.frag4
2 files changed, 4 insertions, 6 deletions
diff --git a/src/render/shaders/glsl/CM.frag b/src/render/shaders/glsl/CM.frag
index 031fe7f3..7f075b82 100644
--- a/src/render/shaders/glsl/CM.frag
+++ b/src/render/shaders/glsl/CM.frag
@@ -1,11 +1,9 @@
#version 300 es
-//#extension GL_OES_EGL_image_external : require
#extension GL_ARB_shading_language_include : enable
precision highp float;
in vec2 v_texcoord;
uniform sampler2D tex;
-//uniform samplerExternalOES texture0;
uniform int texType; // eTextureType: 0 - rgba, 1 - rgbx, 2 - ext
// uniform int skipCM;
@@ -30,8 +28,8 @@ void main() {
vec4 pixColor;
if (texType == 1)
pixColor = vec4(texture(tex, v_texcoord).rgb, 1.0);
-// else if (texType == 2)
-// pixColor = texture(texture0, v_texcoord);
+ //else if (texType == 2)
+ // discard; // this shouldnt happen.
else // assume rgba
pixColor = texture(tex, v_texcoord);
diff --git a/src/render/shaders/glsl/ext.frag b/src/render/shaders/glsl/ext.frag
index f540a9f9..e855a832 100644
--- a/src/render/shaders/glsl/ext.frag
+++ b/src/render/shaders/glsl/ext.frag
@@ -5,7 +5,7 @@
precision highp float;
in vec2 v_texcoord;
-uniform samplerExternalOES texture0;
+uniform samplerExternalOES tex;
uniform float alpha;
#include "rounding.glsl"
@@ -20,7 +20,7 @@ uniform vec3 tint;
layout(location = 0) out vec4 fragColor;
void main() {
- vec4 pixColor = texture(texture0, v_texcoord);
+ vec4 pixColor = texture(tex, v_texcoord);
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0)
discard;