summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/library
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2006-02-18 15:11:18 +0000
committerMichal Krol <[email protected]>2006-02-18 15:11:18 +0000
commit3654193a4d417560c90b4bbe47d8070919cdc348 (patch)
tree9c984f7fe482f9af08575d6b3338cd4128e5455c /src/mesa/shader/slang/library
parente94be8d5c0b28c4eecf8492cb07ae9dff9026ada (diff)
More GLSL code.
- general constructors allowed; - implement noise functions (from Stefan Gustavson - thanks!) - cosmetic stuff.
Diffstat (limited to 'src/mesa/shader/slang/library')
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_common_builtin.gc645
-rw-r--r--src/mesa/shader/slang/library/slang_common_builtin_gc.h76
2 files changed, 403 insertions, 318 deletions
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index 094bc798846..c7c27419a91 100755
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -3,7 +3,6 @@
// TODO:
// - implement texture1D, texture2D, texture3D, textureCube,
// - implement shadow1D, shadow2D,
-// - implement noise1, noise2, noise3, noise4,
//
//
@@ -351,14 +350,14 @@ vec4 atan (vec4 y_over_x) {
float atan (float y, float x) {
float z;
- z = atan (y / x);
+ z = atan (y / x);
if (x < 0.0)
- {
- if (y < 0.0)
- return z - 3.141593;
- return z + 3.141593;
- }
- return z;
+ {
+ if (y < 0.0)
+ return z - 3.141593;
+ return z + 3.141593;
+ }
+ return z;
}
vec2 atan (vec2 u, vec2 v) {
@@ -538,26 +537,26 @@ float abs (float x) {
}
vec2 abs (vec2 v) {
- vec2 u;
- u.x = abs (v.x);
- u.y = abs (v.y);
+ vec2 u;
+ u.x = abs (v.x);
+ u.y = abs (v.y);
return u;
}
vec3 abs (vec3 v) {
vec3 u;
- u.x = abs (v.x);
- u.y = abs (v.y);
- u.z = abs (v.z);
+ u.x = abs (v.x);
+ u.y = abs (v.y);
+ u.z = abs (v.z);
return u;
}
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);
+ u.x = abs (v.x);
+ u.y = abs (v.y);
+ u.z = abs (v.z);
+ u.w = abs (v.w);
return u;
}
@@ -567,85 +566,85 @@ float sign (float x) {
vec2 sign (vec2 v) {
vec2 u;
- u.x = sign (v.x);
- u.y = sign (v.y);
+ u.x = sign (v.x);
+ u.y = sign (v.y);
return u;
}
vec3 sign (vec3 v) {
vec3 u;
- u.x = sign (v.x);
- u.y = sign (v.y);
- u.z = sign (v.z);
+ u.x = sign (v.x);
+ u.y = sign (v.y);
+ u.z = sign (v.z);
return u;
}
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);
+ u.x = sign (v.x);
+ u.y = sign (v.y);
+ u.z = sign (v.z);
+ u.w = sign (v.w);
return u;
}
float floor (float x) {
float y;
- __asm float_floor y, x;
- return y;
+ __asm float_floor y, x;
+ return y;
}
vec2 floor (vec2 v) {
vec2 u;
- u.x = floor (v.x);
- u.y = floor (v.y);
+ u.x = floor (v.x);
+ u.y = floor (v.y);
return u;
}
vec3 floor (vec3 v) {
vec3 u;
- u.x = floor (v.x);
- u.y = floor (v.y);
- u.z = floor (v.z);
+ u.x = floor (v.x);
+ u.y = floor (v.y);
+ u.z = floor (v.z);
return u;
}
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);
+ u.x = floor (v.x);
+ u.y = floor (v.y);
+ u.z = floor (v.z);
+ u.w = floor (v.w);
return u;
}
float ceil (float x) {
float y;
- __asm float_ceil y, x;
- return y;
+ __asm float_ceil y, x;
+ return y;
}
vec2 ceil (vec2 v) {
vec2 u;
- u.x = ceil (v.x);
- u.y = ceil (v.y);
+ u.x = ceil (v.x);
+ u.y = ceil (v.y);
return u;
}
vec3 ceil (vec3 v) {
vec3 u;
- u.x = ceil (v.x);
- u.y = ceil (v.y);
- u.z = ceil (v.z);
+ u.x = ceil (v.x);
+ u.y = ceil (v.y);
+ u.z = ceil (v.z);
return u;
}
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);
+ u.x = ceil (v.x);
+ u.y = ceil (v.y);
+ u.z = ceil (v.z);
+ u.w = ceil (v.w);
return u;
}
@@ -699,26 +698,26 @@ 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;
+ t.x = min (v.x, u.x);
+ t.y = min (v.y, u.y);
+ return t;
}
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;
+ t.x = min (v.x, u.x);
+ t.y = min (v.y, u.y);
+ t.z = min (v.z, u.z);
+ return t;
}
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;
+ 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;
}
vec2 min (vec2 v, float y) {
@@ -739,26 +738,26 @@ 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;
+ t.x = max (v.x, u.x);
+ t.y = max (v.y, u.y);
+ return t;
}
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;
+ t.x = max (v.x, u.x);
+ t.y = max (v.y, u.y);
+ t.z = max (v.z, u.z);
+ return t;
}
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;
+ 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;
}
vec2 max (vec2 v, float y) {
@@ -835,26 +834,26 @@ 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;
+ u.x = step (edge.x, v.x);
+ u.y = step (edge.y, v.y);
+ return u;
}
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;
+ u.x = step (edge.x, v.x);
+ u.y = step (edge.y, v.y);
+ u.z = step (edge.z, v.z);
+ return u;
}
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;
+ 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;
}
vec2 step (float edge, vec2 v) {
@@ -871,56 +870,56 @@ vec4 step (float edge, vec4 v) {
float smoothstep (float edge0, float edge1, float x) {
float t;
- t = clamp ((x - edge0) / (edge1 - edge0), 0.0, 1.0);
+ t = clamp ((x - edge0) / (edge1 - edge0), 0.0, 1.0);
return t * t * (3.0 - 2.0 * t);
}
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;
+ u.x = smoothstep (edge0.x, edge1.x, v.x);
+ u.y = smoothstep (edge0.y, edge1.y, v.y);
+ return u;
}
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;
+ 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;
}
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;
+ 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;
}
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;
+ u.x = smoothstep (edge0, edge1, v.x);
+ u.y = smoothstep (edge0, edge1, v.y);
+ return u;
}
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;
+ u.x = smoothstep (edge0, edge1, v.x);
+ u.y = smoothstep (edge0, edge1, v.y);
+ u.z = smoothstep (edge0, edge1, v.z);
+ return u;
}
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;
+ 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;
}
//
@@ -1033,7 +1032,7 @@ vec4 reflect (vec4 I, vec4 N) {
float refract (float I, float N, float eta) {
float k;
- k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
+ k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
if (k < 0.0)
return 0.0;
return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
@@ -1041,7 +1040,7 @@ float refract (float I, float N, float eta) {
vec2 refract (vec2 I, vec2 N, float eta) {
float k;
- k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
+ k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
if (k < 0.0)
return 0.0;
return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
@@ -1049,7 +1048,7 @@ vec2 refract (vec2 I, vec2 N, float eta) {
vec3 refract (vec3 I, vec3 N, float eta) {
float k;
- k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
+ k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
if (k < 0.0)
return 0.0;
return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
@@ -1057,7 +1056,7 @@ vec3 refract (vec3 I, vec3 N, float eta) {
vec4 refract (vec4 I, vec4 N, float eta) {
float k;
- k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
+ k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
if (k < 0.0)
return 0.0;
return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
@@ -1096,291 +1095,291 @@ 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;
+ bvec2 b;
+ b.x = v.x < u.x;
+ b.y = v.y < u.y;
+ return b;
}
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;
+ b.x = v.x < u.x;
+ b.y = v.y < u.y;
+ b.z = v.z < u.z;
+ return b;
}
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;
+ 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;
}
bvec2 lessThan (ivec2 v, ivec2 u) {
bvec2 b;
- b.x = v.x < u.x;
- b.y = v.y < u.y;
- return b;
+ b.x = v.x < u.x;
+ b.y = v.y < u.y;
+ return b;
}
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;
+ b.x = v.x < u.x;
+ b.y = v.y < u.y;
+ b.z = v.z < u.z;
+ return b;
}
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;
+ 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;
}
bvec2 lessThanEqual (vec2 v, vec2 u) {
bvec2 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- return b;
+ b.x = v.x <= u.x;
+ b.y = v.y <= u.y;
+ return b;
}
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;
+ b.x = v.x <= u.x;
+ b.y = v.y <= u.y;
+ b.z = v.z <= u.z;
+ return b;
}
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;
+ 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;
}
bvec2 lessThanEqual (ivec2 v, ivec2 u) {
bvec2 b;
- b.x = v.x <= u.x;
- b.y = v.y <= u.y;
- return b;
+ b.x = v.x <= u.x;
+ b.y = v.y <= u.y;
+ return b;
}
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;
+ b.x = v.x <= u.x;
+ b.y = v.y <= u.y;
+ b.z = v.z <= u.z;
+ return b;
}
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;
+ 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;
}
bvec2 greaterThan (vec2 v, vec2 u) {
bvec2 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- return b;
+ b.x = v.x > u.x;
+ b.y = v.y > u.y;
+ return b;
}
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;
+ b.x = v.x > u.x;
+ b.y = v.y > u.y;
+ b.z = v.z > u.z;
+ return b;
}
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;
+ 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;
}
bvec2 greaterThan (ivec2 v, ivec2 u) {
bvec2 b;
- b.x = v.x > u.x;
- b.y = v.y > u.y;
- return b;
+ b.x = v.x > u.x;
+ b.y = v.y > u.y;
+ return b;
}
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;
+ b.x = v.x > u.x;
+ b.y = v.y > u.y;
+ b.z = v.z > u.z;
+ return b;
}
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;
+ 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;
}
bvec2 greaterThanEqual (vec2 v, vec2 u) {
bvec2 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- return b;
+ b.x = v.x >= u.x;
+ b.y = v.y >= u.y;
+ return b;
}
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;
+ b.x = v.x >= u.x;
+ b.y = v.y >= u.y;
+ b.z = v.z >= u.z;
+ return b;
}
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;
+ 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;
}
bvec2 greaterThanEqual (ivec2 v, ivec2 u) {
bvec2 b;
- b.x = v.x >= u.x;
- b.y = v.y >= u.y;
- return b;
+ b.x = v.x >= u.x;
+ b.y = v.y >= u.y;
+ return b;
}
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;
+ b.x = v.x >= u.x;
+ b.y = v.y >= u.y;
+ b.z = v.z >= u.z;
+ return b;
}
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;
+ 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;
}
bvec2 equal (vec2 v, vec2 u) {
bvec2 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- return b;
+ b.x = v.x == u.x;
+ b.y = v.y == u.y;
+ return b;
}
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;
+ b.x = v.x == u.x;
+ b.y = v.y == u.y;
+ b.z = v.z == u.z;
+ return b;
}
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;
+ 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;
}
bvec2 equal (ivec2 v, ivec2 u) {
bvec2 b;
- b.x = v.x == u.x;
- b.y = v.y == u.y;
- return b;
+ b.x = v.x == u.x;
+ b.y = v.y == u.y;
+ return b;
}
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;
+ b.x = v.x == u.x;
+ b.y = v.y == u.y;
+ b.z = v.z == u.z;
+ return b;
}
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;
+ 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;
}
bvec2 notEqual (vec2 v, vec2 u) {
bvec2 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- return b;
+ b.x = v.x != u.x;
+ b.y = v.y != u.y;
+ return b;
}
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;
+ b.x = v.x != u.x;
+ b.y = v.y != u.y;
+ b.z = v.z != u.z;
+ return b;
}
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;
+ 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;
}
bvec2 notEqual (ivec2 v, ivec2 u) {
bvec2 b;
- b.x = v.x != u.x;
- b.y = v.y != u.y;
- return b;
+ b.x = v.x != u.x;
+ b.y = v.y != u.y;
+ return b;
}
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;
+ b.x = v.x != u.x;
+ b.y = v.y != u.y;
+ b.z = v.z != u.z;
+ return b;
}
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;
+ 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;
}
bool any (bvec2 v) {
@@ -1408,26 +1407,26 @@ bool all (bvec4 v) {
}
bvec2 not (bvec2 v) {
- bvec2 u;
- u.x = !v.x;
- u.y = !v.y;
+ bvec2 u;
+ u.x = !v.x;
+ u.y = !v.y;
return u;
}
bvec3 not (bvec3 v) {
bvec3 u;
- u.x = !v.x;
- u.y = !v.y;
- u.z = !v.z;
+ u.x = !v.x;
+ u.y = !v.y;
+ u.z = !v.z;
return u;
}
bvec4 not (bvec4 v) {
bvec4 u;
- u.x = !v.x;
- u.y = !v.y;
- u.z = !v.z;
- u.w = !v.w;
+ u.x = !v.x;
+ u.y = !v.y;
+ u.z = !v.z;
+ u.w = !v.w;
return u;
}
@@ -1512,86 +1511,128 @@ vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord) {
}
//
-// 8.9 Noise Functions
+// 8.9 Noise Functions
+//
+// AUTHOR: Stefan Gustavson ([email protected]), Nov 26, 2005
//
float noise1 (float x) {
- // XXX:
- return 0.0;
+ float a;
+ __asm float_noise1 a, x;
+ return a;
}
float noise1 (vec2 x) {
- // XXX:
- return 0.0;
+ float a;
+ __asm float_noise2 a, x;
+ return a;
}
float noise1 (vec3 x) {
- // XXX:
- return 0.0;
+ float a;
+ __asm float_noise3 a, x;
+ return a;
}
float noise1 (vec4 x) {
- // XXX:
- return 0.0;
+ float a;
+ __asm float_noise4 a, x;
+ return a;
}
vec2 noise2 (float x) {
- // XXX:
- return vec2 (0.0);
+ vec2 u;
+ u.x = noise1 (x);
+ u.y = noise1 (x + 19.34);
+ return u;
}
vec2 noise2 (vec2 x) {
- // XXX:
- return vec2 (0.0);
+ vec2 u;
+ u.x = noise1 (x);
+ u.y = noise1 (x + vec2 (19.34, 7.66));
+ return u;
}
vec2 noise2 (vec3 x) {
- // XXX:
- return vec2 (0.0);
+ vec2 u;
+ u.x = noise1 (x);
+ u.y = noise1 (x + vec3 (19.34, 7.66, 3.23));
+ return u;
}
vec2 noise2 (vec4 x) {
- // XXX:
- return vec2 (0.0);
+ vec2 u;
+ u.x = noise1 (x);
+ u.y = noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77));
+ return u;
}
vec3 noise3 (float x) {
- // XXX:
- return vec3 (0.0);
+ vec3 u;
+ u.x = noise1 (x);
+ u.y = noise1 (x + 19.34);
+ u.z = noise1 (x + 5.47);
+ return u;
}
vec3 noise3 (vec2 x) {
- // XXX:
- return vec3 (0.0);
+ 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;
}
vec3 noise3 (vec3 x) {
- // XXX:
- return vec3 (0.0);
+ 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;
}
vec3 noise3 (vec4 x) {
- // XXX:
- return vec3 (0.0);
+ 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;
}
vec4 noise4 (float x) {
- // XXX:
- return vec4 (0.0);
+ 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;
}
vec4 noise4 (vec2 x) {
- // XXX:
- return vec4 (0.0);
+ 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;
}
vec4 noise4 (vec3 x) {
- // XXX:
- return vec4 (0.0);
+ 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;
}
vec4 noise4 (vec4 x) {
- // XXX:
- return vec4 (0.0);
+ 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;
}
diff --git a/src/mesa/shader/slang/library/slang_common_builtin_gc.h b/src/mesa/shader/slang/library/slang_common_builtin_gc.h
index f72da4407b4..0422790cdad 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin_gc.h
+++ b/src/mesa/shader/slang/library/slang_common_builtin_gc.h
@@ -661,19 +661,63 @@
111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,20,0,9,18,117,0,59,116,0,18,99,111,111,
114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,20,0,9,18,117,0,59,112,0,18,99,111,111,114,
100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,20,0,8,58,115,104,97,100,111,119,50,68,0,18,115,
-97,109,112,108,101,114,0,0,18,117,0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,8,
-17,48,0,48,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,
-9,0,110,111,105,115,101,49,0,1,0,0,11,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,9,0,110,111,105,115,101,
-49,0,1,0,0,12,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,9,120,0,0,0,
-1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,10,120,0,0,0,
-1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,
-1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,12,120,0,0,0,
-1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,9,120,0,0,0,
-1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,
-1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,11,120,0,0,0,
-1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,12,120,0,0,0,
-1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,
-1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,10,120,0,0,0,
-1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,11,120,0,0,0,
-1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,12,120,0,0,0,
-1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,0
+97,109,112,108,101,114,0,0,18,117,0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,3,
+2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,49,0,18,97,0,0,18,120,0,0,0,8,18,97,0,
+0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,
+95,110,111,105,115,101,50,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,
+1,0,0,11,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,97,0,0,
+18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,12,120,0,0,0,1,3,2,0,9,1,97,0,0,
+0,4,102,108,111,97,116,95,110,111,105,115,101,52,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,10,0,
+110,111,105,115,101,50,0,1,0,0,9,120,0,0,0,1,3,2,0,10,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,
+105,115,101,49,0,18,120,0,0,0,20,0,9,18,117,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,
+57,0,51,52,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,10,120,0,0,0,1,3,
+2,0,10,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,117,0,59,
+121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,
+0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,3,2,0,10,
+1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,117,0,59,121,0,
+58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,
+17,51,0,50,51,0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,12,120,0,
+0,0,1,3,2,0,10,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,
+117,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,
+55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,11,0,110,
+111,105,115,101,51,0,1,0,0,9,120,0,0,0,1,3,2,0,11,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,
+115,101,49,0,18,120,0,0,0,20,0,9,18,117,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,
+51,52,0,0,46,0,0,20,0,9,18,117,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,
+46,0,0,20,0,8,18,117,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,1,3,2,0,11,1,117,0,
+0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,117,0,59,121,0,58,110,
+111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,
+0,20,0,9,18,117,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,53,0,52,55,0,
+0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,11,
+120,0,0,0,1,3,2,0,11,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,
+9,18,117,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,
+17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,9,18,117,0,59,122,0,58,110,111,105,115,101,
+49,0,18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,
+0,46,0,0,20,0,8,18,117,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,12,120,0,0,0,1,3,2,0,11,1,117,
+0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,117,0,59,121,0,58,110,
+111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,
+0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,20,0,9,18,117,0,59,122,0,58,110,111,105,115,101,49,0,18,
+120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,
+51,0,49,57,0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,
+1,3,2,0,12,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,117,
+0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,9,18,117,0,59,122,
+0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,20,0,9,18,117,0,59,119,0,58,110,
+111,105,115,101,49,0,18,120,0,17,50,51,0,53,52,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,12,0,110,111,105,
+115,101,52,0,1,0,0,10,120,0,0,0,1,3,2,0,12,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,
+49,0,18,120,0,0,0,20,0,9,18,117,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,
+17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,9,18,117,0,59,122,0,58,110,111,105,115,
+101,49,0,18,120,0,58,118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,20,0,9,18,
+117,0,59,119,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,50,51,0,53,52,0,0,0,17,
+50,57,0,49,49,0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,11,120,0,
+0,0,1,3,2,0,12,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,
+117,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,
+55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,9,18,117,0,59,122,0,58,110,111,105,115,101,49,0,
+18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,
+0,0,20,0,9,18,117,0,59,119,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,50,51,0,53,
+52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,1,0,12,0,110,
+111,105,115,101,52,0,1,0,0,12,120,0,0,0,1,3,2,0,12,1,117,0,0,0,9,18,117,0,59,120,0,58,110,111,105,
+115,101,49,0,18,120,0,0,0,20,0,9,18,117,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,
+99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,
+0,20,0,9,18,117,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,
+0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,20,0,9,18,117,0,
+59,119,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,50,51,0,53,52,0,0,0,17,50,57,0,
+49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,0,52,56,0,0,0,0,46,0,0,20,0,8,18,117,0,0,0,0