Skip to content

Commit

Permalink
use highp if available
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jul 9, 2020
1 parent 8c7d63d commit 3111b53
Show file tree
Hide file tree
Showing 48 changed files with 350 additions and 188 deletions.
63 changes: 54 additions & 9 deletions aquarium-vr/aquarium-vr.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@
}
</script>
<script id="texFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif


varying vec2 v_texCoord;
uniform vec4 colorMult;
Expand Down Expand Up @@ -248,7 +253,12 @@

</script>
<script id="fishNormalMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -299,7 +309,12 @@
</script>
<!-- ===[ fishReflection Shader ]=========================================== -->
<script id="fishReflectionFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -399,7 +414,12 @@

</script>
<script id="seaweedFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -465,7 +485,12 @@

</script>
<script id="diffuseFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -534,7 +559,12 @@

</script>
<script id="normalMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -615,7 +645,12 @@

</script>
<script id="reflectionMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -699,7 +734,12 @@

</script>
<script id="innerRefractionMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -793,7 +833,12 @@

</script>
<script id="outerRefractionMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down
56 changes: 48 additions & 8 deletions aquarium/aquarium.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,12 @@

</script>
<script id="fishNormalMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -296,7 +301,12 @@
</script>
<!-- ===[ fishReflection Shader ]=========================================== -->
<script id="fishReflectionFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -396,7 +406,12 @@

</script>
<script id="seaweedFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -462,7 +477,12 @@

</script>
<script id="diffuseFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -531,7 +551,12 @@

</script>
<script id="normalMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -612,7 +637,12 @@

</script>
<script id="reflectionMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -696,7 +726,12 @@

</script>
<script id="innerRefractionMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -790,7 +825,12 @@

</script>
<script id="outerRefractionMapFragmentShader" type="text/something-not-javascript">
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 lightColor;
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down
12 changes: 0 additions & 12 deletions blob/blob.html
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,7 @@
</body>

<script id="spinning_cube_fs" type="x-shader/x-fragment">
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
void main(void) {
gl_FragColor = v_color;
Expand All @@ -330,9 +328,7 @@
</script>

<script id="marching_cube_fs" type="x-shader/x-fragment">
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec3 v_normal;
uniform vec4 u_ambientUp;
Expand Down Expand Up @@ -379,9 +375,7 @@
</script>

<script id="blur_fs" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 v_texCoord;
uniform vec2 blurSize;
uniform vec4 subtract;
Expand Down Expand Up @@ -419,9 +413,7 @@
</script>

<script id="radial_fs" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 v_texCoord0, v_texCoord1, v_texCoord2, v_texCoord3;
uniform sampler2D mainSampler;
uniform float amount;
Expand All @@ -436,9 +428,7 @@
</script>

<script id="copy_fs" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 v_texCoord;
uniform sampler2D mainSampler;
void main() {
Expand All @@ -447,9 +437,7 @@
</script>

<script id="add_fs" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 v_texCoord;
uniform sampler2D mainSampler;
uniform sampler2D secondSampler;
Expand Down
6 changes: 4 additions & 2 deletions book/book.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
<script src="chrome_book_sim.js"></script>

<script id="shader-fs" type="x-shader/x-fragment">
#ifdef GL_ES
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

varying vec2 vTextureCoord;
Expand Down
6 changes: 4 additions & 2 deletions book/extension/book.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
<script src="chrome_book_sim.js"></script>

<script id="shader-fs" type="x-shader/x-fragment">
#ifdef GL_ES
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

varying vec2 vTextureCoord;
Expand Down
6 changes: 4 additions & 2 deletions caves/caves.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@
</body>

<script id="marching_cube_fs" type="x-shader/x-fragment">
#ifdef GL_ES
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec4 u_ambientUp;
Expand Down
18 changes: 8 additions & 10 deletions city/city.html
Original file line number Diff line number Diff line change
Expand Up @@ -1071,9 +1071,7 @@
}
</script>
<script id="constFragmentShader" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#endif
void main() {
gl_FragColor = vec4(0, 0, 0, 1);
}
Expand Down Expand Up @@ -1104,8 +1102,10 @@

</script>
<script id="diffusePointFragmentShader" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying vec4 v_position;
varying vec2 v_texCoord;
Expand Down Expand Up @@ -1149,9 +1149,7 @@

</script>
<script id="buildingFragmentShader" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_position;
varying vec2 v_texCoord;

Expand Down Expand Up @@ -1194,9 +1192,7 @@

</script>
<script id="streetLightFragmentShader" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;

void main() {
Expand All @@ -1213,8 +1209,10 @@
}
</script>
<script id="skyboxFragmentShader" type="text/something-not-javascript">
#ifdef GL_ES
precision mediump float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform samplerCube skybox;
uniform mat4 viewDirectionProjectionInverse;
Expand Down
Loading

0 comments on commit 3111b53

Please sign in to comment.