#define _INVALID(f) \
[ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \
- && (tx_table[f].format != 0xffffffff) )
+ && tx_table[f].flag )
+
+#define _ASSIGN(entry, format) \
+ [ MESA_FORMAT_ ## entry ] = { format, 0, 1}
static const struct {
GLuint format, filter;
} tx_table0[] = {
-_ALPHA(RGBA8888),
+ _ALPHA(RGBA8888),
_ALPHA_REV(RGBA8888),
_ALPHA(ARGB8888),
_ALPHA_REV(ARGB8888),
_ALPHA_REV(AL88),
_ALPHA(A8),
_COLOR(L8),
- _ALPHA(I8), _INVALID(CI8), _YUV(YCBCR), _YUV(YCBCR_REV),};
+ _ALPHA(I8),
+ _INVALID(CI8),
+ _YUV(YCBCR),
+ _YUV(YCBCR_REV),
+ };
static const struct {
- GLuint format, filter;
+ GLuint format, filter, flag;
} tx_table[] = {
- {R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8), 0},
- {0xffffff01, 0},
- {0xffffff02, 0},
- {0xffffff03, 0},
- {0xffffff04, 0},
- {0xffffff05, 0},
- {0xffffff06, 0},
- {0xffffff07, 0},
- {0xffffff08, 0},
- {0xffffff09, 0},
- {0xffffff10, 0},
- {0xffffff11, 0},
- {0xffffff12, 0},
- {0xffffff13, 0},
- {0xffffff14, 0},
- {0xffffff15, 0},
- {0xffffff16, 0},
- {0xffffff17, 0},
+ /*
+ * Note that the _REV formats are the same as the non-REV formats.
+ * This is because the REV and non-REV formats are identical as a
+ * byte string, but differ when accessed as 16-bit or 32-bit words
+ * depending on the endianness of the host. Since the textures are
+ * transferred to the R300 as a byte string (i.e. without any
+ * byte-swapping), the R300 sees the REV and non-REV formats
+ * identically. -- paulus
+ */
+ _ASSIGN(RGBA8888, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8)),
+ _ASSIGN(RGBA8888_REV, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8)),
+ _ASSIGN(ARGB8888, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)),
+ _ASSIGN(ARGB8888_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)),
+ _ASSIGN(RGB888, 0xffffffff),
+ _ASSIGN(RGB565, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
+ _ASSIGN(RGB565_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
+ _ASSIGN(ARGB4444, R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4)),
+ _ASSIGN(ARGB4444_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4)),
+ _ASSIGN(ARGB1555, R300_EASY_TX_FORMAT(Z, Y, X, W, W1Z5Y5X5)),
+ _ASSIGN(ARGB1555_REV, R300_EASY_TX_FORMAT(Z, Y, X, W, W1Z5Y5X5)),
+ _ASSIGN(AL88, R300_EASY_TX_FORMAT(Y, Y, Y, X, Y8X8)),
+ _ASSIGN(AL88_REV, R300_EASY_TX_FORMAT(Y, Y, Y, X, Y8X8)),
+ _ASSIGN(RGB332, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z3Y3X2)),
+ _ASSIGN(A8, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X8)),
+ _ASSIGN(L8, R300_EASY_TX_FORMAT(X, X, X, ONE, X8)),
+ _ASSIGN(I8, R300_EASY_TX_FORMAT(X, X, X, X, X8)),
+ _ASSIGN(CI8, R300_EASY_TX_FORMAT(X, X, X, X, X8)),
+ _ASSIGN(YCBCR, R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8)|R300_TX_FORMAT_YUV_MODE ),
+ _ASSIGN(YCBCR_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8)|R300_TX_FORMAT_YUV_MODE),
};
-
#undef _COLOR
#undef _ALPHA
#undef _INVALID
-
+#undef _ASSIGN
/**
t->format &= ~(R200_TXFORMAT_FORMAT_MASK |
R200_TXFORMAT_ALPHA_IN_MAP);
-#if 0
+#if 0
t->filter &= ~R200_YUV_TO_RGB;
#endif
if (VALID_FORMAT(baseImage->TexFormat->MesaFormat)) {
#if 1
t->filter |=
tx_table[baseImage->TexFormat->MesaFormat].filter;
-#endif
+#endif
} else {
_mesa_problem(NULL, "unexpected texture format in %s",
__FUNCTION__);
t->filter &= ~R200_MAX_MIP_LEVEL_MASK;
t->filter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
#endif
- #if 0
+#if 0
t->format &= ~(R200_TXFORMAT_WIDTH_MASK |
R200_TXFORMAT_HEIGHT_MASK |
R200_TXFORMAT_CUBIC_MAP_ENABLE |
R200_TXFORMAT_F5_HEIGHT_MASK);
t->format |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
(log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
- #endif
-
+#endif
+
t->format_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
if (tObj->Target == GL_TEXTURE_3D) {
t->format_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT);
(log2Width << R200_FACE_WIDTH_4_SHIFT) |
(log2Height << R200_FACE_HEIGHT_4_SHIFT));
}
-
+
t->size = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << R300_TX_WIDTHMASK_SHIFT)
|((tObj->Image[0][t->base.firstLevel]->Height - 1) << R300_TX_HEIGHTMASK_SHIFT)
|((log2Width>log2Height)?log2Width:log2Height)<<R300_TX_SIZE_SHIFT);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLuint color_combine, alpha_combine;
-
- #if 0 /* disable for now.. */
+
+#if 0 /* disable for now.. */
GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] &
~(R200_TXC_SCALE_MASK);
GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] &
~(R200_TXA_DOT_ALPHA | R200_TXA_SCALE_MASK);
- #endif
-
+#endif
+
GLuint color_scale=0, alpha_scale=0;
-
+
/* texUnit->_Current can be NULL if and only if the texture unit is
* not actually enabled.
*/
*/
/* Don't cache these results.
*/
- #if 0
+#if 0
rmesa->state.texture.unit[unit].format = 0;
- #endif
+#endif
rmesa->state.texture.unit[unit].envMode = 0;
-
+
if (!texUnit->_ReallyEnabled) {
if (unit == 0) {
color_combine =
*/
}
- #if 0
- fprintf(stderr, "color_combine=%08x alpha_combine=%08x color_scale=%08x alpha_scale=%08x\n",
+#if 0
+ fprintf(stderr, "color_combine=%08x alpha_combine=%08x color_scale=%08x alpha_scale=%08x\n",
color_combine, alpha_combine, color_scale, alpha_scale);
- #endif
-
- #if 0
+#endif
+
+#if 0
if (rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] != color_combine ||
rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] != alpha_combine ||
rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] != color_scale ||
rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] = alpha_scale;
}
- #endif
-
+#endif
+
return GL_TRUE;
}
static void import_tex_obj_state(r300ContextPtr rmesa,
int unit, r300TexObjPtr texobj)
{
- #if 0 /* needs fixing.. or should be done elsewhere */
+#if 0 /* needs fixing.. or should be done elsewhere */
GLuint *cmd = R300_DB_STATE(tex[unit]);
cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
}
texobj->dirty_state &= ~(1 << unit);
- #endif
+#endif
}
static void set_texgen_matrix(r300ContextPtr rmesa,
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
- #if 0 /* This needs to be redone.. or done elsewhere */
+#if 0 /* This needs to be redone.. or done elsewhere */
if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE << unit)) {
/* Texture unit disabled */
if (rmesa->state.texture.unit[unit].texobj != NULL) {
}
}
}
- #endif
+#endif
}
static GLboolean enable_tex_2d(GLcontext * ctx, int unit)
/* Need to load the 2d images associated with this unit.
*/
+ #if 0
if (t->format & R200_TXFORMAT_NON_POWER2) {
t->format &= ~R200_TXFORMAT_NON_POWER2;
t->base.dirty_images[0] = ~0;
}
+ #endif
ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D);
struct gl_texture_object *tObj = texUnit->_Current;
r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
+ #if 0
if (!(t->format & R200_TXFORMAT_NON_POWER2)) {
t->format |= R200_TXFORMAT_NON_POWER2;
t->base.dirty_images[0] = ~0;
}
+ #endif
ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV);
driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */
}
- #if 0 /* do elsewhere ? */
+#if 0 /* do elsewhere ? */
/* Newly enabled?
*/
if (1
rmesa->recheck_texgen[unit] = 0;
rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
}
- #endif
+#endif
format = tObj->Image[0][tObj->BaseLevel]->Format;
if (rmesa->state.texture.unit[unit].format != format ||
return GL_FALSE;
}
}
-
+
FALLBACK(&rmesa->radeon, RADEON_FALLBACK_BORDER_MODE, t->border_fallback);
return !t->border_fallback;
}
r300UpdateTextureUnit(ctx, 1) &&
r300UpdateTextureUnit(ctx, 2) &&
r300UpdateTextureUnit(ctx, 3) &&
- r300UpdateTextureUnit(ctx, 4) &&
+ r300UpdateTextureUnit(ctx, 4) &&
r300UpdateTextureUnit(ctx, 5) &&
- r300UpdateTextureUnit(ctx, 6) &&
+ r300UpdateTextureUnit(ctx, 6) &&
r300UpdateTextureUnit(ctx, 7)
);
FALLBACK(&rmesa->radeon, RADEON_FALLBACK_TEXTURE, !ok);
- /* This needs correction, or just be done elsewhere
+ /* This needs correction, or just be done elsewhere
if (rmesa->radeon.TclFallback)
r300ChooseVertexState(ctx);
*/
-
- #if 0 /* Workaround - disable.. */
+
+#if 0 /* Workaround - disable.. */
if (GET_CHIP(rmesa->radeon.radeonScreen) == RADEON_CHIP_REAL_R200) {
/*
* T0 hang workaround -------------
dbg);
}
}
- #endif
+#endif
}