diff options
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_texstate.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_texstate.c | 202 |
1 files changed, 0 insertions, 202 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 359a0b1b8a..ec1adfebc9 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -863,208 +863,6 @@ static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit) R200_CLAMP_Q_MASK | \ R200_VOLUME_FILTER_MASK) -static void import_tex_obj_state(r300ContextPtr rmesa, - int unit, r300TexObjPtr texobj) -{ -#if 0 /* needs fixing.. or should be done elsewhere */ - GLuint *cmd = R300_DB_STATE(tex[unit]); - - cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK; - cmd[TEX_PP_TXFILTER] |= texobj->filter & TEXOBJ_TXFILTER_MASK; - cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK; - cmd[TEX_PP_TXFORMAT] |= texobj->format & TEXOBJ_TXFORMAT_MASK; - cmd[TEX_PP_TXFORMAT_X] &= ~TEXOBJ_TXFORMAT_X_MASK; - cmd[TEX_PP_TXFORMAT_X] |= - texobj->format_x & TEXOBJ_TXFORMAT_X_MASK; - cmd[TEX_PP_TXSIZE] = texobj->size; /* NPOT only! */ - cmd[TEX_PP_TXPITCH] = texobj->pitch; /* NPOT only! */ - cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset; - cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color; - R200_DB_STATECHANGE(rmesa, &rmesa->hw.tex[unit]); - - if (texobj->base.tObj->Target == GL_TEXTURE_CUBE_MAP) { - GLuint *cube_cmd = R200_DB_STATE(cube[unit]); - GLuint bytesPerFace = texobj->base.totalSize / 6; - ASSERT(texobj->totalSize % 6 == 0); - cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F1] = - texobj->pp_txoffset + 1 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F2] = - texobj->pp_txoffset + 2 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F3] = - texobj->pp_txoffset + 3 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F4] = - texobj->pp_txoffset + 4 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F5] = - texobj->pp_txoffset + 5 * bytesPerFace; - R200_DB_STATECHANGE(rmesa, &rmesa->hw.cube[unit]); - } - - texobj->dirty_state &= ~(1 << unit); -#endif -} - -static void set_texgen_matrix(r300ContextPtr rmesa, - GLuint unit, - const GLfloat * s_plane, - const GLfloat * t_plane, const GLfloat * r_plane) -{ - static const GLfloat scale_identity[4] = { 1, 1, 1, 1 }; - - if (!TEST_EQ_4V(s_plane, scale_identity) || - !TEST_EQ_4V(t_plane, scale_identity) || - !TEST_EQ_4V(r_plane, scale_identity)) { - rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit; - rmesa->TexGenMatrix[unit].m[0] = s_plane[0]; - rmesa->TexGenMatrix[unit].m[4] = s_plane[1]; - rmesa->TexGenMatrix[unit].m[8] = s_plane[2]; - rmesa->TexGenMatrix[unit].m[12] = s_plane[3]; - - rmesa->TexGenMatrix[unit].m[1] = t_plane[0]; - rmesa->TexGenMatrix[unit].m[5] = t_plane[1]; - rmesa->TexGenMatrix[unit].m[9] = t_plane[2]; - rmesa->TexGenMatrix[unit].m[13] = t_plane[3]; - - /* NOTE: r_plane goes in the 4th row, not 3rd! */ - rmesa->TexGenMatrix[unit].m[3] = r_plane[0]; - rmesa->TexGenMatrix[unit].m[7] = r_plane[1]; - rmesa->TexGenMatrix[unit].m[11] = r_plane[2]; - rmesa->TexGenMatrix[unit].m[15] = r_plane[3]; - - //rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; - } -} - -/* Need this special matrix to get correct reflection map coords */ -static void set_texgen_reflection_matrix(r300ContextPtr rmesa, GLuint unit) -{ - static const GLfloat m[16] = { - -1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, 0, -1, - 0, 0, -1, 0 - }; - _math_matrix_loadf(&(rmesa->TexGenMatrix[unit]), m); - _math_matrix_analyse(&(rmesa->TexGenMatrix[unit])); - rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit; -} - -/* Need this special matrix to get correct normal map coords */ -static void set_texgen_normal_map_matrix(r300ContextPtr rmesa, GLuint unit) -{ - static const GLfloat m[16] = { - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 0, 1, - 0, 0, 1, 0 - }; - _math_matrix_loadf(&(rmesa->TexGenMatrix[unit]), m); - _math_matrix_analyse(&(rmesa->TexGenMatrix[unit])); - rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit; -} - -/* Ignoring the Q texcoord for now. - * - * Returns GL_FALSE if fallback required. - */ -static GLboolean r300_validate_texgen(GLcontext * ctx, GLuint unit) -{ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit * 4; - GLuint tmp = rmesa->TexGenEnabled; - - rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit); - rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE << unit); - rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE << unit); - rmesa->TexGenInputs &= ~(R200_TEXGEN_INPUT_MASK << inputshift); - rmesa->TexGenNeedNormals[unit] = 0; - - if (0) - fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit); - - if ((texUnit->TexGenEnabled & (S_BIT | T_BIT | R_BIT)) == 0) { - /* Disabled, no fallback: - */ - rmesa->TexGenInputs |= - (R200_TEXGEN_INPUT_TEXCOORD_0 + unit) << inputshift; - return GL_TRUE; - } else if (texUnit->TexGenEnabled & Q_BIT) { - /* Very easy to do this, in fact would remove a fallback case - * elsewhere, but I haven't done it yet... Fallback: - */ - /*fprintf(stderr, "fallback Q_BIT\n"); */ - return GL_FALSE; - } else if (texUnit->TexGenEnabled == (S_BIT | T_BIT) && - texUnit->GenModeS == texUnit->GenModeT) { - /* OK */ - rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit; - /* continue */ - } else if (texUnit->TexGenEnabled == (S_BIT | T_BIT | R_BIT) && - texUnit->GenModeS == texUnit->GenModeT && - texUnit->GenModeT == texUnit->GenModeR) { - /* OK */ - rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit; - /* continue */ - } else { - /* Mixed modes, fallback: - */ - /* fprintf(stderr, "fallback mixed texgen\n"); */ - return GL_FALSE; - } - - rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit; - - switch (texUnit->GenModeS) { - case GL_OBJECT_LINEAR: - rmesa->TexGenInputs |= R200_TEXGEN_INPUT_OBJ << inputshift; - set_texgen_matrix(rmesa, unit, - texUnit->ObjectPlaneS, - texUnit->ObjectPlaneT, texUnit->ObjectPlaneR); - break; - - case GL_EYE_LINEAR: - rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE << inputshift; - set_texgen_matrix(rmesa, unit, - texUnit->EyePlaneS, - texUnit->EyePlaneT, texUnit->EyePlaneR); - break; - - case GL_REFLECTION_MAP_NV: - rmesa->TexGenNeedNormals[unit] = GL_TRUE; - rmesa->TexGenInputs |= - R200_TEXGEN_INPUT_EYE_REFLECT << inputshift; - set_texgen_reflection_matrix(rmesa, unit); - break; - - case GL_NORMAL_MAP_NV: - rmesa->TexGenNeedNormals[unit] = GL_TRUE; - rmesa->TexGenInputs |= - R200_TEXGEN_INPUT_EYE_NORMAL << inputshift; - set_texgen_normal_map_matrix(rmesa, unit); - break; - - case GL_SPHERE_MAP: - rmesa->TexGenNeedNormals[unit] = GL_TRUE; - rmesa->TexGenInputs |= R200_TEXGEN_INPUT_SPHERE << inputshift; - break; - - default: - /* Unsupported mode, fallback: - */ - /* fprintf(stderr, "fallback unsupported texgen\n"); */ - return GL_FALSE; - } - - rmesa->TexGenCompSel |= R200_OUTPUT_TEX_0 << unit; - - if (tmp != rmesa->TexGenEnabled) { - //rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; - } - - return GL_TRUE; -} - static void disable_tex(GLcontext * ctx, int unit) { #if 0 /* This needs to be redone.. or done elsewhere */ |