Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shaders/src/main/glsl/samples/100/colorgrid_modulo.frag
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ void main()
vec4 c = vec4(0.0, 0.0, 0.0, 1.0);
float ref = floor(resolution.x / 8.0);

c.x = nb_mod(gl_FragCoord.x, ref);
c.y = nb_mod(gl_FragCoord.y, ref);
c.x = nb_mod(floor(gl_FragCoord.x), ref);
c.y = nb_mod(floor(gl_FragCoord.y), ref);
c.z = c.x + c.y;

for (int i = 0; i < 3; i++) {
Expand Down
2 changes: 1 addition & 1 deletion shaders/src/main/glsl/samples/100/mandelbrot_zoom.frag
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void main() {
vec3 data[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
data[4*j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1));
data[4*j + i] = mand(floor(gl_FragCoord.x) + float(i - 1), floor(gl_FragCoord.y) + float(j - 1));
}
}
vec3 sum = vec3(0.0);
Expand Down
2 changes: 1 addition & 1 deletion shaders/src/main/glsl/samples/100/squares.frag
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ vec3 computePoint(mat2 rotationMatrix)
vec2 aspect;
aspect = resolution.xy / min(resolution.x, resolution.y);
vec2 position;
position = (gl_FragCoord.xy / resolution.xy) * aspect;
position = (floor(gl_FragCoord.xy) / resolution.xy) * aspect;
vec2 center;
center = vec2(0.5) * aspect;
position *= rotationMatrix;
Expand Down
4 changes: 2 additions & 2 deletions shaders/src/main/glsl/samples/100/stable_bubblesort_flag.frag
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ uniform vec2 resolution;

