summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_rast_priv.h
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-06-30 11:57:14 -0600
committerBrian Paul <brianp@vmware.com>2010-06-30 14:05:45 -0600
commit2b3e1ad731d2bd095a680d3120619972a7eb0242 (patch)
treeb1963207479242c9ba38c575d339424c0021d74c /src/gallium/drivers/llvmpipe/lp_rast_priv.h
parenteffd33071e7b10bdd2f0c198fc34210202b574cc (diff)
llvmpipe: use dummy tile when out of memory
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast_priv.h')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_priv.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index 9bded086ef..eb4175dfa6 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -31,6 +31,7 @@
#include "os/os_thread.h"
#include "util/u_format.h"
#include "gallivm/lp_bld_debug.h"
+#include "lp_memory.h"
#include "lp_rast.h"
#include "lp_scene.h"
#include "lp_state.h"
@@ -132,18 +133,20 @@ void lp_rast_shade_quads( struct lp_rasterizer_task *task,
* \param x, y location of 4x4 block in window coords
*/
static INLINE void *
-lp_rast_get_depth_block_pointer(const struct lp_rasterizer *rast,
+lp_rast_get_depth_block_pointer(struct lp_rasterizer_task *task,
unsigned x, unsigned y)
{
+ const struct lp_rasterizer *rast = task->rast;
void *depth;
assert((x % TILE_VECTOR_WIDTH) == 0);
assert((y % TILE_VECTOR_HEIGHT) == 0);
- assert(rast->zsbuf.map || !rast->curr_scene->fb.zsbuf);
-
- if (!rast->zsbuf.map)
- return NULL;
+ if (!rast->zsbuf.map && (task->current_state->variant->key.depth.enabled ||
+ task->current_state->variant->key.stencil[0].enabled)) {
+ /* out of memory - use dummy tile memory */
+ return lp_get_dummy_tile();
+ }
depth = (rast->zsbuf.map +
rast->zsbuf.stride * y +
@@ -172,8 +175,10 @@ lp_rast_get_color_block_pointer(struct lp_rasterizer_task *task,
assert((y % TILE_VECTOR_HEIGHT) == 0);
color = task->color_tiles[buf];
- if (!color)
- return NULL;
+ if (!color) {
+ /* out of memory - use dummy tile memory */
+ return lp_get_dummy_tile();
+ }
px = x % TILE_SIZE;
py = y % TILE_SIZE;
@@ -197,7 +202,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
const struct lp_rast_shader_inputs *inputs,
unsigned x, unsigned y )
{
- struct lp_rasterizer *rast = task->rast;
+ const struct lp_rasterizer *rast = task->rast;
const struct lp_rast_state *state = task->current_state;
struct lp_fragment_shader_variant *variant = state->variant;
uint8_t *color[PIPE_MAX_COLOR_BUFS];
@@ -208,7 +213,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
for (i = 0; i < rast->state.nr_cbufs; i++)
color[i] = lp_rast_get_color_block_pointer(task, i, x, y);
- depth = lp_rast_get_depth_block_pointer(rast, x, y);
+ depth = lp_rast_get_depth_block_pointer(task, x, y);
/* run shader on 4x4 block */
variant->jit_function[RAST_WHOLE]( &state->jit_context,