mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-25 17:21:54 -07:00
shader: replace texture2d with texture (#10893)
* shader: replace texture2d with texture remove unused v_color and replace deprecated texture2d with texture. * shader: use the more modern essl3 extension GL_OES_EGL_image_external_essl3 provides support for samplerExternalOES in texture function, aquamarine already use it. apply it here too.
This commit is contained in:
@@ -112,11 +112,11 @@ layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
vec2 uv = v_texcoord * 2.0;
|
||||
|
||||
vec4 sum = texture2D(tex, uv) * 4.0;
|
||||
sum += texture2D(tex, uv - halfpixel.xy * radius);
|
||||
sum += texture2D(tex, uv + halfpixel.xy * radius);
|
||||
sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius);
|
||||
sum += texture2D(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius);
|
||||
vec4 sum = texture(tex, uv) * 4.0;
|
||||
sum += texture(tex, uv - halfpixel.xy * radius);
|
||||
sum += texture(tex, uv + halfpixel.xy * radius);
|
||||
sum += texture(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius);
|
||||
sum += texture(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius);
|
||||
|
||||
vec4 color = sum / 8.0;
|
||||
|
||||
|
@@ -1,27 +1,25 @@
|
||||
#version 300 es
|
||||
precision highp float;
|
||||
uniform sampler2D tex;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float radius;
|
||||
uniform vec2 halfpixel;
|
||||
|
||||
in vec2 v_texcoord;
|
||||
|
||||
out vec4 v_color;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec2 uv = v_texcoord / 2.0;
|
||||
|
||||
vec4 sum = texture2D(tex, uv + vec2(-halfpixel.x * 2.0, 0.0) * radius);
|
||||
vec4 sum = texture(tex, uv + vec2(-halfpixel.x * 2.0, 0.0) * radius);
|
||||
|
||||
sum += texture2D(tex, uv + vec2(-halfpixel.x, halfpixel.y) * radius) * 2.0;
|
||||
sum += texture2D(tex, uv + vec2(0.0, halfpixel.y * 2.0) * radius);
|
||||
sum += texture2D(tex, uv + vec2(halfpixel.x, halfpixel.y) * radius) * 2.0;
|
||||
sum += texture2D(tex, uv + vec2(halfpixel.x * 2.0, 0.0) * radius);
|
||||
sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius) * 2.0;
|
||||
sum += texture2D(tex, uv + vec2(0.0, -halfpixel.y * 2.0) * radius);
|
||||
sum += texture2D(tex, uv + vec2(-halfpixel.x, -halfpixel.y) * radius) * 2.0;
|
||||
sum += texture(tex, uv + vec2(-halfpixel.x, halfpixel.y) * radius) * 2.0;
|
||||
sum += texture(tex, uv + vec2(0.0, halfpixel.y * 2.0) * radius);
|
||||
sum += texture(tex, uv + vec2(halfpixel.x, halfpixel.y) * radius) * 2.0;
|
||||
sum += texture(tex, uv + vec2(halfpixel.x * 2.0, 0.0) * radius);
|
||||
sum += texture(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius) * 2.0;
|
||||
sum += texture(tex, uv + vec2(0.0, -halfpixel.y * 2.0) * radius);
|
||||
sum += texture(tex, uv + vec2(-halfpixel.x, -halfpixel.y) * radius) * 2.0;
|
||||
|
||||
fragColor = sum / 12.0;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#version 300 es
|
||||
|
||||
#extension GL_ARB_shading_language_include : enable
|
||||
#extension GL_OES_EGL_image_external : require
|
||||
#extension GL_OES_EGL_image_external_essl3 : require
|
||||
|
||||
precision highp float;
|
||||
in vec2 v_texcoord;
|
||||
@@ -20,7 +20,7 @@ uniform vec3 tint;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
|
||||
vec4 pixColor = texture2D(texture0, v_texcoord);
|
||||
vec4 pixColor = texture(texture0, v_texcoord);
|
||||
|
||||
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0)
|
||||
discard;
|
||||
|
@@ -54,9 +54,9 @@ void main() {
|
||||
|
||||
vec2 pixCoord = vec2(v_texcoord.x + offset + NOISE * 3.0 / screenSize.x + blockOffset.x, v_texcoord.y - meltAmount + 0.02 * NOISE / screenSize.x + NOISE * 3.0 / screenSize.y + blockOffset.y);
|
||||
|
||||
vec4 pixColor = texture2D(tex, pixCoord);
|
||||
vec4 pixColorLeft = texture2D(tex, pixCoord + vec2(ABERR_OFFSET / screenSize.x, 0));
|
||||
vec4 pixColorRight = texture2D(tex, pixCoord + vec2(-ABERR_OFFSET / screenSize.x, 0));
|
||||
vec4 pixColor = texture(tex, pixCoord);
|
||||
vec4 pixColorLeft = texture(tex, pixCoord + vec2(ABERR_OFFSET / screenSize.x, 0));
|
||||
vec4 pixColorRight = texture(tex, pixCoord + vec2(-ABERR_OFFSET / screenSize.x, 0));
|
||||
|
||||
pixColor[0] = pixColorLeft[0];
|
||||
pixColor[2] = pixColorRight[2];
|
||||
|
@@ -6,5 +6,5 @@ uniform sampler2D tex;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = texture2D(tex, v_texcoord);
|
||||
fragColor = texture(tex, v_texcoord);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ uniform vec3 tint;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
|
||||
vec4 pixColor = texture2D(tex, v_texcoord);
|
||||
vec4 pixColor = texture(tex, v_texcoord);
|
||||
|
||||
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0)
|
||||
discard;
|
||||
|
@@ -7,5 +7,5 @@ uniform sampler2D texMatte;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = texture2D(tex, v_texcoord) * texture2D(texMatte, v_texcoord)[0]; // I know it only uses R, but matte should be black/white anyways.
|
||||
fragColor = texture(tex, v_texcoord) * texture(texMatte, v_texcoord)[0]; // I know it only uses R, but matte should be black/white anyways.
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ void main() {
|
||||
if (discardOpaque == 1 && alpha == 1.0)
|
||||
discard;
|
||||
|
||||
vec4 pixColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0);
|
||||
vec4 pixColor = vec4(texture(tex, v_texcoord).rgb, 1.0);
|
||||
|
||||
if (applyTint == 1) {
|
||||
pixColor[0] = pixColor[0] * tint[0];
|
||||
|
Reference in New Issue
Block a user