mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
Cell: use new ASSERT macro instead of standard assert
The later doesn't seem to work properly in SPU code.
This commit is contained in:
parent
b324722542
commit
6c11485405
3 changed files with 24 additions and 15 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue