summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/library
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-04-17 09:16:30 -0600
committerBrian <brian@yutani.localnet.net>2007-04-17 09:16:30 -0600
commit468a33d19a0187b55a01660c65306db128280bd3 (patch)
tree1426a9680f8eb12dfb4485ea4d3d9f261c1a73b8 /src/mesa/shader/slang/library
parent893b368a82c4d84b8f2c43c178e4f1881dbfe698 (diff)
fix/simplify some texture functions
Diffstat (limited to 'src/mesa/shader/slang/library')
-rw-r--r--src/mesa/shader/slang/library/slang_common_builtin.gc33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index ab14408046..3780a38139 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -1609,11 +1609,8 @@ vec4 texture1D(const sampler1D sampler, const float coord)
vec4 texture1DProj(const sampler1D sampler, const vec2 coord)
{
- // new coord with .z moved to .w
- vec4 coord4;
- coord4.x = coord.x;
- coord4.w = coord.y;
- __asm vec4_texp1d __retVal, sampler, coord4;
+ // need to swizzle .y into .w
+ __asm vec4_texp1d __retVal, sampler, coord.xyyy;
}
vec4 texture1DProj(const sampler1D sampler, const vec4 coord)
@@ -1629,11 +1626,8 @@ vec4 texture2D(const sampler2D sampler, const vec2 coord)
vec4 texture2DProj(const sampler2D sampler, const vec3 coord)
{
- // new coord with .z moved to .w
- vec4 coord4;
- coord4.xy = coord.xy;
- coord4.w = coord.z;
- __asm vec4_texp2d __retVal, sampler, coord4;
+ // need to swizzle 'z' into 'w'.
+ __asm vec4_texp2d __retVal, sampler, coord.xyzz;
}
vec4 texture2DProj(const sampler2D sampler, const vec4 coord)
@@ -1667,11 +1661,8 @@ vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord)
vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord)
{
- vec4 pcoord;
- pcoord.x = coord.x / coord.w;
- pcoord.z = coord.z;
- pcoord.w = bias;
- __asm vec4_tex1d __retVal, sampler, pcoord;
+ // .s and .p will be divided by .q
+ __asm vec4_texp1d __retVal, sampler, coord;
}
vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord)
@@ -1681,10 +1672,8 @@ vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord)
vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord)
{
- vec4 pcoord;
- pcoord.xy = coord.xy / coord.w;
- pcoord.z = coord.z;
- __asm vec4_tex2d __retVal, sampler, pcoord;
+ // .s, .t and .p will be divided by .q
+ __asm vec4_texp2d __retVal, sampler, coord;
}
@@ -1696,10 +1685,8 @@ vec4 texture2DRect(const sampler2DRect sampler, const vec2 coord)
vec4 texture2DRectProj(const sampler2DRect sampler, const vec3 coord)
{
- // do projection here
- vec4 pcoord;
- pcoord.xy = coord.xy / coord.z;
- __asm vec4_texp_rect __retVal, sampler, pcoord;
+ // need to swizzle .y into .w
+ __asm vec4_texp_rect __retVal, sampler, coord.xyzz;
}
vec4 texture2DRectProj(const sampler2DRect sampler, const vec4 coord)