diff options
author | Rob Clark <[email protected]> | 2018-11-13 14:19:38 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2018-11-27 15:44:02 -0500 |
commit | 09300bbe03c05af6c212ae9dff86882e14019007 (patch) | |
tree | 2cc8ddb49a2f8ddfdd8fd775d73d5a95f1c614e9 | |
parent | 65cee01430d03b140c1a916e9409f045e24d4b8f (diff) |
mesa/st: better colormask check for clear fallback
For RGB surfaces (for example) we don't really care that the colormask
is 0x7 instead of 0xf. This should not trigger clear_with_quad()
slowpath.
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 3b51bd2c8a7..88fc12789e3 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -392,12 +392,18 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) if (!strb || !strb->surface) continue; - if (!GET_COLORMASK(ctx->Color.ColorMask, colormask_index)) + unsigned colormask = + GET_COLORMASK(ctx->Color.ColorMask, colormask_index); + + if (!colormask) continue; + unsigned surf_colormask = + util_format_colormask(util_format_description(strb->surface->format)); + if (is_scissor_enabled(ctx, rb) || is_window_rectangle_enabled(ctx) || - GET_COLORMASK(ctx->Color.ColorMask, colormask_index) != 0xf) + ((colormask & surf_colormask) != surf_colormask)) quad_buffers |= PIPE_CLEAR_COLOR0 << i; else clear_buffers |= PIPE_CLEAR_COLOR0 << i; |