summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_clear.c
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2016-06-11 16:52:17 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2016-06-18 13:38:30 -0400
commitd1bdc1238a39469e6760758876e8832019795a54 (patch)
tree2df6f5e0242f36cff0168f8ac1b85b071672ee7d /src/mesa/state_tracker/st_cb_clear.c
parent07fcb06fe0220a51ad20b6b8a70512071999182c (diff)
st/mesa: add support for GL_EXT_window_rectangles
Make sure to pass the requisite information in draws, blits, and clears that work on the context's draw buffer. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_clear.c')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 362cef46286..d630664704b 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -320,6 +320,18 @@ is_scissor_enabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
(unsigned) ctx->Scissor.ScissorArray[0].Height < rb->Height);
}
+/**
+ * Return if window rectangles must be enabled during the clear.
+ */
+static inline bool
+is_window_rectangle_enabled(struct gl_context *ctx)
+{
+ if (ctx->DrawBuffer == ctx->WinSysDrawBuffer)
+ return false;
+ return ctx->Scissor.NumWindowRects > 0 ||
+ ctx->Scissor.WindowRectMode == GL_INCLUSIVE_EXT;
+}
+
/**
* Return if all of the color channels are masked.
@@ -410,6 +422,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
continue;
if (is_scissor_enabled(ctx, rb) ||
+ is_window_rectangle_enabled(ctx) ||
is_color_masked(ctx, colormask_index))
quad_buffers |= PIPE_CLEAR_COLOR0 << i;
else
@@ -422,7 +435,8 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
struct st_renderbuffer *strb = st_renderbuffer(depthRb);
if (strb->surface && ctx->Depth.Mask) {
- if (is_scissor_enabled(ctx, depthRb))
+ if (is_scissor_enabled(ctx, depthRb) ||
+ is_window_rectangle_enabled(ctx))
quad_buffers |= PIPE_CLEAR_DEPTH;
else
clear_buffers |= PIPE_CLEAR_DEPTH;
@@ -433,6 +447,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
if (strb->surface && !is_stencil_disabled(ctx, stencilRb)) {
if (is_scissor_enabled(ctx, stencilRb) ||
+ is_window_rectangle_enabled(ctx) ||
is_stencil_masked(ctx, stencilRb))
quad_buffers |= PIPE_CLEAR_STENCIL;
else