st/mesa: lower images when needed
authorKarol Herbst <kherbst@redhat.com>
Mon, 15 Jun 2020 13:14:58 +0000 (15:14 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 18 Jun 2020 15:15:17 +0000 (15:15 +0000)
The "st/pbo download FS" builtin shader uses image derefs, so even with
PIPE_CAP_NIR_IMAGES_AS_DEREF set to 0 drivers ended up with those.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5480>

src/mesa/state_tracker/st_nir_builtins.c

index 52e68d3f69c8f25f44dfd2b318fbfe1a2660daaf..77ec8725ff7b28b1dc9712f37ddb3406164c1fa7 100644 (file)
@@ -24,6 +24,7 @@
 #include "st_nir.h"
 
 #include "compiler/nir/nir_builder.h"
+#include "compiler/glsl/gl_nir.h"
 
 struct pipe_shader_state *
 st_nir_finish_builtin_shader(struct st_context *st,
@@ -58,6 +59,8 @@ st_nir_finish_builtin_shader(struct st_context *st,
 
    st_nir_lower_samplers(screen, nir, NULL, NULL);
    st_nir_lower_uniforms(st, nir);
+   if (!screen->get_param(screen, PIPE_CAP_NIR_IMAGES_AS_DEREF))
+      NIR_PASS_V(nir, gl_nir_lower_images, false);
 
    if (screen->finalize_nir)
       screen->finalize_nir(screen, nir, true);