RetroArch
bokeh_sm4.hlsl.h
Go to the documentation of this file.
1 
2 #define SRC(...) #__VA_ARGS__
3 SRC(
4 struct UBO
5 {
6  float4x4 modelViewProj;
7  float2 OutputSize;
8  float time;
9 };
10 uniform UBO global;
11 
12 float4 VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0) : SV_POSITION
13 {
14  return mul(global.modelViewProj, position);
15 }
16 
17 float4 PSMain(float4 position : SV_POSITION) : SV_TARGET
18 {
19  float speed = global.time * 4.0;
20  float2 uv = -1.0 + 2.0 * position.xy / global.OutputSize;
21  uv.x *= global.OutputSize.x / global.OutputSize.y;
22  float3 color = float3(0.0, 0.0, 0.0);
23 
24  for( int i=0; i < 8; i++ )
25  {
26  float pha = sin(float(i) * 546.13 + 1.0) * 0.5 + 0.5;
27  float siz = pow(sin(float(i) * 651.74 + 5.0) * 0.5 + 0.5, 4.0);
28  float pox = sin(float(i) * 321.55 + 4.1) * global.OutputSize.x / global.OutputSize.y;
29  float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0;
30  float2 pos = float2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * frac(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz)));
31  float dis = length(uv - pos);
32  if(dis < rad)
33  {
34  float3 col = lerp(float3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), float3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i)));
35  color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis));
36  }
37  }
38  color *= sqrt(1.5 - 0.5 * length(uv));
39  return float4(color.r, color.g, color.b , 0.5);
40 };
41 )
#define sqrt(x)
Definition: math.h:26
#define SRC(...)
Definition: bokeh_sm4.hlsl.h:2
time_t time(time_t *timer)
#define sin(x)
Definition: math.h:23
#define pow(x, y)
Definition: math.h:22
u32 col
Definition: gx_regdef.h:5093
GLuint color
Definition: glext.h:6883
Definition: retroarch.h:240
GLenum GLuint GLenum GLsizei length
Definition: glext.h:6233