turnip: Fix crashes when geometry shader constants aren't used
authorHyunjun Ko <zzoon@igalia.com>
Thu, 23 Apr 2020 02:28:34 +0000 (02:28 +0000)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Apr 2020 05:19:04 +0000 (05:19 +0000)
Fixes dEQP-VK.transform_feedback.fuzz.2_level_array.float.geometry, for
example.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4693>

src/freedreno/vulkan/tu_pipeline.c

index b2d5b69393c95393c321321c1478ba5f9e0b9659..e3ac144603a0f11bb669af0894660fa8aee9d547 100644 (file)
@@ -897,6 +897,8 @@ tu6_emit_link_map(struct tu_cs *cs,
    int size = DIV_ROUND_UP(num_loc, 4);
 
    size = (MIN2(size + base, consumer->constlen) - base) * 4;
+   if (size <= 0)
+      return;
 
    tu6_emit_const(cs, CP_LOAD_STATE6_GEOM, base, SB6_GS_SHADER, 0, size,
                   patch_locs);