-
/**
* Called by ctx->Driver.Clear.
+ * XXX NO LONGER USED - REMOVE IN NEAR FUTURE
*/
#if 0
static void
intelClear(GLcontext *ctx, GLbitfield mask)
#else
-void
-intelClear(struct pipe_context *pipe,
+static void
+OLD_intelClear(struct pipe_context *pipe,
GLboolean color, GLboolean depth,
GLboolean stencil, GLboolean accum)
#endif
}
+/**
+ * Clear buffers. Called via pipe->clear().
+ */
+void
+intelClear(struct pipe_context *pipe,
+ GLboolean color, GLboolean depth,
+ GLboolean stencil, GLboolean accum)
+{
+ GLcontext *ctx = (GLcontext *) pipe->glctx;
+ struct intel_context *intel = intel_context(ctx);
+
+ /* XXX
+ * Examine stencil and color writemasks to determine if we can clear
+ * with blits.
+ */
+
+ intelFlush(&intel->ctx);
+ LOCK_HARDWARE(intel);
+
+ softpipe_clear(pipe, color, depth, stencil, accum);
+
+ intel_batchbuffer_flush(intel->batch);
+
+ UNLOCK_HARDWARE(intel);
+}
+
+
+
/* Emit wait for pending flips */
void
intel_wait_flips(struct intel_context *intel, GLuint batch_flags)
/**
- * XXX maybe this belongs in the GL state tracker...
+ * XXX This should probaby be renamed to something like pipe_clear_with_blits()
+ * and moved into a device-independent pipe file.
*/
void
softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
if (stencil) {
struct pipe_surface *ps = softpipe->framebuffer.sbuf;
GLuint clearVal = softpipe->stencil.clear_value;
- GLuint mask = 0xff;
- if (softpipe->stencil.write_mask[0] /*== 0xff*/) {
- /* no masking */
- pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask);
- }
- else if (softpipe->stencil.write_mask[0] != 0x0) {
- /* masking */
- /* fill with quad funcs */
+ GLuint mask = softpipe->stencil.write_mask[0];
+
+ switch (ps->format) {
+ case PIPE_FORMAT_S8_Z24:
+ clearVal = clearVal << 24;
+ mask = mask << 24;
+ break;
+ case PIPE_FORMAT_U_S8:
+ /* nothing */
+ break;
+ default:
assert(0);
}
+
+ pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask);
}
}
+
+ if (accum) {
+ /* XXX there might be no notion of accum buffers in 'pipe'.
+ * Just implement them with a deep RGBA surface format...
+ */
+ struct pipe_surface *ps = softpipe->framebuffer.abuf;
+ GLuint clearVal = 0x0; /* XXX FIX */
+ GLuint mask = !0;
+ assert(ps);
+ pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask);
+ }
}