aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorMike Blumenkrantz <[email protected]>2020-03-24 12:02:51 -0400
committerMarge Bot <[email protected]>2020-04-29 18:05:06 +0000
commit1c8bcad81a7ce106b37f1ee4a75b817651d6545e (patch)
tree89ce4e4e5cfb117422582b12c284f261b9944ba7 /src/gallium/auxiliary/util
parent882928dcaa2133fe07b73e7e962d50625c8e6a03 (diff)
gallium: add pipe cap for scissored clears and pass scissor state to clear() hook
this adds a new pipe cap that drivers can support which enables passing buffer clears with scissor test enabled through to be handled by the driver instead of having mesa draw a quad also adjust all existing clear() hooks to have the new parameter Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4310>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_screen.c1
-rw-r--r--src/gallium/auxiliary/util/u_tests.c2
-rw-r--r--src/gallium/auxiliary/util/u_threaded_context.c9
3 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index 54ebe77420d..ae024f0e650 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -223,6 +223,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_SHAREABLE_SHADERS:
case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
case PIPE_CAP_CLEAR_TEXTURE:
+ case PIPE_CAP_CLEAR_SCISSORED:
case PIPE_CAP_DRAW_PARAMETERS:
case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
case PIPE_CAP_MULTI_DRAW_INDIRECT:
diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c
index 8ff22bccd4e..00f75906173 100644
--- a/src/gallium/auxiliary/util/u_tests.c
+++ b/src/gallium/auxiliary/util/u_tests.c
@@ -177,7 +177,7 @@ util_set_common_states_and_clear(struct cso_context *cso, struct pipe_context *c
util_set_rasterizer_normal(cso);
util_set_max_viewport(cso, cb);
- ctx->clear(ctx, PIPE_CLEAR_COLOR0, (void*)clear_color, 0, 0);
+ ctx->clear(ctx, PIPE_CLEAR_COLOR0, NULL, (void*)clear_color, 0, 0);
}
static void
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index cfe88d310e8..d8536af77be 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -2343,20 +2343,22 @@ tc_invalidate_resource(struct pipe_context *_pipe,
struct tc_clear {
unsigned buffers;
+ struct pipe_scissor_state scissor_state;
union pipe_color_union color;
double depth;
unsigned stencil;
+ bool scissor_state_set;
};
static void
tc_call_clear(struct pipe_context *pipe, union tc_payload *payload)
{
struct tc_clear *p = (struct tc_clear *)payload;
- pipe->clear(pipe, p->buffers, &p->color, p->depth, p->stencil);
+ pipe->clear(pipe, p->buffers, p->scissor_state_set ? &p->scissor_state : NULL, &p->color, p->depth, p->stencil);
}
static void
-tc_clear(struct pipe_context *_pipe, unsigned buffers,
+tc_clear(struct pipe_context *_pipe, unsigned buffers, const struct pipe_scissor_state *scissor_state,
const union pipe_color_union *color, double depth,
unsigned stencil)
{
@@ -2364,6 +2366,9 @@ tc_clear(struct pipe_context *_pipe, unsigned buffers,
struct tc_clear *p = tc_add_struct_typed_call(tc, TC_CALL_clear, tc_clear);
p->buffers = buffers;
+ if (scissor_state)
+ p->scissor_state = *scissor_state;
+ p->scissor_state_set = !!scissor_state;
p->color = *color;
p->depth = depth;
p->stencil = stencil;