Cell: added cell_batch_free_space()
authorBrian <brian.paul@tungstengraphics.com>
Sun, 27 Jan 2008 01:27:37 +0000 (18:27 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Sun, 27 Jan 2008 01:27:37 +0000 (18:27 -0700)
src/mesa/pipe/cell/ppu/cell_batch.c
src/mesa/pipe/cell/ppu/cell_batch.h

index 5a25f1b2668acb9c7b30489a41625da35c834170..c894ef86089e32a9ad1b11a482e03ec5e8fc0b17 100644 (file)
@@ -96,6 +96,15 @@ cell_batch_flush(struct cell_context *cell)
 }
 
 
+uint
+cell_batch_free_space(const struct cell_context *cell)
+{
+   uint free = CELL_BATCH_BUFFER_SIZE
+      - cell->batch_buffer_size[cell->cur_batch];
+   return free;
+}
+
+
 /**
  * \param cmd  command to append
  * \param length  command size in bytes
@@ -129,6 +138,8 @@ cell_batch_alloc(struct cell_context *cell, uint bytes)
    void *pos;
    uint size;
 
+   ASSERT(bytes % 4 == 0);
+
    assert(cell->cur_batch >= 0);
 
    size = cell->batch_buffer_size[cell->cur_batch];
index 47e3287626bc77f5d6716e418205cbb03e293443..c4ba7feb3da718e3f8b0f19907230876f32caff7 100644 (file)
@@ -38,6 +38,9 @@ struct cell_context;
 extern void
 cell_batch_flush(struct cell_context *cell);
 
+extern uint
+cell_batch_free_space(const struct cell_context *cell);
+
 extern void
 cell_batch_append(struct cell_context *cell, const void *cmd, uint length);