• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 120
2/*
3 * 8.1 - Angle and Trigonometry Functions
4 */
5float radians(float degrees);
6vec2  radians(vec2  degrees);
7vec3  radians(vec3  degrees);
8vec4  radians(vec4  degrees);
9
10float degrees(float radians);
11vec2  degrees(vec2  radians);
12vec3  degrees(vec3  radians);
13vec4  degrees(vec4  radians);
14
15float sin(float angle);
16vec2  sin(vec2  angle);
17vec3  sin(vec3  angle);
18vec4  sin(vec4  angle);
19
20float cos(float angle);
21vec2  cos(vec2  angle);
22vec3  cos(vec3  angle);
23vec4  cos(vec4  angle);
24
25float tan(float angle);
26vec2  tan(vec2  angle);
27vec3  tan(vec3  angle);
28vec4  tan(vec4  angle);
29
30float asin(float angle);
31vec2  asin(vec2  angle);
32vec3  asin(vec3  angle);
33vec4  asin(vec4  angle);
34
35float acos(float angle);
36vec2  acos(vec2  angle);
37vec3  acos(vec3  angle);
38vec4  acos(vec4  angle);
39
40float atan(float y, float x);
41vec2  atan(vec2  y, vec2  x);
42vec3  atan(vec3  y, vec3  x);
43vec4  atan(vec4  y, vec4  x);
44
45float atan(float y_over_x);
46vec2  atan(vec2  y_over_x);
47vec3  atan(vec3  y_over_x);
48vec4  atan(vec4  y_over_x);
49
50/*
51 * 8.2 - Exponential Functions
52 */
53float pow(float x, float y);
54vec2  pow(vec2  x, vec2  y);
55vec3  pow(vec3  x, vec3  y);
56vec4  pow(vec4  x, vec4  y);
57
58float exp(float x);
59vec2  exp(vec2  x);
60vec3  exp(vec3  x);
61vec4  exp(vec4  x);
62
63float log(float x);
64vec2  log(vec2  x);
65vec3  log(vec3  x);
66vec4  log(vec4  x);
67
68float exp2(float x);
69vec2  exp2(vec2  x);
70vec3  exp2(vec3  x);
71vec4  exp2(vec4  x);
72
73float log2(float x);
74vec2  log2(vec2  x);
75vec3  log2(vec3  x);
76vec4  log2(vec4  x);
77
78float sqrt(float x);
79vec2  sqrt(vec2  x);
80vec3  sqrt(vec3  x);
81vec4  sqrt(vec4  x);
82
83float inversesqrt(float x);
84vec2  inversesqrt(vec2  x);
85vec3  inversesqrt(vec3  x);
86vec4  inversesqrt(vec4  x);
87
88/*
89 * 8.3 - Common Functions
90 */
91float abs(float x);
92vec2  abs(vec2  x);
93vec3  abs(vec3  x);
94vec4  abs(vec4  x);
95
96float sign(float x);
97vec2  sign(vec2  x);
98vec3  sign(vec3  x);
99vec4  sign(vec4  x);
100
101float floor(float x);
102vec2  floor(vec2  x);
103vec3  floor(vec3  x);
104vec4  floor(vec4  x);
105
106float ceil(float x);
107vec2  ceil(vec2  x);
108vec3  ceil(vec3  x);
109vec4  ceil(vec4  x);
110
111float fract(float x);
112vec2  fract(vec2  x);
113vec3  fract(vec3  x);
114vec4  fract(vec4  x);
115
116float mod(float x, float y);
117vec2  mod(vec2  x, float y);
118vec3  mod(vec3  x, float y);
119vec4  mod(vec4  x, float y);
120
121vec2  mod(vec2  x, vec2  y);
122vec3  mod(vec3  x, vec3  y);
123vec4  mod(vec4  x, vec4  y);
124
125float min(float x, float y);
126vec2  min(vec2  x, vec2  y);
127vec3  min(vec3  x, vec3  y);
128vec4  min(vec4  x, vec4  y);
129
130vec2  min(vec2  x, float y);
131vec3  min(vec3  x, float y);
132vec4  min(vec4  x, float y);
133
134float max(float x, float y);
135vec2  max(vec2  x, vec2  y);
136vec3  max(vec3  x, vec3  y);
137vec4  max(vec4  x, vec4  y);
138
139vec2  max(vec2  x, float y);
140vec3  max(vec3  x, float y);
141vec4  max(vec4  x, float y);
142
143float clamp(float x, float minVal, float maxVal);
144vec2  clamp(vec2  x, vec2  minVal, vec2  maxVal);
145vec3  clamp(vec3  x, vec3  minVal, vec3  maxVal);
146vec4  clamp(vec4  x, vec4  minVal, vec4  maxVal);
147
148vec2  clamp(vec2  x, float minVal, float maxVal);
149vec3  clamp(vec3  x, float minVal, float maxVal);
150vec4  clamp(vec4  x, float minVal, float maxVal);
151
152float mix(float x, float y, float a);
153vec2  mix(vec2  x, vec2  y, vec2  a);
154vec3  mix(vec3  x, vec3  y, vec3  a);
155vec4  mix(vec4  x, vec4  y, vec4  a);
156
157vec2  mix(vec2  x, vec2  y, float a);
158vec3  mix(vec3  x, vec3  y, float a);
159vec4  mix(vec4  x, vec4  y, float a);
160
161float step(float edge, float x);
162vec2  step(vec2  edge, vec2  x);
163vec3  step(vec3  edge, vec3  x);
164vec4  step(vec4  edge, vec4  x);
165
166vec2  step(float edge, vec2  x);
167vec3  step(float edge, vec3  x);
168vec4  step(float edge, vec4  x);
169
170float smoothstep(float edge0, float edge1, float x);
171vec2  smoothstep(vec2  edge0, vec2  edge1, vec2  x);
172vec3  smoothstep(vec3  edge0, vec3  edge1, vec3  x);
173vec4  smoothstep(vec4  edge0, vec4  edge1, vec4  x);
174
175vec2  smoothstep(float edge0, float edge1, vec2  x);
176vec3  smoothstep(float edge0, float edge1, vec3  x);
177vec4  smoothstep(float edge0, float edge1, vec4  x);
178
179/*
180 * 8.4 - Geometric Functions
181 */
182float length(float x);
183float length(vec2  x);
184float length(vec3  x);
185float length(vec4  x);
186
187float distance(float p0, float p1);
188float distance(vec2  p0, vec2  p1);
189float distance(vec3  p0, vec3  p1);
190float distance(vec4  p0, vec4  p1);
191
192float dot(float x, float y);
193float dot(vec2  x, vec2  y);
194float dot(vec3  x, vec3  y);
195float dot(vec4  x, vec4  y);
196
197vec3 cross(vec3 x, vec3 y);
198
199float normalize(float x);
200vec2  normalize(vec2  x);
201vec3  normalize(vec3  x);
202vec4  normalize(vec4  x);
203
204vec4 ftransform();
205
206float faceforward(float N, float I, float Nref);
207vec2  faceforward(vec2  N, vec2  I, vec2  Nref);
208vec3  faceforward(vec3  N, vec3  I, vec3  Nref);
209vec4  faceforward(vec4  N, vec4  I, vec4  Nref);
210
211float reflect(float I, float N);
212vec2  reflect(vec2  I, vec2  N);
213vec3  reflect(vec3  I, vec3  N);
214vec4  reflect(vec4  I, vec4  N);
215
216float refract(float I, float N, float eta);
217vec2  refract(vec2  I, vec2  N, float eta);
218vec3  refract(vec3  I, vec3  N, float eta);
219vec4  refract(vec4  I, vec4  N, float eta);
220
221
222/*
223 * 8.5 - Matrix Functions
224 */
225mat2   matrixCompMult(mat2   x, mat2   y);
226mat3   matrixCompMult(mat3   x, mat3   y);
227mat4   matrixCompMult(mat4   x, mat4   y);
228mat2x3 matrixCompMult(mat2x3 x, mat2x3 y);
229mat2x4 matrixCompMult(mat2x4 x, mat2x4 y);
230mat3x2 matrixCompMult(mat3x2 x, mat3x2 y);
231mat3x4 matrixCompMult(mat3x4 x, mat3x4 y);
232mat4x2 matrixCompMult(mat4x2 x, mat4x2 y);
233mat4x3 matrixCompMult(mat4x3 x, mat4x3 y);
234
235mat2   outerProduct(vec2 c, vec2 r);
236mat3   outerProduct(vec3 c, vec3 r);
237mat4   outerProduct(vec4 c, vec4 r);
238
239mat2x3 outerProduct(vec3 c, vec2 r);
240mat3x2 outerProduct(vec2 c, vec3 r);
241
242mat2x4 outerProduct(vec4 c, vec2 r);
243mat4x2 outerProduct(vec2 c, vec4 r);
244
245mat3x4 outerProduct(vec4 c, vec3 r);
246mat4x3 outerProduct(vec3 c, vec4 r);
247
248mat2   transpose(mat2 m);
249mat3   transpose(mat3 m);
250mat4   transpose(mat4 m);
251
252mat2x3 transpose(mat3x2 m);
253mat3x2 transpose(mat2x3 m);
254
255mat2x4 transpose(mat4x2 m);
256mat4x2 transpose(mat2x4 m);
257
258mat3x4 transpose(mat4x3 m);
259mat4x3 transpose(mat3x4 m);
260
261/*
262 * 8.6 - Vector Relational Functions
263 */
264bvec2 lessThan( vec2 x,  vec2 y);
265bvec3 lessThan( vec3 x,  vec3 y);
266bvec4 lessThan( vec4 x,  vec4 y);
267bvec2 lessThan(ivec2 x, ivec2 y);
268bvec3 lessThan(ivec3 x, ivec3 y);
269bvec4 lessThan(ivec4 x, ivec4 y);
270
271bvec2 lessThanEqual( vec2 x,  vec2 y);
272bvec3 lessThanEqual( vec3 x,  vec3 y);
273bvec4 lessThanEqual( vec4 x,  vec4 y);
274bvec2 lessThanEqual(ivec2 x, ivec2 y);
275bvec3 lessThanEqual(ivec3 x, ivec3 y);
276bvec4 lessThanEqual(ivec4 x, ivec4 y);
277
278bvec2 greaterThan( vec2 x,  vec2 y);
279bvec3 greaterThan( vec3 x,  vec3 y);
280bvec4 greaterThan( vec4 x,  vec4 y);
281bvec2 greaterThan(ivec2 x, ivec2 y);
282bvec3 greaterThan(ivec3 x, ivec3 y);
283bvec4 greaterThan(ivec4 x, ivec4 y);
284
285bvec2 greaterThanEqual( vec2 x,  vec2 y);
286bvec3 greaterThanEqual( vec3 x,  vec3 y);
287bvec4 greaterThanEqual( vec4 x,  vec4 y);
288bvec2 greaterThanEqual(ivec2 x, ivec2 y);
289bvec3 greaterThanEqual(ivec3 x, ivec3 y);
290bvec4 greaterThanEqual(ivec4 x, ivec4 y);
291
292bvec2 equal( vec2 x,  vec2 y);
293bvec3 equal( vec3 x,  vec3 y);
294bvec4 equal( vec4 x,  vec4 y);
295bvec2 equal(ivec2 x, ivec2 y);
296bvec3 equal(ivec3 x, ivec3 y);
297bvec4 equal(ivec4 x, ivec4 y);
298bvec2 equal(bvec2 x, bvec2 y);
299bvec3 equal(bvec3 x, bvec3 y);
300bvec4 equal(bvec4 x, bvec4 y);
301
302bvec2 notEqual( vec2 x,  vec2 y);
303bvec3 notEqual( vec3 x,  vec3 y);
304bvec4 notEqual( vec4 x,  vec4 y);
305bvec2 notEqual(ivec2 x, ivec2 y);
306bvec3 notEqual(ivec3 x, ivec3 y);
307bvec4 notEqual(ivec4 x, ivec4 y);
308bvec2 notEqual(bvec2 x, bvec2 y);
309bvec3 notEqual(bvec3 x, bvec3 y);
310bvec4 notEqual(bvec4 x, bvec4 y);
311
312bool any(bvec2 x);
313bool any(bvec3 x);
314bool any(bvec4 x);
315
316bool all(bvec2 x);
317bool all(bvec3 x);
318bool all(bvec4 x);
319
320bvec2 not(bvec2 x);
321bvec3 not(bvec3 x);
322bvec4 not(bvec4 x);
323
324/*
325 * 8.7 - Texture Lookup Functions
326 */
327vec4 texture1D       (sampler1D sampler, float coord);
328vec4 texture1DProj   (sampler1D sampler, vec2  coord);
329vec4 texture1DProj   (sampler1D sampler, vec4  coord);
330vec4 texture1DLod    (sampler1D sampler, float coord, float lod);
331vec4 texture1DProjLod(sampler1D sampler, vec2  coord, float lod);
332vec4 texture1DProjLod(sampler1D sampler, vec4  coord, float lod);
333
334vec4 texture2D       (sampler2D sampler, vec2 coord);
335vec4 texture2DProj   (sampler2D sampler, vec3 coord);
336vec4 texture2DProj   (sampler2D sampler, vec4 coord);
337vec4 texture2DLod    (sampler2D sampler, vec2 coord, float lod);
338vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
339vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
340
341vec4 texture3D       (sampler3D sampler, vec3 coord);
342vec4 texture3DProj   (sampler3D sampler, vec4 coord);
343vec4 texture3DLod    (sampler3D sampler, vec3 coord, float lod);
344vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
345
346vec4 textureCube     (samplerCube sampler, vec3 coord);
347vec4 textureCubeLod  (samplerCube sampler, vec3 coord, float lod);
348
349vec4 shadow1D       (sampler1DShadow sampler, vec3 coord);
350vec4 shadow2D       (sampler2DShadow sampler, vec3 coord);
351vec4 shadow1DProj   (sampler1DShadow sampler, vec4 coord);
352vec4 shadow2DProj   (sampler2DShadow sampler, vec4 coord);
353vec4 shadow1DLod    (sampler1DShadow sampler, vec3 coord, float lod);
354vec4 shadow2DLod    (sampler2DShadow sampler, vec3 coord, float lod);
355vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
356vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
357
358/*
359 * 8.8 - Fragment Processing Functions (none in vertex shader)
360 */
361
362/*
363 * 8.9 - Noise Functions
364 */
365float noise1(float x);
366float noise1(vec2  x);
367float noise1(vec3  x);
368float noise1(vec4  x);
369
370vec2  noise2(float x);
371vec2  noise2(vec2  x);
372vec2  noise2(vec3  x);
373vec2  noise2(vec4  x);
374
375vec3  noise3(float x);
376vec3  noise3(vec2  x);
377vec3  noise3(vec3  x);
378vec3  noise3(vec4  x);
379
380vec4  noise4(float x);
381vec4  noise4(vec2  x);
382vec4  noise4(vec3  x);
383vec4  noise4(vec4  x);
384