Mesa (master): st/mesa: skip glDrawPixels if it's totally clipped for all codepaths
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jan 1 16:51:53 UTC 2021
Module: Mesa
Branch: master
Commit: 7de14689322bf4d51ce963cb056606da4a716103
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7de14689322bf4d51ce963cb056606da4a716103
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sun Oct 11 21:27:21 2020 -0400
st/mesa: skip glDrawPixels if it's totally clipped for all codepaths
Reviewed-by: Zoltán Böszörményi <zboszor at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7720>
---
src/mesa/state_tracker/st_cb_drawpixels.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index a2dc42df00c..34cdff4c866 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -957,14 +957,6 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
GLubyte *sValues;
GLuint *zValues;
- if (!zoom) {
- if (!_mesa_clip_drawpixels(ctx, &x, &y, &width, &height,
- &clippedUnpack)) {
- /* totally clipped */
- return;
- }
- }
-
strb = st_renderbuffer(ctx->DrawBuffer->
Attachment[BUFFER_STENCIL].Renderbuffer);
@@ -1320,12 +1312,18 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
st_validate_state(st, ST_PIPELINE_META);
+ clippedUnpack = *unpack;
+ unpack = &clippedUnpack;
+
+ /* Skip totally clipped DrawPixels. */
+ if (ctx->Pixel.ZoomX == 1 && ctx->Pixel.ZoomY == 1 &&
+ !_mesa_clip_drawpixels(ctx, &x, &y, &width, &height, &clippedUnpack))
+ return;
+
/* Limit the size of the glDrawPixels to the max texture size.
* Strictly speaking, that's not correct but since we don't handle
* larger images yet, this is better than crashing.
*/
- clippedUnpack = *unpack;
- unpack = &clippedUnpack;
clamp_size(st, &width, &height, &clippedUnpack);
if (format == GL_DEPTH_STENCIL)
More information about the mesa-commit
mailing list