RetroArch
fft_fragment_program_real.glsl.frag.h
Go to the documentation of this file.
1 #include "shaders_common.h"
2 
3 static const char *fft_fragment_program_real = GLSL_300(
4  precision mediump float;
5  precision highp int;
6  precision highp usampler2D;
7  precision highp isampler2D;
8 
9  in vec2 vTex;
10  uniform isampler2D sTexture;
11  uniform usampler2D sParameterTexture;
12  uniform usampler2D sWindow;
13  uniform int uViewportOffset;
14  out uvec2 FragColor;
15 
16  vec2 compMul(vec2 a, vec2 b) { return vec2(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x); }
17 
18  void main() {
19  uvec2 params = texture(sParameterTexture, vec2(vTex.x, 0.5)).rg;
20  uvec2 coord = uvec2((params.x >> 16u) & 0xffffu, params.x & 0xffffu);
21  int ycoord = int(gl_FragCoord.y) - uViewportOffset;
22  vec2 twiddle = unpackHalf2x16(params.y);
23 
24  float window_a = float(texelFetch(sWindow, ivec2(coord.x, 0), 0).r) / float(0x10000);
25  float window_b = float(texelFetch(sWindow, ivec2(coord.y, 0), 0).r) / float(0x10000);
26 
27  vec2 a = window_a * vec2(texelFetch(sTexture, ivec2(int(coord.x), ycoord), 0).rg) / vec2(0x8000);
28  vec2 a_l = vec2(a.x, 0.0);
29  vec2 a_r = vec2(a.y, 0.0);
30  vec2 b = window_b * vec2(texelFetch(sTexture, ivec2(int(coord.y), ycoord), 0).rg) / vec2(0x8000);
31  vec2 b_l = vec2(b.x, 0.0);
32  vec2 b_r = vec2(b.y, 0.0);
33  b_l = compMul(b_l, twiddle);
34  b_r = compMul(b_r, twiddle);
35 
36  vec2 res_l = a_l + b_l;
37  vec2 res_r = a_r + b_r;
38  FragColor = uvec2(packHalf2x16(res_l), packHalf2x16(res_r));
39  }
40 );
#define GLSL_300(src)
Definition: shaders_common.h:11
GLenum const GLfloat * params
Definition: glext.h:6297
struct passwd out
Definition: missing_libc_functions.c:51
GLenum GLint GLint * precision
Definition: glext.h:8206
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define gl_FragCoord
Definition: internal_interface.hpp:357
sampler2DBase< glm::ivec4 > isampler2D
Definition: sampler.hpp:95
GLenum GLuint texture
Definition: glext.h:6935
GLuint coord
Definition: glext.h:10418
GLuint in
Definition: glext.h:10523
int main(int argc, char *argv[])
Definition: send-presence.c:197
static const char * fft_fragment_program_real
Definition: fft_fragment_program_real.glsl.frag.h:3
sampler2DBase< glm::uvec4 > usampler2D
Definition: sampler.hpp:96
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844