Skip to content

Commit

Permalink
gallium: introcude PIPE_CAP_CLEAR_RESPECTS_SCISSOR
Browse files Browse the repository at this point in the history
  • Loading branch information
kusma committed Oct 26, 2016
1 parent bf3afb0 commit d6be352
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/gallium/include/pipe/p_defines.h
Expand Up @@ -740,6 +740,7 @@ enum pipe_cap
PIPE_CAP_MIXED_COLOR_DEPTH_BITS,
PIPE_CAP_TGSI_ARRAY_COMPONENTS,
PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
PIPE_CAP_CLEAR_RESPECTS_SCISSOR,
};

#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
Expand Down
6 changes: 3 additions & 3 deletions src/mesa/state_tracker/st_cb_clear.c
Expand Up @@ -423,7 +423,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
if (is_color_disabled(ctx, colormask_index))
continue;

if (is_scissor_enabled(ctx, rb) ||
if ((!st->clear_respects_scissor && is_scissor_enabled(ctx, rb)) ||
is_window_rectangle_enabled(ctx) ||
is_color_masked(ctx, colormask_index))
quad_buffers |= PIPE_CLEAR_COLOR0 << i;
Expand All @@ -437,7 +437,7 @@ 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 ((!st->clear_respects_scissor && is_scissor_enabled(ctx, depthRb)) ||
is_window_rectangle_enabled(ctx))
quad_buffers |= PIPE_CLEAR_DEPTH;
else
Expand All @@ -448,7 +448,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
struct st_renderbuffer *strb = st_renderbuffer(stencilRb);

if (strb->surface && !is_stencil_disabled(ctx, stencilRb)) {
if (is_scissor_enabled(ctx, stencilRb) ||
if ((!st->clear_respects_scissor && is_scissor_enabled(ctx, stencilRb)) ||
is_window_rectangle_enabled(ctx) ||
is_stencil_masked(ctx, stencilRb))
quad_buffers |= PIPE_CLEAR_STENCIL;
Expand Down
3 changes: 3 additions & 0 deletions src/mesa/state_tracker/st_context.c
Expand Up @@ -439,6 +439,9 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
st->has_multi_draw_indirect =
screen->get_param(screen, PIPE_CAP_MULTI_DRAW_INDIRECT);

st->clear_respects_scissor = screen->get_param(screen,
PIPE_CAP_CLEAR_RESPECTS_SCISSOR);

/* GL limits and extensions */
st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions);
st_init_extensions(pipe->screen, &ctx->Const,
Expand Down
1 change: 1 addition & 0 deletions src/mesa/state_tracker/st_context.h
Expand Up @@ -96,6 +96,7 @@ struct st_context

boolean needs_texcoord_semantic;
boolean apply_texture_swizzle_to_border_color;
boolean clear_respects_scissor;

/* On old libGL's for linux we need to invalidate the drawables
* on glViewpport calls, this is set via a option.
Expand Down

0 comments on commit d6be352

Please sign in to comment.