Skip to content

Commit

Permalink
More gles fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Nov 14, 2024
1 parent 37b0b01 commit 3087b5e
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions armorlab/shaders/inpaint_preview.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion armorlab/shaders/layer_copy_rrrr.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion armorpaint/shaders/layer_invert.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 6 additions & 6 deletions armorpaint/shaders/layer_merge.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions armorpaint/shaders/layer_view.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion armorpaint/shaders/mask_colorid.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions armorpaint/shaders/mask_merge.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions armorpaint/sources/make_discard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion base/shaders/compositor_pass.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion base/shaders/layer_copy.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion base/shaders/layer_copy_bgra.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions base/shaders/mask_apply.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 3087b5e

Please sign in to comment.