summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_fragprog.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-03-08 13:49:57 -0600
committerBrian Paul <[email protected]>2009-04-01 20:17:19 -0600
commitde2afd8688ceb45013d15be7c6e0995199b80e5a (patch)
treeb19eb2dc2565d385ad384a7a3f7e414b0cd464e3 /src/mesa/swrast/s_fragprog.c
parentf8304bf1ed27dc87f52593a437785f2793344767 (diff)
swrast: do texture sampling/combining in floating point
The code's cleaner and a step toward supporting float-valued texture sampling. Some optimizations for common cases can be added and re-enabled...
Diffstat (limited to 'src/mesa/swrast/s_fragprog.c')
-rw-r--r--src/mesa/swrast/s_fragprog.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index ae1dea16a07..5f032bbd69d 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -37,20 +37,17 @@
* and return results in 'colorOut'.
*/
static INLINE void
-swizzle_texel(const GLchan texel[4], GLfloat colorOut[4], GLuint swizzle)
+swizzle_texel(const GLfloat texel[4], GLfloat colorOut[4], GLuint swizzle)
{
if (swizzle == SWIZZLE_NOOP) {
- colorOut[0] = CHAN_TO_FLOAT(texel[0]);
- colorOut[1] = CHAN_TO_FLOAT(texel[1]);
- colorOut[2] = CHAN_TO_FLOAT(texel[2]);
- colorOut[3] = CHAN_TO_FLOAT(texel[3]);
+ COPY_4V(colorOut, texel);
}
else {
GLfloat vector[6];
- vector[SWIZZLE_X] = CHAN_TO_FLOAT(texel[0]);
- vector[SWIZZLE_Y] = CHAN_TO_FLOAT(texel[1]);
- vector[SWIZZLE_Z] = CHAN_TO_FLOAT(texel[2]);
- vector[SWIZZLE_W] = CHAN_TO_FLOAT(texel[3]);
+ vector[SWIZZLE_X] = texel[0];
+ vector[SWIZZLE_Y] = texel[1];
+ vector[SWIZZLE_Z] = texel[2];
+ vector[SWIZZLE_W] = texel[3];
vector[SWIZZLE_ZERO] = 0.0F;
vector[SWIZZLE_ONE] = 1.0F;
colorOut[0] = vector[GET_SWZ(swizzle, 0)];
@@ -73,7 +70,7 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
if (texObj) {
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLchan rgba[4];
+ GLfloat rgba[4];
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
@@ -108,7 +105,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
const GLfloat texW = (GLfloat) texImg->WidthScale;
const GLfloat texH = (GLfloat) texImg->HeightScale;
GLfloat lambda;
- GLchan rgba[4];
+ GLfloat rgba[4];
lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
texdx[1], texdy[1], /* dt/dx, dt/dy */