From 3087b5ec30b53767030c99890a66e54817c8308e Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 14 Nov 2024 23:35:53 +0100 Subject: [PATCH] More gles fixes --- armorlab/shaders/inpaint_preview.frag.glsl | 4 ++-- armorlab/shaders/layer_copy_rrrr.frag.glsl | 2 +- armorpaint/shaders/layer_invert.frag.glsl | 2 +- armorpaint/shaders/layer_merge.frag.glsl | 12 ++++++------ armorpaint/shaders/layer_view.frag.glsl | 12 ++++++------ armorpaint/shaders/mask_colorid.frag.glsl | 2 +- armorpaint/shaders/mask_merge.frag.glsl | 4 ++-- armorpaint/sources/make_discard.ts | 4 ++-- base/shaders/compositor_pass.frag.glsl | 2 +- base/shaders/layer_copy.frag.glsl | 2 +- base/shaders/layer_copy_bgra.frag.glsl | 2 +- base/shaders/mask_apply.frag.glsl | 4 ++-- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/armorlab/shaders/inpaint_preview.frag.glsl b/armorlab/shaders/inpaint_preview.frag.glsl index e94761cdc..da0fbbbaf 100644 --- a/armorlab/shaders/inpaint_preview.frag.glsl +++ b/armorlab/shaders/inpaint_preview.frag.glsl @@ -7,7 +7,7 @@ in vec2 tex_coord; out vec4 frag_color; void main() { - vec4 col = textureLod(tex0, tex_coord, 0); - float mask = clamp(textureLod(texa, tex_coord, 0).r + 0.5, 0.0, 1.0); + vec4 col = textureLod(tex0, tex_coord, 0.0); + float mask = clamp(textureLod(texa, tex_coord, 0.0).r + 0.5, 0.0, 1.0); frag_color = col * mask; } diff --git a/armorlab/shaders/layer_copy_rrrr.frag.glsl b/armorlab/shaders/layer_copy_rrrr.frag.glsl index 67d5325fd..3da59166d 100644 --- a/armorlab/shaders/layer_copy_rrrr.frag.glsl +++ b/armorlab/shaders/layer_copy_rrrr.frag.glsl @@ -6,5 +6,5 @@ in vec2 tex_coord; out vec4 frag_color; void main() { - frag_color = textureLod(tex, tex_coord, 0).rrrr; + frag_color = textureLod(tex, tex_coord, 0.0).rrrr; } diff --git a/armorpaint/shaders/layer_invert.frag.glsl b/armorpaint/shaders/layer_invert.frag.glsl index 01968c5f7..f0cde5099 100644 --- a/armorpaint/shaders/layer_invert.frag.glsl +++ b/armorpaint/shaders/layer_invert.frag.glsl @@ -7,5 +7,5 @@ in vec4 color; out vec4 frag_color; void main() { - frag_color = vec4(1.0, 1.0, 1.0, 1.0) - textureLod(tex, tex_coord, 0).rgba * color; + frag_color = vec4(1.0, 1.0, 1.0, 1.0) - textureLod(tex, tex_coord, 0.0).rgba * color; } diff --git a/armorpaint/shaders/layer_merge.frag.glsl b/armorpaint/shaders/layer_merge.frag.glsl index 71e9e1ab1..d850a410e 100644 --- a/armorpaint/shaders/layer_merge.frag.glsl +++ b/armorpaint/shaders/layer_merge.frag.glsl @@ -26,23 +26,23 @@ vec3 rgb_to_hsv(const vec3 c) { } void main() { - vec4 col0 = textureLod(tex0, tex_coord, 0); - vec4 cola = textureLod(texa, tex_coord, 0); + vec4 col0 = textureLod(tex0, tex_coord, 0.0); + vec4 cola = textureLod(texa, tex_coord, 0.0); float str = col0.a * opac; - str *= textureLod(texmask, tex_coord, 0).r; + str *= textureLod(texmask, tex_coord, 0.0).r; if (blending == -1) { // Merging _nor and _pack - vec4 col1 = textureLod(tex1, tex_coord, 0); + vec4 col1 = textureLod(tex1, tex_coord, 0.0); frag_color = vec4(mix(cola, col1, str)); } else if (blending == -2) { // Merging _nor with normal blending - vec4 col1 = textureLod(tex1, tex_coord, 0); + vec4 col1 = textureLod(tex1, tex_coord, 0.0); // Whiteout blend vec3 n1 = cola.rgb * vec3(2.0, 2.0, 2.0) - vec3(1.0, 1.0, 1.0); vec3 n2 = mix(vec3(0.5, 0.5, 1.0), col1.rgb, str) * vec3(2.0, 2.0, 2.0) - vec3(1.0, 1.0, 1.0); frag_color = vec4(normalize(vec3(n1.xy + n2.xy, n1.z * n2.z)) * vec3(0.5, 0.5, 0.5) + vec3(0.5, 0.5, 0.5), max(col1.a, cola.a)); } else if (blending == -3) { // Merging _pack with height blending - vec4 col1 = textureLod(tex1, tex_coord, 0); + vec4 col1 = textureLod(tex1, tex_coord, 0.0); frag_color = vec4(mix(cola.rgb, col1.rgb, str), cola.a + col1.a); } else if (blending == -4) { // Merge _pack.height into _nor diff --git a/armorpaint/shaders/layer_view.frag.glsl b/armorpaint/shaders/layer_view.frag.glsl index 146a81dc7..0416a2680 100644 --- a/armorpaint/shaders/layer_view.frag.glsl +++ b/armorpaint/shaders/layer_view.frag.glsl @@ -9,22 +9,22 @@ out vec4 frag_color; void main() { if (channel == 1) { - frag_color = textureLod(tex, tex_coord, 0).rrra * color; + frag_color = textureLod(tex, tex_coord, 0.0).rrra * color; } else if (channel == 2) { - frag_color = textureLod(tex, tex_coord, 0).ggga * color; + frag_color = textureLod(tex, tex_coord, 0.0).ggga * color; } else if (channel == 3) { - frag_color = textureLod(tex, tex_coord, 0).bbba * color; + frag_color = textureLod(tex, tex_coord, 0.0).bbba * color; } else if (channel == 4) { - frag_color = textureLod(tex, tex_coord, 0).aaaa * color; + frag_color = textureLod(tex, tex_coord, 0.0).aaaa * color; } else if (channel == 5) { - frag_color = textureLod(tex, tex_coord, 0).rgba * color; + frag_color = textureLod(tex, tex_coord, 0.0).rgba * color; } else { - vec4 tex_sample = textureLod(tex, tex_coord, 0).rgba; + vec4 tex_sample = textureLod(tex, tex_coord, 0.0).rgba; tex_sample.rgb *= tex_sample.a; frag_color = tex_sample * color; } diff --git a/armorpaint/shaders/mask_colorid.frag.glsl b/armorpaint/shaders/mask_colorid.frag.glsl index 99fd94df4..5b079cb31 100644 --- a/armorpaint/shaders/mask_colorid.frag.glsl +++ b/armorpaint/shaders/mask_colorid.frag.glsl @@ -10,7 +10,7 @@ out vec4 frag_color; void main() { vec3 colorid_c1 = texelFetch(texpaint_colorid, ivec2(0, 0), 0).rgb; - vec3 colorid_c2 = textureLod(texcolorid, tex_coord, 0).rgb; + vec3 colorid_c2 = textureLod(texcolorid, tex_coord, 0.0).rgb; if (colorid_c1.x != colorid_c2.x || colorid_c1.y != colorid_c2.y || colorid_c1.z != colorid_c2.z) discard; frag_color = vec4(1.0, 1.0, 1.0, 1.0); } diff --git a/armorpaint/shaders/mask_merge.frag.glsl b/armorpaint/shaders/mask_merge.frag.glsl index ac5fa94c0..f937b50f9 100644 --- a/armorpaint/shaders/mask_merge.frag.glsl +++ b/armorpaint/shaders/mask_merge.frag.glsl @@ -9,8 +9,8 @@ in vec2 tex_coord; out vec4 frag_color; void main() { - float col0 = textureLod(tex0, tex_coord, 0).r; - float cola = textureLod(texa, tex_coord, 0).r; + float col0 = textureLod(tex0, tex_coord, 0.0).r; + float cola = textureLod(texa, tex_coord, 0.0).r; float str = opac; float out_color = 0.0; if (blending == 0) { // Mix diff --git a/armorpaint/sources/make_discard.ts b/armorpaint/sources/make_discard.ts index 7531deb73..a0b31f03b 100644 --- a/armorpaint/sources/make_discard.ts +++ b/armorpaint/sources/make_discard.ts @@ -22,7 +22,7 @@ function make_discard_face(vert: node_shader_t, frag: node_shader_t) { node_shader_write(frag, "vec2 tex_coord_inp = texelFetch(gbuffer2, ivec2(inp.x * gbuffer_size.x, (1.0 - inp.y) * gbuffer_size.y), 0).ba;"); ///end node_shader_write(frag, "vec4 face_c1 = texelFetch(textrianglemap, ivec2(tex_coord_inp * textrianglemap_size), 0);"); - node_shader_write(frag, "vec4 face_c2 = textureLod(textrianglemap, tex_coord_pick, 0);"); + node_shader_write(frag, "vec4 face_c2 = textureLod(textrianglemap, tex_coord_pick, 0.0);"); ///if (arm_direct3d11 || arm_direct3d12 || arm_metal) node_shader_write(frag, "if (any(face_c1 != face_c2)) discard;"); ///else @@ -32,7 +32,7 @@ function make_discard_face(vert: node_shader_t, frag: node_shader_t) { function make_discard_uv_island(vert: node_shader_t, frag: node_shader_t) { node_shader_add_uniform(frag, "sampler2D texuvislandmap", "_texuvislandmap"); - node_shader_write(frag, "if (textureLod(texuvislandmap, tex_coord_pick, 0).r == 0.0) discard;"); + node_shader_write(frag, "if (textureLod(texuvislandmap, tex_coord_pick, 0.0).r == 0.0) discard;"); } function make_discard_material_id(vert: node_shader_t, frag: node_shader_t) { diff --git a/base/shaders/compositor_pass.frag.glsl b/base/shaders/compositor_pass.frag.glsl index 12d6ff72e..21b316c1a 100644 --- a/base/shaders/compositor_pass.frag.glsl +++ b/base/shaders/compositor_pass.frag.glsl @@ -26,7 +26,7 @@ void main() { // Auto exposure // const float auto_exposure_strength = 1.0; - // float expo = 2.0 - clamp(length(textureLod(histogram, vec2(0.5, 0.5), 0).rgb), 0.0, 1.0); + // float expo = 2.0 - clamp(length(textureLod(histogram, vec2(0.5, 0.5), 0.0).rgb), 0.0, 1.0); // frag_color.rgb *= pow(expo, auto_exposure_strength * 2.0); frag_color.rgb = tonemap_filmic(frag_color.rgb); // With gamma diff --git a/base/shaders/layer_copy.frag.glsl b/base/shaders/layer_copy.frag.glsl index 938cdab9d..1271b89e2 100644 --- a/base/shaders/layer_copy.frag.glsl +++ b/base/shaders/layer_copy.frag.glsl @@ -7,5 +7,5 @@ in vec4 color; out vec4 frag_color; void main() { - frag_color = textureLod(tex, tex_coord, 0).rgba * color; + frag_color = textureLod(tex, tex_coord, 0.0).rgba * color; } diff --git a/base/shaders/layer_copy_bgra.frag.glsl b/base/shaders/layer_copy_bgra.frag.glsl index 6528dd261..d97d2a519 100644 --- a/base/shaders/layer_copy_bgra.frag.glsl +++ b/base/shaders/layer_copy_bgra.frag.glsl @@ -7,5 +7,5 @@ in vec4 color; out vec4 frag_color; void main() { - frag_color = textureLod(tex, tex_coord, 0).bgra * color; + frag_color = textureLod(tex, tex_coord, 0.0).bgra * color; } diff --git a/base/shaders/mask_apply.frag.glsl b/base/shaders/mask_apply.frag.glsl index de740f53f..120380a94 100644 --- a/base/shaders/mask_apply.frag.glsl +++ b/base/shaders/mask_apply.frag.glsl @@ -7,7 +7,7 @@ in vec2 tex_coord; out vec4 frag_color; void main() { - vec4 col0 = textureLod(tex0, tex_coord, 0); - float mask = textureLod(texa, tex_coord, 0).r; + vec4 col0 = textureLod(tex0, tex_coord, 0.0); + float mask = textureLod(texa, tex_coord, 0.0).r; frag_color = vec4(col0.rgb, col0.a * mask); }