diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-10 17:14:06 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-10 17:14:06 -0700 |
commit | 6c11485405700865895b7c5f14e08bc5bede2a35 (patch) | |
tree | 82bad73fe4260cd14ee0e63e384b4b09ed8b022d /src/mesa | |
parent | b3247225423213c156ce4f428d1d246758a96d50 (diff) |
Cell: use new ASSERT macro instead of standard assert
The later doesn't seem to work properly in SPU code.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/pipe/cell/spu/main.c | 23 | ||||
-rw-r--r-- | src/mesa/pipe/cell/spu/main.h | 10 | ||||
-rw-r--r-- | src/mesa/pipe/cell/spu/tri.c | 6 |
3 files changed, 24 insertions, 15 deletions
diff --git a/src/mesa/pipe/cell/spu/main.c b/src/mesa/pipe/cell/spu/main.c index 6dbd93f530..5ad15bc639 100644 --- a/src/mesa/pipe/cell/spu/main.c +++ b/src/mesa/pipe/cell/spu/main.c @@ -30,7 +30,6 @@ #include <stdio.h> -#include <assert.h> #include <libmisc.h> #include <spu_mfcio.h> @@ -80,8 +79,8 @@ get_tile(const struct framebuffer *fb, uint tx, uint ty, uint *tile, src += offset * bytesPerTile; - assert(tx < fb->width_tiles); - assert(ty < fb->height_tiles); + ASSERT(tx < fb->width_tiles); + ASSERT(ty < fb->height_tiles); ASSERT_ALIGN16(tile); /* printf("get_tile: dest: %p src: 0x%x size: %d\n", @@ -106,8 +105,8 @@ put_tile(const struct framebuffer *fb, uint tx, uint ty, const uint *tile, dst += offset * bytesPerTile; - assert(tx < fb->width_tiles); - assert(ty < fb->height_tiles); + ASSERT(tx < fb->width_tiles); + ASSERT(ty < fb->height_tiles); ASSERT_ALIGN16(tile); /* printf("put_tile: src: %p dst: 0x%x size: %d\n", @@ -315,8 +314,8 @@ render(const struct cell_command_render *render) const uint tx = txmin + i % box_width_tiles; const uint ty = tymin + i / box_width_tiles; - assert(tx < fb.width_tiles); - assert(ty < fb.height_tiles); + ASSERT(tx < fb.width_tiles); + ASSERT(ty < fb.height_tiles); /* Start fetching color/z tiles. We'll wait for completion when * we need read/write to them later in triangle rasterization. @@ -331,7 +330,7 @@ render(const struct cell_command_render *render) get_tile(&fb, tx, ty, (uint *) ctile, TAG_READ_TILE_COLOR, 0); } - assert(render->prim_type == PIPE_PRIM_TRIANGLES); + ASSERT(render->prim_type == PIPE_PRIM_TRIANGLES); /* loop over tris */ for (j = 0; j < render->num_verts; j += 3) { @@ -445,8 +444,8 @@ render_vbuf(const struct cell_command_render_vbuf *render) const uint tx = txmin + i % box_width_tiles; const uint ty = tymin + i / box_width_tiles; - assert(tx < fb.width_tiles); - assert(ty < fb.height_tiles); + ASSERT(tx < fb.width_tiles); + ASSERT(ty < fb.height_tiles); /* Start fetching color/z tiles. We'll wait for completion when * we need read/write to them later in triangle rasterization. @@ -461,7 +460,7 @@ render_vbuf(const struct cell_command_render_vbuf *render) get_tile(&fb, tx, ty, (uint *) ctile, TAG_READ_TILE_COLOR, 0); } - assert(render->prim_type == PIPE_PRIM_TRIANGLES); + ASSERT(render->prim_type == PIPE_PRIM_TRIANGLES); /* loop over tris */ for (j = 0; j < render->num_indexes; j += 3) { @@ -531,7 +530,7 @@ main_loop(void) if (Debug) printf("SPU %u: Enter main loop\n", init.id); - assert((sizeof(struct cell_command) & 0xf) == 0); + ASSERT((sizeof(struct cell_command) & 0xf) == 0); ASSERT_ALIGN16(&cmd); while (!exitFlag) { diff --git a/src/mesa/pipe/cell/spu/main.h b/src/mesa/pipe/cell/spu/main.h index fce113b77d..c539385a07 100644 --- a/src/mesa/pipe/cell/spu/main.h +++ b/src/mesa/pipe/cell/spu/main.h @@ -98,4 +98,14 @@ void clear_tile_z(ushort tile[TILE_SIZE][TILE_SIZE], uint value); + +/** The standard assert macro doesn't seem to work on SPUs */ +#define ASSERT(x) \ + if (!(x)) { \ + fprintf(stderr, "SPU %d: %s:%d: %s(): assertion %s failed.\n", \ + init.id, __FILE__, __LINE__, __FUNCTION__, #x); \ + exit(1); \ + } + + #endif /* MAIN_H */ diff --git a/src/mesa/pipe/cell/spu/tri.c b/src/mesa/pipe/cell/spu/tri.c index 78cc7a591f..b40f35bc69 100644 --- a/src/mesa/pipe/cell/spu/tri.c +++ b/src/mesa/pipe/cell/spu/tri.c @@ -258,7 +258,7 @@ pack_color(const float color[4]) case PIPE_FORMAT_B8G8R8A8_UNORM: return (b << 24) | (g << 16) | (r << 8) | a; default: - assert(0); + ASSERT(0); return 0; } } @@ -613,7 +613,7 @@ static void tri_linear_coeff( struct setup_stage *setup, float a = setup->ebot.dy * majda - botda * setup->emaj.dy; float b = setup->emaj.dx * botda - majda * setup->ebot.dx; - assert(slot < PIPE_MAX_SHADER_INPUTS); + ASSERT(slot < PIPE_MAX_SHADER_INPUTS); setup->coef[slot].dadx[i] = a * setup->oneoverarea; setup->coef[slot].dady[i] = b * setup->oneoverarea; @@ -777,7 +777,7 @@ static void subtriangle( struct setup_stage *setup, int y, start_y, finish_y; int sy = (int)eleft->sy; - assert((int)eleft->sy == (int) eright->sy); + ASSERT((int)eleft->sy == (int) eright->sy); /* clip top/bottom */ start_y = sy; |