diff options
author | Dave Airlie <airlied@redhat.com> | 2021-03-31 10:25:13 +1000 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-03-31 05:23:57 +0000 |
commit | d62bb8bc0df66723fd9d5ccf2d04de2b50e76728 (patch) | |
tree | b35ddac667b1538e33022102867a89a293d84328 | |
parent | a17e10b1096f4b03ba71485a3586d2fdbb3cd8a4 (diff) |
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 <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9937>
-rw-r--r-- | src/gallium/frontends/lavapipe/lvp_pipeline.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; } |