-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For now, they are just duplicates of the 300es shaders since they don't have #version.
- Loading branch information
1 parent
60a2b7d
commit 3c841ae
Showing
10 changed files
with
448 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2018 The GraphicsFuzz Project Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
layout(location = 0) out vec4 _GLF_color; | ||
|
||
uniform vec2 injectionSwitch; | ||
|
||
uniform vec2 resolution; | ||
|
||
bool checkSwap(float a, float b) | ||
{ | ||
return gl_FragCoord.y < resolution.y / 2.0 ? a > b : a < b; | ||
} | ||
void main() | ||
{ | ||
float data[10]; | ||
for( | ||
int i = 0; | ||
i < 10; | ||
i ++ | ||
) | ||
{ | ||
data[i] = float(10 - i) * injectionSwitch.y; | ||
} | ||
for( | ||
int i = 0; | ||
i < 9; | ||
i ++ | ||
) | ||
{ | ||
for( | ||
int j = 0; | ||
j < 10; | ||
j ++ | ||
) | ||
{ | ||
if(j < i + 1) | ||
{ | ||
continue; | ||
} | ||
bool doSwap = checkSwap(data[i], data[j]); | ||
if(doSwap) | ||
{ | ||
float temp = data[i]; | ||
data[i] = data[j]; | ||
data[j] = temp; | ||
} | ||
} | ||
} | ||
if(gl_FragCoord.x < resolution.x / 2.0) | ||
{ | ||
_GLF_color = vec4(data[0] / 10.0, data[5] / 10.0, data[9] / 10.0, 1.0); | ||
} | ||
else | ||
{ | ||
_GLF_color = vec4(data[5] / 10.0, data[9] / 10.0, data[0] / 10.0, 1.0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"injectionSwitch": { | ||
"func": "glUniform2f", | ||
"args": [ | ||
0.0, | ||
1.0 | ||
] | ||
}, | ||
"resolution": { | ||
"func": "glUniform2f", | ||
"args": [ | ||
256.0, | ||
256.0 | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2018 The GraphicsFuzz Project Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
layout(location = 0) out vec4 _GLF_color; | ||
|
||
uniform vec2 injectionSwitch; | ||
uniform vec2 resolution; | ||
|
||
float nb_mod(float limit, float ref) { | ||
float s = 0.0; | ||
for (int i = 1; i < 800; i++) { | ||
if (mod(float(i), ref) <= 0.01) { | ||
s += 0.2; | ||
} | ||
if (float(i) >= limit) { | ||
return s; | ||
} | ||
} | ||
return s; | ||
} | ||
|
||
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.z = c.x + c.y; | ||
|
||
for (int i = 0; i < 3; i++) { | ||
if (c[i] >= 1.0) { | ||
c[i] = c[i] * c[i]; | ||
} | ||
} | ||
c.x = mod(c.x, 1.0); | ||
c.y = mod(c.y, 1.0); | ||
c.z = mod(c.z, 1.0); | ||
_GLF_color = c; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"resolution": { | ||
"func": "glUniform2f", | ||
"args": [ | ||
256.0, | ||
256.0 | ||
] | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
shaders/src/main/glsl/samples/310es/mandelbrot_blurry.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2018 The GraphicsFuzz Project Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
layout(location = 0) out vec4 _GLF_color; | ||
|
||
uniform vec2 resolution; | ||
|
||
vec3 pickColor(int i) { | ||
return vec3(float(i) / 100.0); | ||
} | ||
|
||
vec3 mand(float xCoord, float yCoord) { | ||
float height = resolution.y; | ||
float width = resolution.x; | ||
|
||
float c_re = (xCoord - width/2.0)*4.0/width; | ||
float c_im = (yCoord - height/2.0)*4.0/width; | ||
float x = 0.0, y = 0.0; | ||
int iteration = 0; | ||
for (int k = 0; k < 1000; k++) { | ||
if (x*x+y*y > 4.0) { | ||
break; | ||
} | ||
float x_new = x*x - y*y + c_re; | ||
y = 2.0*x*y + c_im; | ||
x = x_new; | ||
iteration++; | ||
} | ||
if (iteration < 1000) { | ||
return pickColor(iteration); | ||
} else { | ||
return vec3(0.0); | ||
} | ||
} | ||
|
||
void main() { | ||
vec3 data[9]; | ||
for (int i = 0; i < 3; i++) { | ||
for (int j = 0; j < 3; j++) { | ||
data[3*j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1)); | ||
} | ||
} | ||
vec3 sum = vec3(0.0); | ||
for (int i = 0; i < 9; i++) { | ||
sum += data[i]; | ||
} | ||
sum /= vec3(9.0); | ||
_GLF_color = vec4(sum, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"resolution": { | ||
"func": "glUniform2f", | ||
"args": [ | ||
256.0, | ||
256.0 | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright 2018 The GraphicsFuzz Project Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
layout(location = 0) out vec4 _GLF_color; | ||
|
||
uniform vec2 resolution; | ||
|
||
void main(void) { | ||
float A[50]; | ||
for (int i = 0; i < 200; i++) { | ||
if (i >= int(resolution.x)) { | ||
break; | ||
} | ||
if ((4 * (i/4)) == i) { | ||
A[i/4] = float(i); | ||
} | ||
} | ||
for (int i = 0; i < 50; i++) { | ||
if (i < int(gl_FragCoord.x)) { | ||
break; | ||
} | ||
if (i > 0) { | ||
A[i] += A[i - 1]; | ||
} | ||
} | ||
if (int(gl_FragCoord.x) < 20) { | ||
_GLF_color = vec4(A[0]/resolution.x, A[4]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 40) { | ||
_GLF_color = vec4(A[5]/resolution.x, A[9]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 60) { | ||
_GLF_color = vec4(A[10]/resolution.x, A[14]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 80) { | ||
_GLF_color = vec4(A[15]/resolution.x, A[19]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 100) { | ||
_GLF_color = vec4(A[20]/resolution.x, A[24]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 120) { | ||
_GLF_color = vec4(A[25]/resolution.x, A[29]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 140) { | ||
_GLF_color = vec4(A[30]/resolution.x, A[34]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 160) { | ||
_GLF_color = vec4(A[35]/resolution.x, A[39]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 180) { | ||
_GLF_color = vec4(A[40]/resolution.x, A[44]/resolution.y, 1.0, 1.0); | ||
} else if (int(gl_FragCoord.x) < 180) { | ||
_GLF_color = vec4(A[45]/resolution.x, A[49]/resolution.y, 1.0, 1.0); | ||
} else { | ||
discard; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"resolution": { | ||
"func": "glUniform2f", | ||
"args": [ | ||
256.0, | ||
256.0 | ||
] | ||
} | ||
} |
Oops, something went wrong.