bool checkSwap(float a, float b)
{
return gl_FragCoord.y < resolution.y / 2.0 ? a > b : a < b;
return floor(gl_FragCoord.y) < resolution.y / 2.0 ? a > b : a < b;
}
void main()
{
Expand Down Expand Up @@ -62,7 +62,7 @@ void main()
}
}
}
if(gl_FragCoord.x < resolution.x / 2.0)
if (floor(gl_FragCoord.x) < resolution.x / 2.0)
{
gl_FragColor = vec4(data[0] / 10.0, data[5] / 10.0, data[9] / 10.0, 1.0);
}
Expand Down
8 changes: 4 additions & 4 deletions shaders/src/main/glsl/samples/300es/binarysearch_bw.frag
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ vec2 brick(vec2 uv) {
int b = 3;
do {
uv.y -= step(injectionSwitch.y, uv.x) + float(a);
uv.x *= (isnan(uv.y) ? cosh(gl_FragCoord.y) : tanh(gl_FragCoord.x));
uv.x *= (isnan(uv.y) ? cosh(floor(gl_FragCoord.y)) : tanh(floor(gl_FragCoord.x)));
b--;
} while (b > int(injectionSwitch.x));
int c = 2;
Expand All @@ -75,7 +75,7 @@ vec2 brick(vec2 uv) {
float patternize(vec2 uv) {
vec2 size = vec2(0.45);
vec2 st = smoothstep(size, size, uv);
switch (int(mod(gl_FragCoord.y, 5.0))) {
switch (int(mod(floor(gl_FragCoord.y), 5.0))) {
case 0:
return mix(pow(st.x, injectionSwitch.y), st.x, size.y);
break;
Expand Down Expand Up @@ -139,11 +139,11 @@ void main() {
}
}

vec2 uv = (gl_FragCoord.xy / resolution.x) * vec2(resolution.x / resolution.y, 1.0);
vec2 uv = (floor(gl_FragCoord.xy) / resolution.x) * vec2(resolution.x / resolution.y, 1.0);
vec2 b = brick(uv * 7.0);
vec3 color = vec3(patternize(b));

if (gl_FragCoord.y < resolution.y / 1.1) {
if (floor(gl_FragCoord.y) < resolution.y / 1.1) {
// We are going to search the item in array by giving the value of the item index 4 and 0 in an array.
if (binarySearch(obj, obj.prime_numbers[4]) != -(int(resolution.y)) && binarySearch(obj, obj.prime_numbers[0]) >= -(int(resolution.x))) {
color.yz -= dot(float(binarySearch(obj, obj.prime_numbers[4])), float(binarySearch(obj, obj.prime_numbers[0])));
Expand Down
2 changes: 1 addition & 1 deletion shaders/src/main/glsl/samples/300es/binarysearch_tree.frag
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void main() {
treeIndex++;
insert(treeIndex, 13);

vec2 z = (gl_FragCoord.yx / resolution);
vec2 z = (floor(gl_FragCoord.yx) / resolution);
float x = makeFrame(z.x);
float y = makeFrame(z.y);

Expand Down
4 changes: 2 additions & 2 deletions shaders/src/main/glsl/samples/300es/colorgrid_modulo.frag
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void main()
vec4 c = vec4(0.0, 0.0, 0.0, 1.0);
float ref = floor(resolution.x / 8.0);

c.x = nb_mod(gl_FragCoord.x, ref);
c.y = nb_mod(gl_FragCoord.y, ref);
c.x = nb_mod(floor(gl_FragCoord.x), ref);
c.y = nb_mod(floor(gl_FragCoord.y), ref);
c.z = c.x + c.y;

for (int i = 0; i < 3; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void main()
{
// We need to modify A in place, so we have to copy the uniform
mat4 matrix_a = mat4(matrix_a_uni);
vec4 matrix_b = gl_FragCoord.wxyz;
vec4 matrix_b = floor(gl_FragCoord.wxyz);

vec4 matrix_u = vec4(0.0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void main() {
vec3 data[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
data[4*j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1));
data[4*j + i] = mand(floor(gl_FragCoord.x) + float(i - 1), floor(gl_FragCoord.y) + float(j - 1));
}
}
vec3 sum = vec3(0.0);
Expand Down
2 changes: 1 addition & 1 deletion shaders/src/main/glsl/samples/300es/mandelbrot_zoom.frag
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void main() {
vec3 data[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
data[4*j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1));
data[4*j + i] = mand(floor(gl_FragCoord.x) + float(i - 1), floor(gl_FragCoord.y) + float(j - 1));
}
}
vec3 sum = vec3(0.0);
Expand Down
12 changes: 6 additions & 6 deletions shaders/src/main/glsl/samples/300es/mergesort_mosaic.frag
Original file line number Diff line number Diff line change
Expand Up @@ -121,39 +121,39 @@ void main() {
vec3(0, -5, int(injectionSwitch.y)) * LDEXP(0.2, 5.0),
vec3(1, 8, int(injectionSwitch.y)) * LDEXP(injectionSwitch.y, 0.0)
);
vec3 vecCoor = roundEven(pos * vec3(gl_FragCoord.xx / resolution.yx, 1));
vec3 vecCoor = roundEven(pos * vec3(floor(gl_FragCoord.xx) / resolution.yx, 1));
vec2 color;

do {
if (int(gl_FragCoord[1]) < 30) {
color = fract(sin(vecCoor.yx - trunc(float(data[0]))));
color[0] = dFdy(gl_FragCoord.y);
color[0] = dFdy(floor(gl_FragCoord.y));
break;
} else if (int(gl_FragCoord[1]) < 60) {
color = fract(sin(vecCoor.yx - trunc(float(data[1]))));
color[1] *= atan(faceforward(injectionSwitch, color.xx, vecCoor.yx).y);
break;
} else if (int(gl_FragCoord[1]) < 90) {
color = fract(sin(vecCoor.yx - trunc(float(data[2]))));
color.x += atanh(color.x) * cosh(injectionSwitch.y) * smoothstep(color, injectionSwitch, gl_FragCoord.yy).x;
color.x += atanh(color.x) * cosh(injectionSwitch.y) * smoothstep(color, injectionSwitch, floor(gl_FragCoord.yy)).x;
break;
} else if (int(gl_FragCoord[1]) < 120) {
color = fract(acosh(clamp(vecCoor.yx - trunc(float(data[3])), 1.0, 1000.0)));
color.x += (isnan(gl_FragCoord.x) ? log2(gl_FragCoord.x) : log2(gl_FragCoord.y));
color.x += (isnan(floor(gl_FragCoord.x)) ? log2(floor(gl_FragCoord.x)) : log2(floor(gl_FragCoord.y)));
break;
} else if (int(gl_FragCoord[1]) < 150) {
discard;
} else if (int(gl_FragCoord[1]) < 180) {
color = fract(sin(vecCoor.yx - trunc(float(data[4]))));
color[1] += asinh(gl_FragCoord.y * LDEXP(color.y, float(-i)));
color[1] += asinh(floor(gl_FragCoord.y) * LDEXP(color.y, float(-i)));
break;
} else if (int(gl_FragCoord[1]) < 210) {
color = fract(sin(vecCoor.yx - trunc(float(data[5]))));
color.y -= tanh(color.x) / cosh(color.y);
break;
} else if (int(gl_FragCoord[1]) < 240) {
color = fract(asinh(vecCoor.yx - trunc(float(data[6]))));
color.y -= isnan(float(i)) ? tanh(gl_FragCoord.x): atanh(gl_FragCoord.y);
color.y -= isnan(float(i)) ? tanh(floor(gl_FragCoord.x)): atanh(floor(gl_FragCoord.y));
break;
} else if (int(gl_FragCoord[1]) < 270) {
color = fract(sin(vecCoor.yx - trunc(float(data[7]))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ vec2 pattern(in vec2 x) {
}

void main() {
vec2 uv = gl_FragCoord.xy / resolution.y;
vec2 uv = floor(gl_FragCoord.xy) / resolution.y;
float A[50];
for (int i = 0; i < 200; i++) {
if (i >= int(resolution.x)) {
Expand Down
4 changes: 2 additions & 2 deletions shaders/src/main/glsl/samples/300es/quicksort_palette.frag
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void main() {
}
quicksort();
vec2 grid = vec2(20, 20);
vec2 uv = gl_FragCoord.xy / resolution;
vec2 uv = floor(gl_FragCoord.xy) / resolution;
vec3 color = palette(vec3(float(obj.numbers[4]) * 0.1), vec3(0.9, float(obj.numbers[8]) * 0.1, 0.8), trunc(vec3(injectionSwitch.y)), vec3(injectionSwitch.x, 0.3, 0.7));
if (uv.x > (1.0 / 4.0)) {
int count = int(injectionSwitch.x);
Expand All @@ -124,7 +124,7 @@ void main() {
grid += vec2(count + obj.numbers[3], count + obj.numbers[3]);
}

vec2 position = vec2(gl_FragCoord.x, resolution.x - gl_FragCoord.y);
vec2 position = vec2(floor(gl_FragCoord.x), resolution.x - floor(gl_FragCoord.y));
position = floor(position / grid);
_GLF_color = vec4(color, injectionSwitch.y) + vec4(!puzzlelize(position));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ void main() {
obj.even_numbers[i] = smaller_number;
}

vec2 uv = gl_FragCoord.xy/resolution.xy;
vec2 uv = floor(gl_FragCoord.xy)/resolution.xy;
vec3 col = tan(pow(uv.xxx, uv.yyy) +
vec3(
obj.odd_numbers[int(floor(gl_FragCoord.x/1000.0))],
obj.even_numbers[int(floor(gl_FragCoord.y/1000.0))],
obj.odd_numbers[int(floor(floor(gl_FragCoord.x) / 1000.0))],
obj.even_numbers[int(floor(floor(gl_FragCoord.y) / 1000.0))],
sinh(uv.x)
));

Expand Down
2 changes: 1 addition & 1 deletion shaders/src/main/glsl/samples/300es/squares.frag
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ vec3 computePoint(mat2 rotationMatrix)
vec2 aspect;
aspect = resolution.xy / min(resolution.x, resolution.y);
vec2 position;
position = (gl_FragCoord.xy / resolution.xy) * aspect;
position = (floor(gl_FragCoord.xy) / resolution.xy) * aspect;
vec2 center;
center = vec2(0.5) * aspect;
position *= rotationMatrix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ uniform vec2 resolution;

bool checkSwap(float a, float b)
{
return gl_FragCoord.y < resolution.y / 2.0 ? a > b : a < b;
return floor(gl_FragCoord.y) < resolution.y / 2.0 ? a > b : a < b;
}
void main()
{
Expand Down Expand Up @@ -64,7 +64,7 @@ void main()
}
}
}
if(gl_FragCoord.x < resolution.x / 2.0)
if (floor(gl_FragCoord.x) < resolution.x / 2.0)
{
_GLF_color = vec4(data[0] / 10.0, data[5] / 10.0, data[9] / 10.0, 1.0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ float compute_stripe(float v) {
}

void main() {
vec2 uv = gl_FragCoord.xy / resolution.x;
vec2 uv = floor(gl_FragCoord.xy) / resolution.x;
vec3 col = vec3(0, 0, 0);

bool c1 = uv.y < 0.25;
Expand Down
8 changes: 4 additions & 4 deletions shaders/src/main/glsl/samples/320es/binarysearch_bw.frag
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ vec2 brick(vec2 uv) {
int b = 3;
do {
uv.y -= step(injectionSwitch.y, uv.x) + float(a);
uv.x *= (isnan(uv.y) ? cosh(gl_FragCoord.y) : tanh(gl_FragCoord.x));
uv.x *= (isnan(uv.y) ? cosh(floor(gl_FragCoord.y)) : tanh(floor(gl_FragCoord.x)));
b--;
} while (b > int(injectionSwitch.x));
int c = 2;
Expand All @@ -58,7 +58,7 @@ vec2 brick(vec2 uv) {
float patternize(vec2 uv) {
vec2 size = vec2(0.45);
vec2 st = smoothstep(size, size, uv);
switch (int(mod(gl_FragCoord.y, 5.0))) {
switch (int(mod(floor(gl_FragCoord.y), 5.0))) {
case 0:
return mix(pow(st.x, injectionSwitch.y), st.x, size.y);
break;
Expand Down Expand Up @@ -122,11 +122,11 @@ void main() {
}
}

vec2 uv = (gl_FragCoord.xy / resolution.x) * vec2(resolution.x / resolution.y, 1.0);
vec2 uv = (floor(gl_FragCoord.xy) / resolution.x) * vec2(resolution.x / resolution.y, 1.0);
vec2 b = brick(uv * 7.0);
vec3 color = vec3(patternize(b));

if (gl_FragCoord.y < resolution.y / 1.1) {
if (floor(gl_FragCoord.y) < resolution.y / 1.1) {
// We are going to search the item in array by giving the value of the item index 4 and 0 in an array.
if (binarySearch(obj, obj.prime_numbers[4]) != -(int(resolution.y)) && binarySearch(obj, obj.prime_numbers[0]) >= -(int(resolution.x))) {
color.yz -= dot(float(binarySearch(obj, obj.prime_numbers[4])), float(binarySearch(obj, obj.prime_numbers[0])));
Expand Down
2 changes: 1 addition & 1 deletion shaders/src/main/glsl/samples/320es/binarysearch_tree.frag
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void main() {
treeIndex++;
insert(treeIndex, 13);

vec2 z = (gl_FragCoord.yx / resolution);
vec2 z = (floor(gl_FragCoord.yx) / resolution);
float x = makeFrame(z.x);
float y = makeFrame(z.y);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ uniform vec2 resolution;

bool checkSwap(float a, float b)
{
return gl_FragCoord.y < resolution.y / 2.0 ? a > b : a < b;
return floor(gl_FragCoord.y) < resolution.y / 2.0 ? a > b : a < b;
}
void main()
{
Expand Down Expand Up @@ -58,7 +58,7 @@ void main()
}
i++;
} while(i < findMSB(msb9));
if(gl_FragCoord.x < resolution.x / 2.0)
if (floor(gl_FragCoord.x) < resolution.x / 2.0)
{
_GLF_color = vec4(data[findMSB(1)] / 10.0, data[findLSB(32)] / 10.0, data[findMSB(msb9)] / 10.0, 1.0);
}
Expand Down
4 changes: 2 additions & 2 deletions shaders/src/main/glsl/samples/320es/colorgrid_modulo.frag
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void main()
vec4 c = vec4(0.0, 0.0, 0.0, 1.0);
float ref = floor(resolution.x / 8.0);

c.x = nb_mod(gl_FragCoord.x, ref);
c.y = nb_mod(gl_FragCoord.y, ref);
c.x = nb_mod(floor(gl_FragCoord.x), ref);
c.y = nb_mod(floor(gl_FragCoord.y), ref);
c.z = c.x + c.y;

for (int i = 0; i < 3; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ void main()
vec4 c = vec4(bitfieldExtract(0, 0, 0), 0.0, 0.0, bitCount(msb8));
float ref = floor(resolution.x / float(findLSB(msb8)));

c.x = nb_mod(gl_FragCoord.x, ref);
c.y = nb_mod(gl_FragCoord.y, ref);
c.x = nb_mod(floor(gl_FragCoord.x), ref);
c.y = nb_mod(floor(gl_FragCoord.y), ref);
c.z = c.x + c.y;
int i = bitfieldReverse(bitfieldExtract(0, 0, 0));
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void main()
{
// We need to modify A in place, so we have to copy the uniform
mat4 matrix_a = mat4(matrix_a_uni);
vec4 matrix_b = gl_FragCoord.wxyz;
vec4 matrix_b = floor(gl_FragCoord.wxyz);

vec4 matrix_u = vec4(0.0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void main() {
vec3 data[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
data[4*j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1));
data[4*j + i] = mand(floor(gl_FragCoord.x) + float(i - 1), floor(gl_FragCoord.y) + float(j - 1));
}
}
vec3 sum = vec3(0.0);
Expand Down
2 changes: 1 addition & 1 deletion shaders/src/main/glsl/samples/320es/mandelbrot_zoom.frag
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void main() {
vec3 data[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
data[4*j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1));
data[4*j + i] = mand(floor(gl_FragCoord.x) + float(i - 1), floor(gl_FragCoord.y) + float(j - 1));
}
}
vec3 sum = vec3(0.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void main() {
vec3 data[16];
for (int i = 0; i < findMSB(16); i++) {
for (int j = 0; j < findLSB(16); j++) {
data[uaddCarry(uint(4*j), uint(i), uselessOutVariable)] = mand(gl_FragCoord.x + float(i - bitCount(1)), gl_FragCoord.y + float(j - bitCount(1)));
data[uaddCarry(uint(4*j), uint(i), uselessOutVariable)] = mand(floor(gl_FragCoord.x) + float(i - bitCount(1)), floor(gl_FragCoord.y) + float(j - bitCount(1)));
}
}
vec3 sum = vec3(0.0);
Expand Down
4 changes: 2 additions & 2 deletions shaders/src/main/glsl/samples/320es/matrices_many_loops.frag
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ void main()
POPULATE_SUMS(m43, 4, 3, 7);
POPULATE_SUMS(m44, 4, 4, 8);

int region_x = int(gl_FragCoord.x / (resolution.x / 3.0));
int region_y = int(gl_FragCoord.y / (resolution.x / 3.0));
int region_x = int(floor(gl_FragCoord.x) / (resolution.x / 3.0));
int region_y = int(floor(gl_FragCoord.y) / (resolution.x / 3.0));
int overall_region = region_y * 3 + region_x;

if (overall_region > 0 && overall_region < 9) {
Expand Down
4 changes: 2 additions & 2 deletions shaders/src/main/glsl/samples/320es/matrices_smart_loops.frag
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ void main()
}
}

int region_x = int(gl_FragCoord.x / (resolution.x / 3.0));
int region_y = int(gl_FragCoord.y / (resolution.x / 3.0));
int region_x = int(floor(gl_FragCoord.x) / (resolution.x / 3.0));
int region_y = int(floor(gl_FragCoord.y) / (resolution.x / 3.0));
int overall_region = region_y * 3 + region_x;

if (overall_region > 0 && overall_region < 9) {
Expand Down
Loading