clover/nir: Check the result of spirv_to_nir
authorPierre Moreau <dev@pmoreau.org>
Tue, 5 May 2020 11:13:19 +0000 (13:13 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 7 May 2020 11:05:04 +0000 (11:05 +0000)
Fixes: deb04adf2ae ("clover: add support for passing kernels as nir to the driver")
Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4901>

src/gallium/state_trackers/clover/nir/invocation.cpp

index 87a98046cc1f72b6be40cf824fb50803f86eb2d0..46440d96e09dc2fa9da424381b692281eacf010f 100644 (file)
@@ -90,6 +90,11 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
       nir_shader *nir = spirv_to_nir(data, num_words, nullptr, 0,
                                      MESA_SHADER_KERNEL, name,
                                      &spirv_options, compiler_options);
+      if (!nir) {
+         r_log += "Translation from SPIR-V to NIR for kernel \"" + sym.name +
+                  "\" failed.\n";
+         throw build_error();
+      }
 
       nir->info.cs.local_size_variable = true;
       nir_validate_shader(nir, "clover");