summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-09-30 21:00:16 -0600
committerBrian Paul <[email protected]>2009-09-30 21:00:16 -0600
commit3fa7dbf368bb060220e9f78e666b00d6827166a6 (patch)
tree83cf26eb834b50f174c496fc4467db65bdba9e48 /src/mesa/swrast
parent74ae14a2bde4f87a554c3d96e6f4a9a02591308d (diff)
mesa: remove GLchan-based formats; use hw 8-bit/channel formats instead
Removed: MESA_FORMAT_RGBA, RGB, ALPHA, LUMINANCE, LUMINANCE_ALPHA, INTENSITY.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_texfilter.c36
-rw-r--r--src/mesa/swrast/s_triangle.c12
2 files changed, 24 insertions, 24 deletions
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 11c8f9256a8..6cba8ed34b7 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -1343,17 +1343,17 @@ opt_sample_rgb_2d(GLcontext *ctx,
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_RGB);
+ ASSERT(img->TexFormat == MESA_FORMAT_RGB888);
ASSERT(img->_IsPowerOfTwo);
for (k=0; k<n; k++) {
GLint i = IFLOOR(texcoords[k][0] * width) & colMask;
GLint j = IFLOOR(texcoords[k][1] * height) & rowMask;
GLint pos = (j << shift) | i;
- GLchan *texel = ((GLchan *) img->Data) + 3*pos;
- rgba[k][RCOMP] = CHAN_TO_FLOAT(texel[0]);
- rgba[k][GCOMP] = CHAN_TO_FLOAT(texel[1]);
- rgba[k][BCOMP] = CHAN_TO_FLOAT(texel[2]);
+ GLubyte *texel = ((GLubyte *) img->Data) + 3*pos;
+ rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[0]);
+ rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]);
+ rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[2]);
}
}
@@ -1384,18 +1384,18 @@ opt_sample_rgba_2d(GLcontext *ctx,
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_RGBA);
+ ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888);
ASSERT(img->_IsPowerOfTwo);
for (i = 0; i < n; i++) {
const GLint col = IFLOOR(texcoords[i][0] * width) & colMask;
const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask;
const GLint pos = (row << shift) | col;
- const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */
- rgba[i][RCOMP] = CHAN_TO_FLOAT(texel[0]);
- rgba[i][GCOMP] = CHAN_TO_FLOAT(texel[1]);
- rgba[i][BCOMP] = CHAN_TO_FLOAT(texel[2]);
- rgba[i][ACOMP] = CHAN_TO_FLOAT(texel[3]);
+ const GLubyte *texel = ((GLubyte *) img->Data) + (pos << 2); /* pos*4 */
+ rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[0]);
+ rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[1]);
+ rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[2]);
+ rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[3]);
}
}
@@ -1428,11 +1428,11 @@ sample_lambda_2d(GLcontext *ctx,
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
- case MESA_FORMAT_RGB:
+ case MESA_FORMAT_RGB888:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
- case MESA_FORMAT_RGBA:
+ case MESA_FORMAT_RGBA8888:
opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
@@ -1485,11 +1485,11 @@ sample_lambda_2d(GLcontext *ctx,
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
- case MESA_FORMAT_RGB:
+ case MESA_FORMAT_RGB888:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
- case MESA_FORMAT_RGBA:
+ case MESA_FORMAT_RGBA8888:
opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
@@ -3137,7 +3137,7 @@ null_sample_func( GLcontext *ctx,
rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
rgba[i][BCOMP] = 0;
- rgba[i][ACOMP] = CHAN_MAX;
+ rgba[i][ACOMP] = 1.0;
}
}
@@ -3189,14 +3189,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx,
t->WrapT == GL_REPEAT &&
img->_IsPowerOfTwo &&
img->Border == 0 &&
- img->TexFormat == MESA_FORMAT_RGB) {
+ img->TexFormat == MESA_FORMAT_RGB888) {
return &opt_sample_rgb_2d;
}
else if (t->WrapS == GL_REPEAT &&
t->WrapT == GL_REPEAT &&
img->_IsPowerOfTwo &&
img->Border == 0 &&
- img->TexFormat == MESA_FORMAT_RGBA) {
+ img->TexFormat == MESA_FORMAT_RGBA8888) {
return &opt_sample_rgba_2d;
}
else {
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 7b59763f110..6a61bec245e 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -140,7 +140,7 @@ _swrast_culltriangle( GLcontext *ctx,
const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \
+ const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \
const GLint smask = obj->Image[0][b]->Width - 1; \
const GLint tmask = obj->Image[0][b]->Height - 1; \
if (!rb || !texture) { \
@@ -149,7 +149,7 @@ _swrast_culltriangle( GLcontext *ctx,
#define RENDER_SPAN( span ) \
GLuint i; \
- GLchan rgb[MAX_WIDTH][3]; \
+ GLubyte rgb[MAX_WIDTH][3]; \
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
span.intTex[1] -= FIXED_HALF; \
for (i = 0; i < span.end; i++) { \
@@ -192,7 +192,7 @@ _swrast_culltriangle( GLcontext *ctx,
const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \
+ const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \
const GLint smask = obj->Image[0][b]->Width - 1; \
const GLint tmask = obj->Image[0][b]->Height - 1; \
if (!rb || !texture) { \
@@ -201,7 +201,7 @@ _swrast_culltriangle( GLcontext *ctx,
#define RENDER_SPAN( span ) \
GLuint i; \
- GLchan rgb[MAX_WIDTH][3]; \
+ GLubyte rgb[MAX_WIDTH][3]; \
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
span.intTex[1] -= FIXED_HALF; \
for (i = 0; i < span.end; i++) { \
@@ -1075,7 +1075,7 @@ _swrast_choose_triangle( GLcontext *ctx )
&& texImg->_IsPowerOfTwo
&& texImg->Border == 0
&& texImg->Width == texImg->RowStride
- && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA)
+ && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888)
&& minFilter == magFilter
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR
&& !swrast->_FogEnabled
@@ -1083,7 +1083,7 @@ _swrast_choose_triangle( GLcontext *ctx )
&& ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) {
if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) {
if (minFilter == GL_NEAREST
- && format == MESA_FORMAT_RGB
+ && format == MESA_FORMAT_RGB888
&& (envMode == GL_REPLACE || envMode == GL_DECAL)
&& ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)
&& ctx->Depth.Func == GL_LESS