Mesa (master): panfrost: Don't copy uniforms when the size is zero

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 27 13:36:33 UTC 2020


Module: Mesa
Branch: master
Commit: 800487488535e6042101930b96c61af184170614
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=800487488535e6042101930b96c61af184170614

Author: Icecream95 <ixn at keemail.me>
Date:   Fri Jan 24 19:45:17 2020 +1300

panfrost: Don't copy uniforms when the size is zero

This fixes a crash when using Gallium HUD with QuakeSpasm when gamma
correction shaders (a QuakeSpasm feature, not part of Mesa) are used.

Reviewd-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3549>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3549>

---

 src/gallium/drivers/panfrost/pan_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index c94d5cd93b9..a3d95a31584 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1093,7 +1093,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
                 panfrost_upload_sysvals(ctx, transfer.cpu, ss, i);
 
                 /* Upload uniforms */
-                if (has_uniforms) {
+                if (has_uniforms && uniform_size) {
                         const void *cpu = panfrost_map_constant_buffer_cpu(buf, 0);
                         memcpy(transfer.cpu + sys_size, cpu, uniform_size);
                 }



More information about the mesa-commit mailing list