zink: run nir_lower_uniforms_to_ubo conditionally
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 26 Jun 2020 19:15:07 +0000 (15:15 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 2 Oct 2020 13:07:42 +0000 (13:07 +0000)
if a shader has no uniforms then this pass just messes with the instructions
pointlessly and forces us to need workarounds later on in ntv

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6981>

src/gallium/drivers/zink/zink_compiler.c

index 740b795..942d6b2 100644 (file)
@@ -259,7 +259,11 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir,
 
    ret->programs = _mesa_pointer_set_create(NULL);
 
-   NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 1);
+   /* only do uniforms -> ubo if we have uniforms, otherwise we're just
+    * screwing with the bindings for no reason
+    */
+   if (nir->num_uniforms)
+      NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 1);
    NIR_PASS_V(nir, nir_lower_clip_halfz);
    if (nir->info.stage == MESA_SHADER_VERTEX)
       have_psiz = check_psiz(nir);