}
}
-// XXX: must save index buffer too!
+// don't save index buffer because blitter doesn't setit
static struct blitter_context*
nvfx_get_blitter(struct pipe_context* pipe, int copy)
{
struct nvfx_context* nvfx = nvfx_context(pipe);
- struct blitter_context* blitter = nvfx->blitter;
- if(!blitter)
- nvfx->blitter = blitter = util_blitter_create(pipe);
+ assert(nvfx->blitters_in_use < Elements(nvfx->blitter));
+
+ struct blitter_context** pblitter = &nvfx->blitter[nvfx->blitters_in_use++];
+ if(!*pblitter)
+ *pblitter = util_blitter_create(pipe);
+ struct blitter_context* blitter = *pblitter;
util_blitter_save_blend(blitter, nvfx->blend);
util_blitter_save_depth_stencil_alpha(blitter, nvfx->zsa);
return blitter;
}
+static inline void
+nvfx_put_blitter(struct pipe_context* pipe, struct blitter_context* blitter)
+{
+ struct nvfx_context* nvfx = nvfx_context(pipe);
+ --nvfx->blitters_in_use;
+ assert(nvfx->blitters_in_use >= 0);
+}
+
static unsigned
nvfx_region_clone(struct nv04_2d_context* ctx, struct nv04_region* rgn, unsigned w, unsigned h, boolean for_read)
{
{
struct blitter_context* blitter = nvfx_get_blitter(pipe, 1);
util_blitter_copy_region(blitter, dstr, subdst, dstx, dsty, dstz, srcr, subsrc, srcx, srcy, srcz, w, h, TRUE);
+ nvfx_put_blitter(pipe, blitter);
}
else
{
// TODO: probably should use hardware clear here instead if possible
struct blitter_context* blitter = nvfx_get_blitter(pipe, 0);
util_blitter_clear_render_target(blitter, dst, rgba, dstx, dsty, width, height);
+ nvfx_put_blitter(pipe, blitter);
}
}
// TODO: probably should use hardware clear here instead if possible
struct blitter_context* blitter = nvfx_get_blitter(pipe, 0);
util_blitter_clear_depth_stencil(blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height);
+ nvfx_put_blitter(pipe, blitter);
}
}