Debian Codegraph @

third_party/spirv-cross/reference/opt/shaders/vert/ocean.vert

raw
1 #version 310 es
2 #ifdef GL_ARB_shader_draw_parameters
3 #extension GL_ARB_shader_draw_parameters : enable
4 #endif
5
6 struct PatchData
7 {
8 vec4 Position;
9 vec4 LODs;
10 };
11
12 layout(binding = 0, std140) uniform Offsets
13 {
14 PatchData Patches[256];
15 } _53;
16
17 layout(binding = 4, std140) uniform GlobalOcean
18 {
19 vec4 OceanScale;
20 vec4 OceanPosition;
21 vec4 InvOceanSize_PatchScale;
22 vec4 NormalTexCoordScale;
23 } _180;
24
25 layout(binding = 0, std140) uniform GlobalVSData
26 {
27 vec4 g_ViewProj_Row0;
28 vec4 g_ViewProj_Row1;
29 vec4 g_ViewProj_Row2;
30 vec4 g_ViewProj_Row3;
31 vec4 g_CamPos;
32 vec4 g_CamRight;
33 vec4 g_CamUp;
34 vec4 g_CamFront;
35 vec4 g_SunDir;
36 vec4 g_SunColor;
37 vec4 g_TimeParams;
38 vec4 g_ResolutionParams;
39 vec4 g_CamAxisRight;
40 vec4 g_FogColor_Distance;
41 vec4 g_ShadowVP_Row0;
42 vec4 g_ShadowVP_Row1;
43 vec4 g_ShadowVP_Row2;
44 vec4 g_ShadowVP_Row3;
45 } _273;
46
47 layout(binding = 1) uniform mediump sampler2D TexLOD;
48 layout(binding = 0) uniform mediump sampler2D TexDisplacement;
49
50 layout(location = 1) in vec4 LODWeights;
51 #ifdef GL_ARB_shader_draw_parameters
52 #define SPIRV_Cross_BaseInstance gl_BaseInstanceARB
53 #else
54 uniform int SPIRV_Cross_BaseInstance;
55 #endif
56 layout(location = 0) in vec4 Position;
57 layout(location = 0) out vec3 EyeVec;
58 layout(location = 1) out vec4 TexCoord;
59
60 uvec4 _476;
61
62 void main()
63 {
64 float _351 = all(equal(LODWeights, vec4(0.0))) ? _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w : dot(LODWeights, _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs);
65 float _353 = floor(_351);
66 uint _358 = uint(_353);
67 uvec4 _360 = uvec4(Position);
68 uvec2 _367 = (uvec2(1u) << uvec2(_358, _358 + 1u)) - uvec2(1u);
69 bool _370 = _360.x < 32u;
70 uint _467;
71 if (_370)
72 {
73 _467 = _367.x;
74 }
75 else
76 {
77 _467 = 0u;
78 }
79 uvec4 _445 = _476;
80 _445.x = _467;
81 bool _380 = _360.y < 32u;
82 uint _470;
83 if (_380)
84 {
85 _470 = _367.x;
86 }
87 else
88 {
89 _470 = 0u;
90 }
91 uvec4 _449 = _445;
92 _449.y = _470;
93 uint _472;
94 if (_370)
95 {
96 _472 = _367.y;
97 }
98 else
99 {
100 _472 = 0u;
101 }
102 uvec4 _453 = _449;
103 _453.z = _472;
104 uint _474;
105 if (_380)
106 {
107 _474 = _367.y;
108 }
109 else
110 {
111 _474 = 0u;
112 }
113 uvec4 _457 = _453;
114 _457.w = _474;
115 vec4 _416 = vec4((_360.xyxy + _457) & (~_367).xxyy);
116 vec2 _197 = ((_53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.xz * _180.InvOceanSize_PatchScale.zw) + mix(_416.xy, _416.zw, vec2(_351 - _353))) * _180.InvOceanSize_PatchScale.xy;
117 vec2 _204 = _197 * _180.NormalTexCoordScale.zw;
118 mediump float _433 = textureLod(TexLOD, _197, 0.0).x * 7.96875;
119 float _435 = floor(_433);
120 vec2 _220 = (_180.InvOceanSize_PatchScale.xy * exp2(_435)) * _180.NormalTexCoordScale.zw;
121 vec3 _267 = ((vec3(_197.x, 0.0, _197.y) + mix(textureLod(TexDisplacement, _204 + (_220 * 0.5), _435).yxz, textureLod(TexDisplacement, _204 + (_220 * 1.0), _435 + 1.0).yxz, vec3(_433 - _435))) * _180.OceanScale.xyz) + _180.OceanPosition.xyz;
122 EyeVec = _267 - _273.g_CamPos.xyz;
123 TexCoord = vec4(_204, _204 * _180.NormalTexCoordScale.xy) + ((_180.InvOceanSize_PatchScale.xyxy * 0.5) * _180.NormalTexCoordScale.zwzw);
124 gl_Position = (((_273.g_ViewProj_Row0 * _267.x) + (_273.g_ViewProj_Row1 * _267.y)) + (_273.g_ViewProj_Row2 * _267.z)) + _273.g_ViewProj_Row3;
125 }
126