spirv2nir: print nir shader if translation succed
authorElie Tournier <tournier.elie@gmail.com>
Mon, 3 Feb 2020 15:33:34 +0000 (15:33 +0000)
committerMarge Bot <eric+marge@anholt.net>
Fri, 14 Feb 2020 11:14:58 +0000 (11:14 +0000)
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3678>

src/compiler/spirv/spirv2nir.c

index 72c607c458d98fde2507e4a286816dadf08b37f0..62bef2e489786da2433688397bf17e11181421f3 100644 (file)
@@ -79,7 +79,11 @@ int main(int argc, char **argv)
    nir_shader *nir = spirv_to_nir(map, word_count, NULL, 0,
                                   MESA_SHADER_FRAGMENT, "main",
                                   &spirv_opts, NULL);
-   nir_print_shader(nir, stderr);
+
+   if (nir)
+      nir_print_shader(nir, stderr);
+   else
+      fprintf(stderr, "SPIRV to NIR compilation failed\n");
 
    glsl_type_singleton_decref();