Cell: rename fields of the tile_t union
authorBrian <brian.paul@tungstengraphics.com>
Fri, 1 Feb 2008 20:49:51 +0000 (13:49 -0700)
committerBen Skeggs <skeggsb@gmail.com>
Fri, 15 Feb 2008 02:50:28 +0000 (13:50 +1100)
src/mesa/pipe/cell/spu/spu_main.c
src/mesa/pipe/cell/spu/spu_texture.c
src/mesa/pipe/cell/spu/spu_tile.c
src/mesa/pipe/cell/spu/spu_tile.h
src/mesa/pipe/cell/spu/spu_tri.c

index d639304..7d6e910 100644 (file)
@@ -36,6 +36,7 @@
 #include "spu_render.h"
 #include "spu_texture.h"
 #include "spu_tile.h"
+//#include "spu_test.h"
 #include "spu_vertex_shader.h"
 #include "pipe/cell/common.h"
 #include "pipe/p_defines.h"
@@ -495,6 +496,7 @@ one_time_init(void)
 }
 
 
+
 /* In some versions of the SDK the SPE main takes 'unsigned long' as a
  * parameter.  In others it takes 'unsigned long long'.  Use a define to
  * select between the two.
@@ -515,6 +517,8 @@ main(main_param_t speid, main_param_t argp)
 
    (void) speid;
 
+   ASSERT(sizeof(tile_t) == TILE_SIZE * TILE_SIZE * 4);
+
    one_time_init();
 
    if (Debug)
@@ -528,6 +532,10 @@ main(main_param_t speid, main_param_t argp)
            0  /* rid */);
    wait_on_mask( 1 << tag );
 
+#if 0
+   if (spu.init.id==0)
+      spu_test_misc();
+#endif
 
    main_loop();
 
index 7a1ca09..c1dc6bf 100644 (file)
@@ -97,10 +97,10 @@ get_tex_tile(uint i, uint j)
              spu.init.id, src, tex_tiles[pos].t32);
 #endif
 
-      ASSERT_ALIGN16(tex_tiles[pos].t32);
+      ASSERT_ALIGN16(tex_tiles[pos].ui);
       ASSERT_ALIGN16(src);
 
-      mfc_get(tex_tiles[pos].t32,  /* dest */
+      mfc_get(tex_tiles[pos].ui,  /* dest */
               (unsigned int) src,
               bytes_per_tile,      /* size */
               TAG_TEXTURE_TILE,
@@ -134,6 +134,6 @@ sample_texture(float4 texcoord)
    uint i = (uint) (texcoord.f[0] * spu.texture.width) % spu.texture.width;
    uint j = (uint) (texcoord.f[1] * spu.texture.height) % spu.texture.height;
    uint pos = get_tex_tile(i, j);
-   uint texel = tex_tiles[pos].t32[j % TILE_SIZE][i % TILE_SIZE];
+   uint texel = tex_tiles[pos].ui[j % TILE_SIZE][i % TILE_SIZE];
    return texel;
 }
index aea4785..fd65c2b 100644 (file)
@@ -56,7 +56,7 @@ get_tile(uint tx, uint ty, tile_t *tile, int tag, int zBuf)
    printf("get_tile:  dest: %p  src: 0x%x  size: %d\n",
           tile, (unsigned int) src, bytesPerTile);
    */
-   mfc_get(tile->t32,  /* dest in local memory */
+   mfc_get(tile->ui,  /* dest in local memory */
            (unsigned int) src, /* src in main memory */
            bytesPerTile,
            tag,
@@ -82,7 +82,7 @@ put_tile(uint tx, uint ty, const tile_t *tile, int tag, int zBuf)
           spu.init.id,
           tile, (unsigned int) dst, bytesPerTile);
    */
-   mfc_put((void *) tile->t32,  /* src in local memory */
+   mfc_put((void *) tile->ui,  /* src in local memory */
            (unsigned int) dst,  /* dst in main memory */
            bytesPerTile,
            tag,
index 4b1ef2a..85a0d55 100644 (file)
@@ -40,8 +40,8 @@
 
 
 typedef union {
-   ushort t16[TILE_SIZE][TILE_SIZE];
-   uint   t32[TILE_SIZE][TILE_SIZE];
+   ushort us[TILE_SIZE][TILE_SIZE];
+   uint   ui[TILE_SIZE][TILE_SIZE];
    vector unsigned short us8[TILE_SIZE/2][TILE_SIZE/4];
    vector unsigned int ui4[TILE_SIZE/2][TILE_SIZE/2];
 } tile_t;
@@ -74,7 +74,7 @@ put_tile(uint tx, uint ty, const tile_t *tile, int tag, int zBuf);
 static INLINE void
 clear_c_tile(tile_t *ctile)
 {
-   memset32((uint*) ctile->t32,
+   memset32((uint*) ctile->ui,
             spu.fb.color_clear_value,
             TILE_SIZE * TILE_SIZE);
 }
@@ -84,23 +84,15 @@ static INLINE void
 clear_z_tile(tile_t *ztile)
 {
    if (spu.fb.depth_format == PIPE_FORMAT_Z16_UNORM) {
-      memset16((ushort*) ztile->t16,
+      memset16((ushort*) ztile->us,
                spu.fb.depth_clear_value,
                TILE_SIZE * TILE_SIZE);
    }
    else {
       ASSERT(spu.fb.depth_format == PIPE_FORMAT_Z32_UNORM);
-#if SIMD_Z
-      union fi z;
-      z.f = 1.0;
-      memset32((uint*) ztile->t32,
-               z.i,/*spu.fb.depth_clear_value,*/
-               TILE_SIZE * TILE_SIZE);
-#else
-      memset32((uint*) ztile->t32,
+      memset32((uint*) ztile->ui,
                spu.fb.depth_clear_value,
                TILE_SIZE * TILE_SIZE);
-#endif
    }
 }
 
index a26a4f0..b04b684 100644 (file)
@@ -349,13 +349,13 @@ emit_quad( int x, int y, mask_t mask )
       cur_tile_status_c = TILE_STATUS_DIRTY;
 
       if (spu_extract(mask, 0))
-         ctile.t32[iy][ix] = colors[QUAD_TOP_LEFT];
+         ctile.ui[iy][ix] = colors[QUAD_TOP_LEFT];
       if (spu_extract(mask, 1))
-         ctile.t32[iy][ix+1] = colors[QUAD_TOP_RIGHT];
+         ctile.ui[iy][ix+1] = colors[QUAD_TOP_RIGHT];
       if (spu_extract(mask, 2))
-         ctile.t32[iy+1][ix] = colors[QUAD_BOTTOM_LEFT];
+         ctile.ui[iy+1][ix] = colors[QUAD_BOTTOM_LEFT];
       if (spu_extract(mask, 3))
-         ctile.t32[iy+1][ix+1] = colors[QUAD_BOTTOM_RIGHT];
+         ctile.ui[iy+1][ix+1] = colors[QUAD_BOTTOM_RIGHT];
 
 #if 0
       /* SIMD_Z with swizzled color buffer (someday) */