summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/library/slang_common_builtin.gc
diff options
context:
space:
mode:
authorMichal Krol <mjkrol@gmail.org>2005-04-13 13:03:23 +0000
committerMichal Krol <mjkrol@gmail.org>2005-04-13 13:03:23 +0000
commit5a382001224df9aad6137c825fbfc2d058b220b1 (patch)
treea74746e9d5b49bafed7b83955a36e1441af61215 /src/mesa/shader/slang/library/slang_common_builtin.gc
parentf18d70b80493bf795e901424231b0e157251e0ad (diff)
cosmetic changes;
fix syntax errors;
Diffstat (limited to 'src/mesa/shader/slang/library/slang_common_builtin.gc')
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_common_builtin.gc41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index 65c5c79e6d..0b3ed0e880 100755
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -209,14 +209,14 @@ uniform gl_FogParameters gl_Fog;
//
// The built-in functions basically fall into three categories:
//
-// • They expose some necessary hardware functionality in a convenient way such as accessing
+// * They expose some necessary hardware functionality in a convenient way such as accessing
// a texture map. There is no way in the language for these functions to be emulated by a shader.
//
-// • They represent a trivial operation (clamp, mix, etc.) that is very simple for the user
+// * They represent a trivial operation (clamp, mix, etc.) that is very simple for the user
// to write, but they are very common and may have direct hardware support. It is a very hard
// problem for the compiler to map expressions to complex assembler instructions.
//
-// • They represent an operation graphics hardware is likely to accelerate at some point. The
+// * They represent an operation graphics hardware is likely to accelerate at some point. The
// trigonometry functions fall into this category.
//
// Many of the functions are similar to the same named ones in common C libraries, but they support
@@ -927,7 +927,8 @@ vec4 faceforward (vec4 N, vec4 I, vec4 Nref) {
//
// For the incident vector I and surface orientation N, returns the reflection direction:
// result = I - 2 * dot (N, I) * N
-// N must already be normalized in order to achieve the desired result.
+// N must already be normalized in order to achieve the desired result.
+//
float reflect (float I, float N) {
return I - 2.0 * dot (N, I) * N;
@@ -959,7 +960,7 @@ vec4 reflect (vec4 I, vec4 N) {
float refract (float I, float N, float eta) {
const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
if (k < 0.0)
- return 0.0;
+ return 0.0;
return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
}
vec2 refract (vec2 I, vec2 N, float eta) {
@@ -1146,16 +1147,16 @@ bvec3 notEqual (vec3 x, vec3 y) {
return bvec3 (x.x != y.x, x.y != y.y, x.z != y.z);
}
bvec4 notEqual (vec4 x, vec4 y) {
- return (bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
+ return bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
}
bvec2 notEqual (ivec2 x, ivec2 y) {
- return (bvec2 (x.x != y.x, x.y != y.y);
+ return bvec2 (x.x != y.x, x.y != y.y);
}
bvec3 notEqual (ivec3 x, ivec3 y) {
- return (bvec3 (x.x != y.x, x.y != y.y, x.z != y.z);
+ return bvec3 (x.x != y.x, x.y != y.y, x.z != y.z);
}
bvec4 notEqual (ivec4 x, ivec4 y) {
- return (bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
+ return bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
}
//
@@ -1225,13 +1226,13 @@ bvec4 not (bvec4 x) {
// running in a fragment shader, the LOD computed by the implementation is used to do the texture
// lookup. If it is mip-mapped and running on the vertex shader, then the base texture is used.
//
-// The built-ins suffixed with “Lod” are allowed only in a vertex shader. For the “Lod” functions,
+// The built-ins suffixed with "Lod" are allowed only in a vertex shader. For the "Lod" functions,
// lod is directly used as the level of detail.
//
//
// Use the texture coordinate coord to do a texture lookup in the 1D texture currently bound
-// to sampler. For the projective (“Proj”) versions, the texture coordinate coord.s is divided by
+// to sampler. For the projective ("Proj") versions, the texture coordinate coord.s is divided by
// the last component of coord.
//
// XXX
@@ -1247,7 +1248,7 @@ vec4 texture1DProj (sampler1D sampler, vec4 coord) {
//
// Use the texture coordinate coord to do a texture lookup in the 2D texture currently bound
-// to sampler. For the projective (“Proj”) versions, the texture coordinate (coord.s, coord.t) is
+// to sampler. For the projective ("Proj") versions, the texture coordinate (coord.s, coord.t) is
// divided by the last component of coord. The third component of coord is ignored for the vec4
// coord variant.
//
@@ -1264,7 +1265,7 @@ vec4 texture2DProj (sampler2D sampler, vec4 coord) {
//
// Use the texture coordinate coord to do a texture lookup in the 3D texture currently bound
-// to sampler. For the projective (“Proj”) versions, the texture coordinate is divided by coord.q.
+// to sampler. For the projective ("Proj") versions, the texture coordinate is divided by coord.q.
//
// XXX
vec4 texture3D (sampler3D sampler, vec3 coord) {
@@ -1288,9 +1289,9 @@ vec4 textureCube (samplerCube sampler, vec3 coord) {
// Use texture coordinate coord to do a depth comparison lookup on the depth texture bound
// to sampler, as described in section 3.8.14 of version 1.4 of the OpenGL specification. The 3rd
// component of coord (coord.p) is used as the R value. The texture bound to sampler must be a
-// depth texture, or results are undefined. For the projective (“Proj”) version of each built-in,
+// depth texture, or results are undefined. For the projective ("Proj") version of each built-in,
// the texture coordinate is divide by coord.q, giving a depth value R of coord.p/coord.q. The
-// second component of coord is ignored for the “1D” variants.
+// second component of coord is ignored for the "1D" variants.
//
// XXX
vec4 shadow1D (sampler1DShadow sampler, vec3 coord) {
@@ -1317,13 +1318,13 @@ vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord) {
//
// - The return value(s) are always in the range [-1,1], and cover at least the range [-0.6, 0.6],
// with a gaussian-like distribution.
-// • The return value(s) have an overall average of 0.0
-// • They are repeatable, in that a particular input value will always produce the same return value
-// • They are statistically invariant under rotation (i.e., no matter how the domain is rotated, it
+// * The return value(s) have an overall average of 0.0
+// * They are repeatable, in that a particular input value will always produce the same return value
+// * They are statistically invariant under rotation (i.e., no matter how the domain is rotated, it
// has the same statistical character)
-// • They have a statistical invariance under translation (i.e., no matter how the domain is
+// * They have a statistical invariance under translation (i.e., no matter how the domain is
// translated, it has the same statistical character)
-// • They typically give different results under translation.
+// * They typically give different results under translation.
// - The spatial frequency is narrowly concentrated, centered somewhere between 0.5 to 1.0.
//