panfrost: Don't copy uniforms when the size is zero
authorIcecream95 <ixn@keemail.me>
Fri, 24 Jan 2020 06:45:17 +0000 (19:45 +1300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 27 Jan 2020 13:23:34 +0000 (13:23 +0000)
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@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

index c94d5cd93b926a0eeb0b6c85cd010bb488591f21..a3d95a315847a4490c2b3acc980d88266e91b69b 100644 (file)
@@ -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);
                 }