Enable code to compute other constants that were used by R200 code.
authorVladimir Dergachev <volodya@freedesktop.org>
Mon, 3 Jan 2005 06:48:50 +0000 (06:48 +0000)
committerVladimir Dergachev <volodya@freedesktop.org>
Mon, 3 Jan 2005 06:48:50 +0000 (06:48 +0000)
Add fprintf to print these constants.
Correct t->size computation, so it works now.

src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_render.c
src/mesa/drivers/dri/r300/r300_tex.c
src/mesa/drivers/dri/r300/r300_texstate.c

index 54826ea8015ed4e00c418a0d9ae224e052e7ab2d..af27979280366dec679d9d1451f37b03a2d74179 100644 (file)
@@ -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;
 };
 
index c16a960a5d7c7c643efcc0c020504c2a57311f61..5cec6eff56d322da6c8503dbe481e8a766d24c89 100644 (file)
@@ -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;
index bdbdc0b890229eed9ffeb8650a3587165f55b89f..d32b9f0288f514a2f1103e1c58affc232b62df85 100644 (file)
@@ -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,
index 6962bb3ddbf07d5ba23948555241987d61d050e2..22d1d6c6f9d0c3440e3902a6bfe34304c985380c 100644 (file)
@@ -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)<<R300_TX_SIZE_SHIFT);
 
        /* Only need to round to nearest 32 for textures, but the blitter
         * requires 64-byte aligned pitches, and we may/may not need the