Skip to content

Commit

Permalink
Fix noise generation on GLES
Browse files Browse the repository at this point in the history
  • Loading branch information
scurest authored and gonetz committed Aug 4, 2024
1 parent 24f7f47 commit cb06d7b
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1004,11 +1004,11 @@ class ShaderNoise : public ShaderPart
ShaderNoise(const opengl::GLInfo & _glinfo)
{
m_part =
"uniform float uNoiseSeed; \n"
"uniform mediump float uNoiseSeed; \n"
"lowp float snoise() \n"
"{ \n"
" mediump vec2 coord = floor(gl_FragCoord.xy/uScreenScale); \n"
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
" highp vec2 coord = floor(gl_FragCoord.xy/uScreenScale);\n"
" highp vec3 p3 = vec3(uNoiseSeed, coord); \n"
// hash13 from https://www.shadertoy.com/view/4djSRW
" p3 = fract(p3 * .1031); \n"
" p3 += dot(p3, p3.zyx + 31.32); \n"
Expand Down Expand Up @@ -1068,8 +1068,8 @@ class ShaderDither : public ShaderPart
m_part +=
" lowp float mult = 1.0; \n";
m_part +=
" mediump vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale)); \n"
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
" highp vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale));\n"
" highp vec3 p3 = vec3(uNoiseSeed, coord); \n"
// hash33 from https://www.shadertoy.com/view/4djSRW
" p3 = fract(p3 * vec3(.1031, .1030, .0973)); \n"
" p3 += dot(p3, p3.yxz+33.33); \n"
Expand All @@ -1087,8 +1087,8 @@ class ShaderDither : public ShaderPart
" lowp float mult = 1.0; \n";
m_part +=
" \n"
" mediump vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale)); \n"
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
" highp vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale));\n"
" highp vec3 p3 = vec3(uNoiseSeed, coord); \n"
// hash13 from https://www.shadertoy.com/view/4djSRW
" p3 = fract(p3 * .1031); \n"
" p3 += dot(p3, p3.zyx + 31.32); \n"
Expand Down

0 comments on commit cb06d7b

Please sign in to comment.