radv: prevent linking TCS<->TES when TES is NULL
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 26 Jul 2023 15:34:25 +0000 (17:34 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 28 Jul 2023 08:21:40 +0000 (08:21 +0000)
This can happen with shader object.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24346>

src/amd/vulkan/radv_pipeline_graphics.c
src/amd/vulkan/radv_shader_info.c

index 18a42f9..76d6739 100644 (file)
@@ -1478,6 +1478,9 @@ static void
 radv_link_tcs(const struct radv_device *device, struct radv_shader_stage *tcs_stage,
               struct radv_shader_stage *tes_stage, const struct radv_pipeline_key *pipeline_key)
 {
+   if (!tes_stage)
+      return;
+
    assert(tcs_stage->nir->info.stage == MESA_SHADER_TESS_CTRL);
    assert(tes_stage->nir->info.stage == MESA_SHADER_TESS_EVAL);
 
index 02935f3..8afc134 100644 (file)
@@ -1593,7 +1593,7 @@ radv_link_shaders_info(struct radv_device *device, struct radv_shader_stage *pro
    }
 
    /* Copy shader info between TCS<->TES. */
-   if (producer->stage == MESA_SHADER_TESS_CTRL) {
+   if (producer->stage == MESA_SHADER_TESS_CTRL && consumer && consumer->stage == MESA_SHADER_TESS_EVAL) {
       struct radv_shader_stage *tcs_stage = producer;
       struct radv_shader_stage *tes_stage = consumer;