From: Vladimir Dergachev Date: Mon, 3 Jan 2005 06:48:50 +0000 (+0000) Subject: Enable code to compute other constants that were used by R200 code. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63473a8e76dadc0f56e222866066bb4a242700d9;p=mesa.git Enable code to compute other constants that were used by R200 code. Add fprintf to print these constants. Correct t->size computation, so it works now. --- diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 54826ea8015..af279792803 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -149,6 +149,15 @@ struct r300_tex_obj { GLuint unknown5; /* end hardware registers */ + /* registers computed by r200 code - keep them here to + compare against what is actually written. + + to be removed later.. */ + GLuint pp_border_color; + GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */ + GLuint format_x; + + GLboolean border_fallback; }; diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index c16a960a5d7..5cec6eff56d 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -585,11 +585,14 @@ static GLboolean r300_run_tex_render(GLcontext *ctx, /* Use actual texture offset */ + fprintf(stderr,"pp_border_color=%08x pp_cubic_faces=%08x format=%08x size=%08x format_x=%08x\n", + t->pp_border_color, t->pp_cubic_faces, t->format, t->size, t->format_x); + SINGLE_TEXTURE_PIPELINE.texture_unit[0].offset=rmesa->radeon.radeonScreen->fbLocation+t->offset; #if 0 SINGLE_TEXTURE_PIPELINE.texture_unit[0].format=t->format; - SINGLE_TEXTURE_PIPELINE.texture_unit[0].size=t->size; #endif + SINGLE_TEXTURE_PIPELINE.texture_unit[0].size=t->size; SINGLE_TEXTURE_PIPELINE.texture_unit[0].filter=t->filter; SINGLE_TEXTURE_PIPELINE.texture_unit[0].unknown1=t->pitch; /* Unknown 1 is pitch ! */ SINGLE_TEXTURE_PIPELINE.texture_unit[0].filter=t->filter; diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index bdbdc0b8902..d32b9f0288f 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -136,42 +136,40 @@ static void r300SetTexWrap(r300TexObjPtr t, GLenum swrap, GLenum twrap, _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__); } - #if 0 /* Which field is this ? */ - t->pp_txformat_x &= ~R200_CLAMP_Q_MASK; + t->format_x &= ~R200_CLAMP_Q_MASK; switch (rwrap) { case GL_REPEAT: - t->pp_txformat_x |= R200_CLAMP_Q_WRAP; + t->format_x |= R200_CLAMP_Q_WRAP; break; case GL_CLAMP: - t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_GL; + t->format_x |= R200_CLAMP_Q_CLAMP_GL; is_clamp = GL_TRUE; break; case GL_CLAMP_TO_EDGE: - t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_LAST; + t->format_x |= R200_CLAMP_Q_CLAMP_LAST; break; case GL_CLAMP_TO_BORDER: - t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_GL; + t->format_x |= R200_CLAMP_Q_CLAMP_GL; is_clamp_to_border = GL_TRUE; break; case GL_MIRRORED_REPEAT: - t->pp_txformat_x |= R200_CLAMP_Q_MIRROR; + t->format_x |= R200_CLAMP_Q_MIRROR; break; case GL_MIRROR_CLAMP_EXT: - t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_GL; + t->format_x |= R200_CLAMP_Q_MIRROR_CLAMP_GL; is_clamp = GL_TRUE; break; case GL_MIRROR_CLAMP_TO_EDGE_EXT: - t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_LAST; + t->format_x |= R200_CLAMP_Q_MIRROR_CLAMP_LAST; break; case GL_MIRROR_CLAMP_TO_BORDER_EXT: - t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_GL; + t->format_x |= R200_CLAMP_Q_MIRROR_CLAMP_GL; is_clamp_to_border = GL_TRUE; break; default: _mesa_problem(NULL, "bad R wrap mode in %s", __FUNCTION__); } - #endif if (is_clamp_to_border) { t->filter |= R200_BORDER_MODE_D3D; @@ -210,9 +208,7 @@ static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf) GLuint anisotropy = (t->filter & R200_MAX_ANISO_MASK); t->filter &= ~(R200_MIN_FILTER_MASK | R200_MAG_FILTER_MASK); - #if 0 - t->pp_txformat_x &= ~R200_VOLUME_FILTER_MASK; - #endif + t->format_x &= ~R200_VOLUME_FILTER_MASK; if (anisotropy == R200_MAX_ANISO_1_TO_1) { switch (minf) { @@ -262,24 +258,18 @@ static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf) switch (magf) { case GL_NEAREST: t->filter |= R200_MAG_FILTER_NEAREST; - #if 0 - t->pp_txformat_x |= R200_VOLUME_FILTER_NEAREST; - #endif + t->format_x |= R200_VOLUME_FILTER_NEAREST; break; case GL_LINEAR: t->filter |= R200_MAG_FILTER_LINEAR; - #if 0 - t->pp_txformat_x |= R200_VOLUME_FILTER_LINEAR; - #endif + t->format_x |= R200_VOLUME_FILTER_LINEAR; break; } } static void r300SetTexBorderColor(r300TexObjPtr t, GLubyte c[4]) { - #if 0 t->pp_border_color = radeonPackColor(4, c[0], c[1], c[2], c[3]); - #endif } /** @@ -1039,7 +1029,7 @@ void r300InitTextureFuncs(struct dd_function_table *functions) driInitTextureFormats(); -#if 000 +#if 0 /* moved or obsolete code */ r300ContextPtr rmesa = R300_CONTEXT(ctx); driInitTextureObjects(ctx, &rmesa->swapped, diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 6962bb3ddbf..22d1d6c6f9d 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //#include "r300_swtcl.h" #include "r300_tex.h" //#include "r300_tcl.h" +#include "r300_reg.h" #define R200_TXFORMAT_A8 R200_TXFORMAT_I8 #define R200_TXFORMAT_L8 R200_TXFORMAT_I8 @@ -246,7 +247,6 @@ static void r300SetTexImages(r300ContextPtr rmesa, t->format |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) | (log2Height << R200_TXFORMAT_HEIGHT_SHIFT)); - #if 0 t->format_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK); if (tObj->Target == GL_TEXTURE_3D) { t->format_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT); @@ -266,11 +266,10 @@ static void r300SetTexImages(r300ContextPtr rmesa, (log2Width << R200_FACE_WIDTH_4_SHIFT) | (log2Height << R200_FACE_HEIGHT_4_SHIFT)); } - #endif - t->size = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << 0) | - ((tObj->Image[0][t->base.firstLevel]->Height - - 1) << 16)); + 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)<