Module: Mesa
Branch: master
Commit: d62bb8bc0df66723fd9d5ccf2d04de2b50e76728
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d62bb8bc0df66723fd9d5ccf2d04de2b50e76728

Author: Dave Airlie <[email protected]>
Date:   Wed Mar 31 10:25:13 2021 +1000

lavapipe: fail out if spirv->nir fails

Just fail out earlier and assume a feature is missing.

Fixes a crash in validation layer tests

Reviewed-By: Mike Blumenkrantz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9937>

---

 src/gallium/frontends/lavapipe/lvp_pipeline.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c 
b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index 671f336abf6..b158419ddde 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -485,6 +485,10 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline,
                       spec_entries, num_spec_entries,
                       stage, entrypoint_name, &spirv_options, drv_options);
 
+   if (!nir) {
+      free(spec_entries);
+      return;
+   }
    nir_validate_shader(nir, NULL);
 
    free(spec_entries);
@@ -753,6 +757,8 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
                                pCreateInfo->pStages[i].pName,
                                stage,
                                pCreateInfo->pStages[i].pSpecializationInfo);
+      if (!pipeline->pipeline_nir[stage])
+         return VK_ERROR_FEATURE_NOT_PRESENT;
    }
 
    if (pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]) {
@@ -878,6 +884,8 @@ lvp_compute_pipeline_init(struct lvp_pipeline *pipeline,
                             pCreateInfo->stage.pName,
                             MESA_SHADER_COMPUTE,
                             pCreateInfo->stage.pSpecializationInfo);
+   if (!pipeline->pipeline_nir[MESA_SHADER_COMPUTE])
+      return VK_ERROR_FEATURE_NOT_PRESENT;
    lvp_pipeline_compile(pipeline, MESA_SHADER_COMPUTE);
    return VK_SUCCESS;
 }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to