2 vec2 hammersley(uint i, uint count)
4 float y = bitfieldReverse(i)*2.3283064e-10;
5 return vec2(float(i)/count, y);
7 const uint sample_count = 128;
9 #pragma MSP stage(vertex)
10 layout(location=0) in vec4 position;
13 gl_Position = position;
14 out vec2 texcoord = position.xy*0.5+0.5;
17 #pragma MSP stage(fragment)
18 layout(location=0) out vec4 frag_color;
22 for(int i=0; i<sample_count; ++i)
23 sum += texture(tex, texcoord+pow(hammersley(i, sample_count), vec2(2.0)));
24 frag_color = sum/sample_count;
27 /* Expected output: vertex
28 layout(location=0) in vec4 position;
29 layout(location=0) out vec2 texcoord;
32 gl_Position = position;
33 texcoord = position.xy*0.5+0.5;
37 /* Expected output: fragment
38 layout(location=0, binding=71) uniform sampler2D tex;
39 layout(location=0) out vec4 frag_color;
40 layout(location=0) in vec2 texcoord;
44 for(int i=0; uint(i)<128u; ++i)
47 sum += texture(tex, texcoord+pow(vec2(float(i_1)/128.0, float(bitfieldReverse(i_1))*2.3283064e-10), vec2(2.0)));
49 frag_color = sum/128.0;