Mesa (main): llvmpipe: clamp surface clear geometry
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Mar 8 22:18:18 UTC 2022
Module: Mesa
Branch: main
Commit: 165a880f1ae1f528d597bf3de138a29445b01a48
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=165a880f1ae1f528d597bf3de138a29445b01a48
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Jan 31 10:18:10 2022 -0500
llvmpipe: clamp surface clear geometry
avoid oob writes to avoid crashing
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14655>
---
src/gallium/drivers/llvmpipe/lp_surface.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index a116b02005f..6a081f9696a 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -311,6 +311,9 @@ llvmpipe_clear_render_target(struct pipe_context *pipe,
if (render_condition_enabled && !llvmpipe_check_render_cond(llvmpipe))
return;
+ width = MIN2(width, dst->texture->width0 - dstx);
+ height = MIN2(height, dst->texture->height0 - dsty);
+
if (dst->texture->nr_samples > 1) {
struct pipe_box box;
u_box_2d(dstx, dsty, width, height, &box);
@@ -379,6 +382,9 @@ llvmpipe_clear_depth_stencil(struct pipe_context *pipe,
if (render_condition_enabled && !llvmpipe_check_render_cond(llvmpipe))
return;
+ width = MIN2(width, dst->texture->width0 - dstx);
+ height = MIN2(height, dst->texture->height0 - dsty);
+
if (dst->texture->nr_samples > 1) {
uint64_t zstencil = util_pack64_z_stencil(dst->format, depth, stencil);
struct pipe_box box;
More information about the mesa-commit
mailing list