2021-11-16 15:15:36 +00:00
|
|
|
#version 310 es
|
|
|
|
|
2022-09-02 19:19:10 +00:00
|
|
|
layout(binding = 2, std430) buffer OutputBuf_ssbo {
|
2021-11-16 15:15:36 +00:00
|
|
|
uint result[];
|
|
|
|
} tint_symbol;
|
2022-09-02 19:19:10 +00:00
|
|
|
|
2022-09-13 19:48:51 +00:00
|
|
|
layout(binding = 3, std140) uniform Uniforms_ubo {
|
2021-11-16 15:15:36 +00:00
|
|
|
uint dstTextureFlipY;
|
|
|
|
uint channelCount;
|
|
|
|
uvec2 srcCopyOrigin;
|
|
|
|
uvec2 dstCopyOrigin;
|
|
|
|
uvec2 copySize;
|
|
|
|
} uniforms;
|
|
|
|
|
|
|
|
bool aboutEqual(float value, float expect) {
|
|
|
|
return (abs((value - expect)) < 0.001f);
|
|
|
|
}
|
|
|
|
|
2022-01-24 17:17:22 +00:00
|
|
|
uniform highp sampler2D src_1;
|
|
|
|
uniform highp sampler2D dst_1;
|
2022-01-28 22:36:58 +00:00
|
|
|
void tint_symbol_1(uvec3 GlobalInvocationID) {
|
2022-10-26 18:36:44 +00:00
|
|
|
uvec2 srcSize = uvec2(textureSize(src_1, 0));
|
|
|
|
uvec2 dstSize = uvec2(textureSize(dst_1, 0));
|
2021-11-16 15:15:36 +00:00
|
|
|
uvec2 dstTexCoord = uvec2(GlobalInvocationID.xy);
|
|
|
|
vec4 nonCoveredColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
|
|
|
bool success = true;
|
|
|
|
bool tint_tmp_2 = (dstTexCoord.x < uniforms.dstCopyOrigin.x);
|
|
|
|
if (!tint_tmp_2) {
|
|
|
|
tint_tmp_2 = (dstTexCoord.y < uniforms.dstCopyOrigin.y);
|
|
|
|
}
|
|
|
|
bool tint_tmp_1 = (tint_tmp_2);
|
|
|
|
if (!tint_tmp_1) {
|
|
|
|
tint_tmp_1 = (dstTexCoord.x >= (uniforms.dstCopyOrigin.x + uniforms.copySize.x));
|
|
|
|
}
|
|
|
|
bool tint_tmp = (tint_tmp_1);
|
|
|
|
if (!tint_tmp) {
|
|
|
|
tint_tmp = (dstTexCoord.y >= (uniforms.dstCopyOrigin.y + uniforms.copySize.y));
|
|
|
|
}
|
|
|
|
if ((tint_tmp)) {
|
|
|
|
bool tint_tmp_3 = success;
|
|
|
|
if (tint_tmp_3) {
|
2022-06-24 18:15:39 +00:00
|
|
|
tint_tmp_3 = all(equal(texelFetch(dst_1, ivec2(dstTexCoord), 0), nonCoveredColor));
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
|
|
|
success = (tint_tmp_3);
|
|
|
|
} else {
|
|
|
|
uvec2 srcTexCoord = ((dstTexCoord - uniforms.dstCopyOrigin) + uniforms.srcCopyOrigin);
|
|
|
|
if ((uniforms.dstTextureFlipY == 1u)) {
|
2022-10-26 18:36:44 +00:00
|
|
|
srcTexCoord.y = ((srcSize.y - srcTexCoord.y) - 1u);
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
2022-01-24 17:17:22 +00:00
|
|
|
vec4 srcColor = texelFetch(src_1, ivec2(srcTexCoord), 0);
|
|
|
|
vec4 dstColor = texelFetch(dst_1, ivec2(dstTexCoord), 0);
|
2021-11-16 15:15:36 +00:00
|
|
|
if ((uniforms.channelCount == 2u)) {
|
2022-03-15 15:35:13 +00:00
|
|
|
bool tint_symbol_3 = success;
|
|
|
|
if (tint_symbol_3) {
|
|
|
|
tint_symbol_3 = aboutEqual(dstColor.r, srcColor.r);
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
2022-03-15 15:35:13 +00:00
|
|
|
bool tint_symbol_2 = tint_symbol_3;
|
|
|
|
if (tint_symbol_2) {
|
|
|
|
tint_symbol_2 = aboutEqual(dstColor.g, srcColor.g);
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
2022-03-15 15:35:13 +00:00
|
|
|
success = tint_symbol_2;
|
2021-11-16 15:15:36 +00:00
|
|
|
} else {
|
2022-03-15 15:35:13 +00:00
|
|
|
bool tint_symbol_7 = success;
|
|
|
|
if (tint_symbol_7) {
|
|
|
|
tint_symbol_7 = aboutEqual(dstColor.r, srcColor.r);
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
2022-03-15 15:35:13 +00:00
|
|
|
bool tint_symbol_6 = tint_symbol_7;
|
|
|
|
if (tint_symbol_6) {
|
|
|
|
tint_symbol_6 = aboutEqual(dstColor.g, srcColor.g);
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
2022-03-15 15:35:13 +00:00
|
|
|
bool tint_symbol_5 = tint_symbol_6;
|
|
|
|
if (tint_symbol_5) {
|
|
|
|
tint_symbol_5 = aboutEqual(dstColor.b, srcColor.b);
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
2022-03-15 15:35:13 +00:00
|
|
|
bool tint_symbol_4 = tint_symbol_5;
|
|
|
|
if (tint_symbol_4) {
|
|
|
|
tint_symbol_4 = aboutEqual(dstColor.a, srcColor.a);
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
2022-03-15 15:35:13 +00:00
|
|
|
success = tint_symbol_4;
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-26 18:36:44 +00:00
|
|
|
uint outputIndex = ((GlobalInvocationID.y * dstSize.x) + GlobalInvocationID.x);
|
2021-11-16 15:15:36 +00:00
|
|
|
if (success) {
|
|
|
|
tint_symbol.result[outputIndex] = 1u;
|
|
|
|
} else {
|
|
|
|
tint_symbol.result[outputIndex] = 0u;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
void main() {
|
2022-01-28 22:36:58 +00:00
|
|
|
tint_symbol_1(gl_GlobalInvocationID);
|
|
|
|
return;
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|