summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/library/slang_common_builtin.gc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/slang/library/slang_common_builtin.gc')
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_common_builtin.gc957
1 files changed, 386 insertions, 571 deletions
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index c7c27419a9..4d82d54c14 100755
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -1,7 +1,7 @@
//
// TODO:
-// - implement texture1D, texture2D, texture3D, textureCube,
+// - implement texture1D, texture3D, textureCube,
// - implement shadow1D, shadow2D,
//
@@ -181,27 +181,27 @@ float sin (float angle) {
}
vec2 sin (vec2 angle) {
- vec2 u;
- u.x = sin (angle.x);
- u.y = sin (angle.y);
- return u;
+ return vec2 (
+ sin (angle.x),
+ sin (angle.y)
+ );
}
vec3 sin (vec3 angle) {
- vec3 u;
- u.x = sin (angle.x);
- u.y = sin (angle.y);
- u.z = sin (angle.z);
- return u;
+ return vec3 (
+ sin (angle.x),
+ sin (angle.y),
+ sin (angle.z)
+ );
}
vec4 sin (vec4 angle) {
- vec4 u;
- u.x = sin (angle.x);
- u.y = sin (angle.y);
- u.z = sin (angle.z);
- u.w = sin (angle.w);
- return u;
+ return vec4 (
+ sin (angle.x),
+ sin (angle.y),
+ sin (angle.z),
+ sin (angle.w)
+ );
}
float cos (float angle) {
@@ -209,27 +209,27 @@ float cos (float angle) {
}
vec2 cos (vec2 angle) {
- vec2 u;
- u.x = cos (angle.x);
- u.y = cos (angle.y);
- return u;
+ return vec2 (
+ cos (angle.x),
+ cos (angle.y)
+ );
}
vec3 cos (vec3 angle) {
- vec3 u;
- u.x = cos (angle.x);
- u.y = cos (angle.y);
- u.z = cos (angle.z);
- return u;
+ return vec2 (
+ cos (angle.x),
+ cos (angle.y),
+ cos (angle.z)
+ );
}
vec4 cos (vec4 angle) {
- vec4 u;
- u.x = cos (angle.x);
- u.y = cos (angle.y);
- u.z = cos (angle.z);
- u.w = cos (angle.w);
- return u;
+ return vec4 (
+ cos (angle.x),
+ cos (angle.y),
+ cos (angle.z),
+ cos (angle.w)
+ );
}
float tan (float angle) {
@@ -237,27 +237,27 @@ float tan (float angle) {
}
vec2 tan (vec2 angle) {
- vec2 u;
- u.x = tan (angle.x);
- u.y = tan (angle.y);
- return u;
+ return vec2 (
+ tan (angle.x),
+ tan (angle.y)
+ );
}
vec3 tan (vec3 angle) {
- vec3 u;
- u.x = tan (angle.x);
- u.y = tan (angle.y);
- u.z = tan (angle.z);
- return u;
+ return vec3 (
+ tan (angle.x),
+ tan (angle.y),
+ tan (angle.z)
+ );
}
vec4 tan (vec4 angle) {
- vec4 u;
- u.x = tan (angle.x);
- u.y = tan (angle.y);
- u.z = tan (angle.z);
- u.w = tan (angle.w);
- return u;
+ return vec4 (
+ tan (angle.x),
+ tan (angle.y),
+ tan (angle.z),
+ tan (angle.w)
+ );
}
float asin (float x) {
@@ -267,27 +267,27 @@ float asin (float x) {
}
vec2 asin (vec2 v) {
- vec2 u;
- u.x = asin (v.x);
- u.y = asin (v.y);
- return u;
+ return vec2 (
+ asin (v.x),
+ asin (v.y)
+ );
}
vec3 asin (vec3 v) {
- vec3 u;
- u.x = asin (v.x);
- u.y = asin (v.y);
- u.z = asin (v.z);
- return u;
+ return vec3 (
+ asin (v.x),
+ asin (v.y),
+ asin (v.z)
+ );
}
vec4 asin (vec4 v) {
- vec4 u;
- u.x = asin (v.x);
- u.y = asin (v.y);
- u.z = asin (v.z);
- u.w = asin (v.w);
- return u;
+ return vec4 (
+ asin (v.x),
+ asin (v.y),
+ asin (v.z),
+ asin (v.w)
+ );
}
float acos (float x) {
@@ -295,27 +295,27 @@ float acos (float x) {
}
vec2 acos (vec2 v) {
- vec2 u;
- u.x = acos (v.x);
- u.y = acos (v.y);
- return u;
+ return vec2 (
+ acos (v.x),
+ acos (v.y)
+ );
}
vec3 acos (vec3 v) {
- vec3 u;
- u.x = acos (v.x);
- u.y = acos (v.y);
- u.z = acos (v.z);
- return u;
+ return vec3 (
+ acos (v.x),
+ acos (v.y),
+ acos (v.z)
+ );
}
vec4 acos (vec4 v) {
- vec4 u;
- u.x = acos (v.x);
- u.y = acos (v.y);
- u.z = acos (v.z);
- u.w = acos (v.w);
- return u;
+ return vec4 (
+ acos (v.x),
+ acos (v.y),
+ acos (v.z),
+ acos (v.w)
+ );
}
float atan (float y_over_x) {
@@ -325,27 +325,27 @@ float atan (float y_over_x) {
}
vec2 atan (vec2 y_over_x) {
- vec2 u;
- u.x = atan (y_over_x.x);
- u.y = atan (y_over_x.y);
- return u;
+ return vec2 (
+ atan (y_over_x.x),
+ atan (y_over_x.y)
+ );
}
vec3 atan (vec3 y_over_x) {
- vec3 u;
- u.x = atan (y_over_x.x);
- u.y = atan (y_over_x.y);
- u.z = atan (y_over_x.z);
- return u;
+ return vec3 (
+ atan (y_over_x.x),
+ atan (y_over_x.y),
+ atan (y_over_x.z)
+ );
}
vec4 atan (vec4 y_over_x) {
- vec4 u;
- u.x = atan (y_over_x.x);
- u.y = atan (y_over_x.y);
- u.z = atan (y_over_x.z);
- u.w = atan (y_over_x.w);
- return u;
+ return vec4 (
+ atan (y_over_x.x),
+ atan (y_over_x.y),
+ atan (y_over_x.z),
+ atan (y_over_x.w)
+ );
}
float atan (float y, float x) {
@@ -361,27 +361,27 @@ float atan (float y, float x) {
}
vec2 atan (vec2 u, vec2 v) {
- vec2 t;
- t.x = atan (u.x, v.x);
- t.y = atan (u.y, v.y);
- return t;
+ return vec2 (
+ atan (u.x, v.x),
+ atan (u.y, v.y)
+ );
}
vec3 atan (vec3 u, vec3 v) {
- vec3 t;
- t.x = atan (u.x, v.x);
- t.y = atan (u.y, v.y);
- t.z = atan (u.z, v.z);
- return t;
+ return vec3 (
+ atan (u.x, v.x),
+ atan (u.y, v.y),
+ atan (u.z, v.z)
+ );
}
vec4 atan (vec4 u, vec4 v) {
- vec4 t;
- t.x = atan (u.x, v.x);
- t.y = atan (u.y, v.y);
- t.z = atan (u.z, v.z);
- t.w = atan (u.w, v.w);
- return t;
+ return vec4 (
+ atan (u.x, v.x),
+ atan (u.y, v.y),
+ atan (u.z, v.z),
+ atan (u.w, v.w)
+ );
}
//
@@ -395,27 +395,27 @@ float pow (float x, float y) {
}
vec2 pow (vec2 v, vec2 u) {
- vec2 t;
- t.x = pow (v.x, u.x);
- t.y = pow (v.y, u.y);
- return t;
+ return vec2 (
+ pow (v.x, u.x),
+ pow (v.y, u.y)
+ );
}
vec3 pow (vec3 v, vec3 u) {
- vec3 t;
- t.x = pow (v.x, u.x);
- t.y = pow (v.y, u.y);
- t.z = pow (v.z, u.z);
- return t;
+ return vec3 (
+ pow (v.x, u.x),
+ pow (v.y, u.y),
+ pow (v.z, u.z)
+ );
}
vec4 pow (vec4 v, vec4 u) {
- vec4 t;
- t.x = pow (v.x, u.x);
- t.y = pow (v.y, u.y);
- t.z = pow (v.z, u.z);
- t.w = pow (v.w, u.w);
- return t;
+ return vec4 (
+ pow (v.x, u.x),
+ pow (v.y, u.y),
+ pow (v.z, u.z),
+ pow (v.w, u.w)
+ );
}
float exp (float x) {
@@ -441,27 +441,27 @@ float log2 (float x) {
}
vec2 log2 (vec2 v) {
- vec2 u;
- u.x = log2 (v.x);
- u.y = log2 (v.y);
- return u;
+ return vec2 (
+ log2 (v.x),
+ log2 (v.y)
+ );
}
vec3 log2 (vec3 v) {
- vec3 u;
- u.x = log2 (v.x);
- u.y = log2 (v.y);
- u.z = log2 (v.z);
- return u;
+ return vec3 (
+ log2 (v.x),
+ log2 (v.y),
+ log2 (v.z)
+ );
}
vec4 log2 (vec4 v) {
- vec4 u;
- u.x = log2 (v.x);
- u.y = log2 (v.y);
- u.z = log2 (v.z);
- u.w = log2 (v.w);
- return u;
+ return vec4 (
+ log2 (v.x),
+ log2 (v.y),
+ log2 (v.z),
+ log2 (v.w)
+ );
}
float log (float x) {
@@ -537,27 +537,27 @@ float abs (float x) {
}
vec2 abs (vec2 v) {
- vec2 u;
- u.x = abs (v.x);
- u.y = abs (v.y);
- return u;
+ return vec2 (
+ abs (v.x),
+ abs (v.y)
+ );
}
vec3 abs (vec3 v) {
- vec3 u;
- u.x = abs (v.x);
- u.y = abs (v.y);
- u.z = abs (v.z);
- return u;
+ return vec3 (
+ abs (v.x),
+ abs (v.y),
+ abs (v.z)
+ );
}
vec4 abs (vec4 v) {
- vec4 u;
- u.x = abs (v.x);
- u.y = abs (v.y);
- u.z = abs (v.z);
- u.w = abs (v.w);
- return u;
+ return vec4 (
+ abs (v.x),
+ abs (v.y),
+ abs (v.z),
+ abs (v.w)
+ );
}
float sign (float x) {
@@ -565,27 +565,27 @@ float sign (float x) {
}
vec2 sign (vec2 v) {
- vec2 u;
- u.x = sign (v.x);
- u.y = sign (v.y);
- return u;
+ return vec2 (
+ sign (v.x),
+ sign (v.y)
+ );
}
vec3 sign (vec3 v) {
- vec3 u;
- u.x = sign (v.x);
- u.y = sign (v.y);
- u.z = sign (v.z);
- return u;
+ return vec3 (
+ sign (v.x),
+ sign (v.y),
+ sign (v.z)
+ );
}
vec4 sign (vec4 v) {
- vec4 u;
- u.x = sign (v.x);
- u.y = sign (v.y);
- u.z = sign (v.z);
- u.w = sign (v.w);
- return u;
+ return vec4 (
+ sign (v.x),
+ sign (v.y),
+ sign (v.z),
+ sign (v.w)
+ );
}
float floor (float x) {
@@ -595,27 +595,27 @@ float floor (float x) {
}
vec2 floor (vec2 v) {
- vec2 u;
- u.x = floor (v.x);
- u.y = floor (v.y);
- return u;
+ return vec2 (
+ floor (v.x),
+ floor (v.y)
+ );
}
vec3 floor (vec3 v) {
- vec3 u;
- u.x = floor (v.x);
- u.y = floor (v.y);
- u.z = floor (v.z);
- return u;
+ return vec3 (
+ floor (v.x),
+ floor (v.y),
+ floor (v.z)
+ );
}
vec4 floor (vec4 v) {
- vec4 u;
- u.x = floor (v.x);
- u.y = floor (v.y);
- u.z = floor (v.z);
- u.w = floor (v.w);
- return u;
+ return vec4 (
+ floor (v.x),
+ floor (v.y),
+ floor (v.z),
+ floor (v.w)
+ );
}
float ceil (float x) {
@@ -625,27 +625,27 @@ float ceil (float x) {
}
vec2 ceil (vec2 v) {
- vec2 u;
- u.x = ceil (v.x);
- u.y = ceil (v.y);
- return u;
+ return vec2 (
+ ceil (v.x),
+ ceil (v.y)
+ );
}
vec3 ceil (vec3 v) {
- vec3 u;
- u.x = ceil (v.x);
- u.y = ceil (v.y);
- u.z = ceil (v.z);
- return u;
+ return vec3 (
+ ceil (v.x),
+ ceil (v.y),
+ ceil (v.z)
+ );
}
vec4 ceil (vec4 v) {
- vec4 u;
- u.x = ceil (v.x);
- u.y = ceil (v.y);
- u.z = ceil (v.z);
- u.w = ceil (v.w);
- return u;
+ return vec4 (
+ ceil (v.x),
+ ceil (v.y),
+ ceil (v.z),
+ ceil (v.w)
+ );
}
float fract (float x) {
@@ -697,27 +697,27 @@ float min (float x, float y) {
}
vec2 min (vec2 v, vec2 u) {
- vec2 t;
- t.x = min (v.x, u.x);
- t.y = min (v.y, u.y);
- return t;
+ return vec2 (
+ min (v.x, u.x),
+ min (v.y, u.y)
+ );
}
vec3 min (vec3 v, vec3 u) {
- vec3 t;
- t.x = min (v.x, u.x);
- t.y = min (v.y, u.y);
- t.z = min (v.z, u.z);
- return t;
+ return vec2 (
+ min (v.x, u.x),
+ min (v.y, u.y),
+ min (v.z, u.z)
+ );
}
vec4 min (vec4 v, vec4 u) {
- vec4 t;
- t.x = min (v.x, u.x);
- t.y = min (v.y, u.y);
- t.z = min (v.z, u.z);
- t.w = min (v.w, u.w);
- return t;
+ return vec4 (
+ min (v.x, u.x),
+ min (v.y, u.y),
+ min (v.z, u.z),
+ min (v.w, u.w)
+ );
}
vec2 min (vec2 v, float y) {
@@ -737,27 +737,27 @@ float max (float x, float y) {
}
vec2 max (vec2 v, vec2 u) {
- vec2 t;
- t.x = max (v.x, u.x);
- t.y = max (v.y, u.y);
- return t;
+ return vec2 (
+ max (v.x, u.x),
+ max (v.y, u.y)
+ );
}
vec3 max (vec3 v, vec3 u) {
- vec3 t;
- t.x = max (v.x, u.x);
- t.y = max (v.y, u.y);
- t.z = max (v.z, u.z);
- return t;
+ return vec3 (
+ max (v.x, u.x),
+ max (v.y, u.y),
+ max (v.z, u.z)
+ );
}
vec4 max (vec4 v, vec4 u) {
- vec4 t;
- t.x = max (v.x, u.x);
- t.y = max (v.y, u.y);
- t.z = max (v.z, u.z);
- t.w = max (v.w, u.w);
- return t;
+ return vec4 (
+ max (v.x, u.x),
+ max (v.y, u.y),
+ max (v.z, u.z),
+ max (v.w, u.w)
+ );
}
vec2 max (vec2 v, float y) {
@@ -833,27 +833,27 @@ float step (float edge, float x) {
}
vec2 step (vec2 edge, vec2 v) {
- vec2 u;
- u.x = step (edge.x, v.x);
- u.y = step (edge.y, v.y);
- return u;
+ return vec2 (
+ step (edge.x, v.x),
+ step (edge.y, v.y)
+ );
}
vec3 step (vec3 edge, vec3 v) {
- vec3 u;
- u.x = step (edge.x, v.x);
- u.y = step (edge.y, v.y);
- u.z = step (edge.z, v.z);
- return u;
+ return vec3 (
+ step (edge.x, v.x),
+ step (edge.y, v.y),
+ step (edge.z, v.z)
+ );
}
vec4 step (vec4 edge, vec4 v) {
- vec4 u;
- u.x = step (edge.x, v.x);
- u.y = step (edge.y, v.y);
- u.z = step (edge.z, v.z);
- u.w = step (edge.w, v.w);
- return u;
+ return vec4 (
+ step (edge.x, v.x),
+ step (edge.y, v.y),
+ step (edge.z, v.z),
+ step (edge.w, v.w)
+ );
}
vec2 step (float edge, vec2 v) {
@@ -875,51 +875,51 @@ float smoothstep (float edge0, float edge1, float x) {
}
vec2 smoothstep (vec2 edge0, vec2 edge1, vec2 v) {
- vec2 u;
- u.x = smoothstep (edge0.x, edge1.x, v.x);
- u.y = smoothstep (edge0.y, edge1.y, v.y);
- return u;
+ return vec2 (
+ smoothstep (edge0.x, edge1.x, v.x),
+ smoothstep (edge0.y, edge1.y, v.y)
+ );
}
vec3 smoothstep (vec3 edge0, vec3 edge1, vec3 v) {
- vec3 u;
- u.x = smoothstep (edge0.x, edge1.x, v.x);
- u.y = smoothstep (edge0.y, edge1.y, v.y);
- u.z = smoothstep (edge0.z, edge1.z, v.z);
- return u;
+ return vec3 (
+ smoothstep (edge0.x, edge1.x, v.x),
+ smoothstep (edge0.y, edge1.y, v.y),
+ smoothstep (edge0.z, edge1.z, v.z)
+ );
}
vec4 smoothstep (vec4 edge0, vec4 edge1, vec4 v) {
- vec4 u;
- u.x = smoothstep (edge0.x, edge1.x, v.x);
- u.y = smoothstep (edge0.y, edge1.y, v.y);
- u.z = smoothstep (edge0.z, edge1.z, v.z);
- u.w = smoothstep (edge0.w, edge1.w, v.w);
- return u;
+ return vec4 (
+ smoothstep (edge0.x, edge1.x, v.x),
+ smoothstep (edge0.y, edge1.y, v.y),
+ smoothstep (edge0.z, edge1.z, v.z),
+ smoothstep (edge0.w, edge1.w, v.w)
+ );
}
vec2 smoothstep (float edge0, float edge1, vec2 v) {
- vec2 u;
- u.x = smoothstep (edge0, edge1, v.x);
- u.y = smoothstep (edge0, edge1, v.y);
- return u;
+ return vec2 (
+ smoothstep (edge0, edge1, v.x),
+ smoothstep (edge0, edge1, v.y)
+ );
}
vec3 smoothstep (float edge0, float edge1, vec3 v) {
- vec3 u;
- u.x = smoothstep (edge0, edge1, v.x);
- u.y = smoothstep (edge0, edge1, v.y);
- u.z = smoothstep (edge0, edge1, v.z);
- return u;
+ return vec3 (
+ smoothstep (edge0, edge1, v.x),
+ smoothstep (edge0, edge1, v.y),
+ smoothstep (edge0, edge1, v.z)
+ );
}
vec4 smoothstep (float edge0, float edge1, vec4 v) {
- vec4 u;
- u.x = smoothstep (edge0, edge1, v.x);
- u.y = smoothstep (edge0, edge1, v.y);
- u.z = smoothstep (edge0, edge1, v.z);
- u.w = smoothstep (edge0, edge1, v.w);
- return u;
+ return vec4 (
+ smoothstep (edge0, edge1, v.x),
+ smoothstep (edge0, edge1, v.y),
+ smoothstep (edge0, edge1, v.z),
+ smoothstep (edge0, edge1, v.w)
+ );
}
//
@@ -975,11 +975,11 @@ float distance (vec4 v, vec4 u) {
}
vec3 cross (vec3 v, vec3 u) {
- vec3 t;
- t.x = v.y * u.z - u.y * v.z;
- t.y = v.z * u.x - u.z * v.x;
- t.z = v.x * u.y - u.x * v.y;
- return t;
+ return vec3 (
+ v.y * u.z - u.y * v.z,
+ v.z * u.x - u.z * v.x,
+ v.x * u.y - u.x * v.y
+ );
}
float normalize (float x) {
@@ -1067,27 +1067,15 @@ vec4 refract (vec4 I, vec4 N, float eta) {
//
mat2 matrixCompMult (mat2 m, mat2 n) {
- mat2 o;
- o[0] = m[0] * n[0];
- o[1] = m[1] * n[1];
- return o;
+ return mat2 (m[0] * n[0], m[1] * n[1]);
}
mat3 matrixCompMult (mat3 m, mat3 n) {
- mat3 o;
- o[0] = m[0] * n[0];
- o[1] = m[1] * n[1];
- o[2] = m[2] * n[2];
- return o;
+ return mat3 (m[0] * n[0], m[1] * n[1], m[2] * n[2]);
}
mat4 matrixCompMult (mat4 m, mat4 n) {
- mat4 o;
- o[0] = m[0] * n[0];
- o[1] = m[1] * n[1];
- o[2] = m[2] * n[2];
- o[3] = m[3] * n[3];
- return o;
+ return mat4 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]);
}
//
@@ -1095,291 +1083,147 @@ mat4 matrixCompMult (mat4 m, mat4 n) {
//
bvec2 lessThan (vec2 v, vec2 u) {
- bvec2 b;
- b.x = v.x < u.x;
- b.y = v.y < u.y;
- return b;
+ return bvec2 (v.x < u.x, v.y < u.y);
}
bvec3 lessThan (vec3 v, vec3 u) {
- bvec3 b;
- b.x = v.x < u.x;
- b.y = v.y < u.y;
- b.z = v.z < u.z;
- return b;
+ return bvec3 (v.x < u.x, v.y < u.y, v.z < u.z);
}
bvec4 lessThan (vec4 v, vec4 u) {
- bvec4 b;
- b.x = v.x < u.x;
- b.y = v.y < u.y;
- b.z = v.z < u.z;
- b.w = v.w < u.w;
- return b;
+ return bvec4 (v.x < u.x, v.y < u.y, v.z < u.z, v.w < u.w);
}
bvec2 lessThan (ivec2 v, ivec2 u) {
- bvec2 b;
- b.x = v.x < u.x;
- b.y = v.y < u.y;
- return b;
+ return bvec2 (v.x < u.x, v.y < u.y);
}
bvec3 lessThan (ivec3 v, ivec3 u) {
- bvec3 b;
- b.x = v.x < u.x;
- b.y = v.y < u.y;
- b.z = v.z < u.z;
- return b;
+ return bvec3 (v.x < u.x, v.y < u.y, v.z < u.z);
}
bvec4 lessThan (ivec4 v, ivec4 u) {
- bvec4 b;
- b.x = v.x < u.x;
- b.y = v.y < u.y;
- b.z = v.z < u.z;
- b.w = v.w < u.w;
- return b;
+ return bvec4 (v.x < u.x, v.y < u.y, v.z < u.z, v.w < u.w);
}
bvec2 lessThanEqual (vec2 v, vec2 u) {
- bvec2 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- return b;
+ return bvec2 (v.x <= u.x, v.y <= u.y);
}
bvec3 lessThanEqual (vec3 v, vec3 u) {
- bvec3 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- b.z = v.z <= u.z;
- return b;
+ return bvec3 (v.x <= u.x, v.y <= u.y, v.z <= u.z);
}
bvec4 lessThanEqual (vec4 v, vec4 u) {
- bvec4 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- b.z = v.z <= u.z;
- b.w = v.w <= u.w;
- return b;
+ return bvec4 (v.x <= u.x, v.y <= u.y, v.z <= u.z, v.w <= u.w);
}
bvec2 lessThanEqual (ivec2 v, ivec2 u) {
- bvec2 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- return b;
+ return bvec2 (v.x <= u.x, v.y <= u.y);
}
bvec3 lessThanEqual (ivec3 v, ivec3 u) {
- bvec3 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- b.z = v.z <= u.z;
- return b;
+ return bvec3 (v.x <= u.x, v.y <= u.y, v.z <= u.z);
}
bvec4 lessThanEqual (ivec4 v, ivec4 u) {
- bvec4 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- b.z = v.z <= u.z;
- b.w = v.w <= u.w;
- return b;
+ return bvec4 (v.x <= u.x, v.y <= u.y, v.z <= u.z, v.w <= u.w);
}
bvec2 greaterThan (vec2 v, vec2 u) {
- bvec2 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- return b;
+ return bvec2 (v.x > u.x, v.y > u.y);
}
bvec3 greaterThan (vec3 v, vec3 u) {
- bvec3 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- b.z = v.z > u.z;
- return b;
+ return bvec3 (v.x > u.x, v.y > u.y, v.z > u.z);
}
bvec4 greaterThan (vec4 v, vec4 u) {
- bvec4 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- b.z = v.z > u.z;
- b.w = v.w > u.w;
- return b;
+ return bvec4 (v.x > u.x, v.y > u.y, v.z > u.z, v.w > u.w);
}
bvec2 greaterThan (ivec2 v, ivec2 u) {
- bvec2 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- return b;
+ return bvec2 (v.x > u.x, v.y > u.y);
}
bvec3 greaterThan (ivec3 v, ivec3 u) {
- bvec3 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- b.z = v.z > u.z;
- return b;
+ return bvec3 (v.x > u.x, v.y > u.y, v.z > u.z);
}
bvec4 greaterThan (ivec4 v, ivec4 u) {
- bvec4 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- b.z = v.z > u.z;
- b.w = v.w > u.w;
- return b;
+ return bvec4 (v.x > u.x, v.y > u.y, v.z > u.z, v.w > u.w);
}
bvec2 greaterThanEqual (vec2 v, vec2 u) {
- bvec2 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- return b;
+ return bvec2 (v.x >= u.x, v.y >= u.y);
}
bvec3 greaterThanEqual (vec3 v, vec3 u) {
- bvec3 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- b.z = v.z >= u.z;
- return b;
+ return bvec3 (v.x >= u.x, v.y >= u.y, v.z >= u.z);
}
bvec4 greaterThanEqual (vec4 v, vec4 u) {
- bvec4 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- b.z = v.z >= u.z;
- b.w = v.w >= u.w;
- return b;
+ return bvec4 (v.x >= u.x, v.y >= u.y, v.z >= u.z, v.w >= u.w);
}
bvec2 greaterThanEqual (ivec2 v, ivec2 u) {
- bvec2 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- return b;
+ return bvec2 (v.x >= u.x, v.y >= u.y);
}
bvec3 greaterThanEqual (ivec3 v, ivec3 u) {
- bvec3 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- b.z = v.z >= u.z;
- return b;
+ return bvec3 (v.x >= u.x, v.y >= u.y, v.z >= u.z);
}
bvec4 greaterThanEqual (ivec4 v, ivec4 u) {
- bvec4 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- b.z = v.z >= u.z;
- b.w = v.w >= u.w;
- return b;
+ return bvec4 (v.x >= u.x, v.y >= u.y, v.z >= u.z, v.w >= u.w);
}
bvec2 equal (vec2 v, vec2 u) {
- bvec2 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- return b;
+ return bvec2 (v.x == u.x, v.y == u.y);
}
bvec3 equal (vec3 v, vec3 u) {
- bvec3 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- b.z = v.z == u.z;
- return b;
+ return bvec3 (v.x == u.x, v.y == u.y, v.z == u.z);
}
bvec4 equal (vec4 v, vec4 u) {
- bvec4 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- b.z = v.z == u.z;
- b.w = v.w == u.w;
- return b;
+ return bvec4 (v.x == u.x, v.y == u.y, v.z == u.z, v.w == u.w);
}
bvec2 equal (ivec2 v, ivec2 u) {
- bvec2 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- return b;
+ return bvec2 (v.x == u.x, v.y == u.y);
}
bvec3 equal (ivec3 v, ivec3 u) {
- bvec3 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- b.z = v.z == u.z;
- return b;
+ return bvec3 (v.x == u.x, v.y == u.y, v.z == u.z);
}
bvec4 equal (ivec4 v, ivec4 u) {
- bvec4 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- b.z = v.z == u.z;
- b.w = v.w == u.w;
- return b;
+ return bvec4 (v.x == u.x, v.y == u.y, v.z == u.z, v.w == u.w);
}
bvec2 notEqual (vec2 v, vec2 u) {
- bvec2 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- return b;
+ return bvec2 (v.x != u.x, v.y != u.y);
}
bvec3 notEqual (vec3 v, vec3 u) {
- bvec3 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- b.z = v.z != u.z;
- return b;
+ return bvec3 (v.x != u.x, v.y != u.y, v.z != u.z);
}
bvec4 notEqual (vec4 v, vec4 u) {
- bvec4 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- b.z = v.z != u.z;
- b.w = v.w != u.w;
- return b;
+ return bvec4 (v.x != u.x, v.y != u.y, v.z != u.z, v.w != u.w);
}
bvec2 notEqual (ivec2 v, ivec2 u) {
- bvec2 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- return b;
+ return bvec2 (v.x != u.x, v.y != u.y);
}
bvec3 notEqual (ivec3 v, ivec3 u) {
- bvec3 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- b.z = v.z != u.z;
- return b;
+ return bvec3 (v.x != u.x, v.y != u.y, v.z != u.z);
}
bvec4 notEqual (ivec4 v, ivec4 u) {
- bvec4 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- b.z = v.z != u.z;
- b.w = v.w != u.w;
- return b;
+ return bvec4 (v.x != u.x, v.y != u.y, v.z != u.z, v.w != u.w);
}
bool any (bvec2 v) {
@@ -1407,27 +1251,15 @@ bool all (bvec4 v) {
}
bvec2 not (bvec2 v) {
- bvec2 u;
- u.x = !v.x;
- u.y = !v.y;
- return u;
+ return bvec2 (!v.x, !v.y);
}
bvec3 not (bvec3 v) {
- bvec3 u;
- u.x = !v.x;
- u.y = !v.y;
- u.z = !v.z;
- return u;
+ return bvec3 (!v.x, !v.y, !v.z);
}
bvec4 not (bvec4 v) {
- bvec4 u;
- u.x = !v.x;
- u.y = !v.y;
- u.z = !v.z;
- u.w = !v.w;
- return u;
+ return bvec4 (!v.x, !v.y, !v.z, !v.w);
}
//
@@ -1448,22 +1280,17 @@ vec4 texture1DProj (sampler1D sampler, vec4 coord) {
}
vec4 texture2D (sampler2D sampler, vec2 coord) {
- // XXX:
- return vec4 (0.0);
+ vec4 texel;
+ __asm vec4_tex2d texel, sampler, coord;
+ return texel;
}
vec4 texture2DProj (sampler2D sampler, vec3 coord) {
- vec2 u;
- u.s = coord.s / coord.p;
- u.t = coord.t / coord.p;
- return texture2D (sampler, u);
+ return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p));
}
vec4 texture2DProj (sampler2D sampler, vec4 coord) {
- vec2 u;
- u.s = coord.s / coord.q;
- u.t = coord.t / coord.q;
- return texture2D (sampler, u);
+ return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q));
}
vec4 texture3D (sampler3D sampler, vec3 coord) {
@@ -1472,11 +1299,7 @@ vec4 texture3D (sampler3D sampler, vec3 coord) {
}
vec4 texture3DProj (sampler3D sampler, vec4 coord) {
- vec3 u;
- u.s = coord.s / coord.q;
- u.t = coord.t / coord.q;
- u.p = coord.p / coord.q;
- return texture3D (sampler, u);
+ return texture3D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));
}
vec4 textureCube (samplerCube sampler, vec3 coord) {
@@ -1495,19 +1318,11 @@ vec4 shadow2D (sampler2DShadow sampler, vec3 coord) {
}
vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord) {
- vec3 u;
- u.s = coord.s / coord.q;
- u.t = 0.0;
- u.p = coord.p / coord.q;
- return shadow1D (sampler, u);
+ return shadow1D (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q));
}
vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord) {
- vec3 u;
- u.s = coord.s / coord.q;
- u.t = coord.t / coord.q;
- u.p = coord.p / coord.q;
- return shadow2D (sampler, u);
+ return shadow2D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));
}
//
@@ -1541,98 +1356,98 @@ float noise1 (vec4 x) {
}
vec2 noise2 (float x) {
- vec2 u;
- u.x = noise1 (x);
- u.y = noise1 (x + 19.34);
- return u;
+ return vec2 (
+ noise1 (x),
+ noise1 (x + 19.34)
+ );
}
vec2 noise2 (vec2 x) {
- vec2 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec2 (19.34, 7.66));
- return u;
+ return vec2 (
+ noise1 (x),
+ noise1 (x + vec2 (19.34, 7.66))
+ );
}
vec2 noise2 (vec3 x) {
- vec2 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec3 (19.34, 7.66, 3.23));
- return u;
+ return vec2 (
+ noise1 (x),
+ noise1 (x + vec3 (19.34, 7.66, 3.23))
+ );
}
vec2 noise2 (vec4 x) {
- vec2 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77));
- return u;
+ return vec2 (
+ noise1 (x),
+ noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77))
+ );
}
vec3 noise3 (float x) {
- vec3 u;
- u.x = noise1 (x);
- u.y = noise1 (x + 19.34);
- u.z = noise1 (x + 5.47);
- return u;
+ return vec3 (
+ noise1 (x),
+ noise1 (x + 19.34),
+ noise1 (x + 5.47)
+ );
}
vec3 noise3 (vec2 x) {
- vec3 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec2 (19.34, 7.66));
- u.z = noise1 (x + vec2 (5.47, 17.85));
- return u;
+ return vec3 (
+ noise1 (x),
+ noise1 (x + vec2 (19.34, 7.66)),
+ noise1 (x + vec2 (5.47, 17.85))
+ );
}
vec3 noise3 (vec3 x) {
- vec3 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec3 (19.34, 7.66, 3.23));
- u.z = noise1 (x + vec3 (5.47, 17.85, 11.04));
- return u;
+ return vec3 (
+ noise1 (x),
+ noise1 (x + vec3 (19.34, 7.66, 3.23)),
+ noise1 (x + vec3 (5.47, 17.85, 11.04))
+ );
}
vec3 noise3 (vec4 x) {
- vec3 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77));
- u.z = noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19));
- return u;
+ return vec3 (
+ noise1 (x),
+ noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77)),
+ noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19))
+ );
}
vec4 noise4 (float x) {
- vec4 u;
- u.x = noise1 (x);
- u.y = noise1 (x + 19.34);
- u.z = noise1 (x + 5.47);
- u.w = noise1 (x + 23.54);
- return u;
+ return vec4 (
+ noise1 (x),
+ noise1 (x + 19.34),
+ noise1 (x + 5.47),
+ noise1 (x + 23.54)
+ );
}
vec4 noise4 (vec2 x) {
- vec4 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec2 (19.34, 7.66));
- u.z = noise1 (x + vec2 (5.47, 17.85));
- u.w = noise1 (x + vec2 (23.54, 29.11));
- return u;
+ return vec4 (
+ noise1 (x),
+ noise1 (x + vec2 (19.34, 7.66)),
+ noise1 (x + vec2 (5.47, 17.85)),
+ noise1 (x + vec2 (23.54, 29.11))
+ );
}
vec4 noise4 (vec3 x) {
- vec4 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec3 (19.34, 7.66, 3.23));
- u.z = noise1 (x + vec3 (5.47, 17.85, 11.04));
- u.w = noise1 (x + vec3 (23.54, 29.11, 31.91));
- return u;
+ return vec4 (
+ noise1 (x),
+ noise1 (x + vec3 (19.34, 7.66, 3.23)),
+ noise1 (x + vec3 (5.47, 17.85, 11.04)),
+ noise1 (x + vec3 (23.54, 29.11, 31.91))
+ );
}
vec4 noise4 (vec4 x) {
- vec4 u;
- u.x = noise1 (x);
- u.y = noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77));
- u.z = noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19));
- u.w = noise1 (x + vec4 (23.54, 29.11, 31.91, 37.48));
- return u;
+ return vec4 (
+ noise1 (x),
+ noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77)),
+ noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19)),
+ noise1 (x + vec4 (23.54, 29.11, 31.91, 37.48))
+ );
}