radv: Use 0 for the layer id if the vertex shader does not export it.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 17 Aug 2017 22:32:41 +0000 (00:32 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 24 Aug 2017 17:20:47 +0000 (19:20 +0200)
To use when we have e.g. input attachments, but there is no layer
export in the previous shader and hence no layered rendering.

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_pipeline.c

index 23b9e72f92ac0a9b2fb35b958aa7eb401bb3e2bd..477abfe491582930b0700bbb33ebe5e0a88c73fc 100644 (file)
@@ -2119,10 +2119,11 @@ static void calculate_ps_inputs(struct radv_pipeline *pipeline)
 
        if (ps->info.fs.layer_input) {
                unsigned vs_offset = outinfo->vs_output_param_offset[VARYING_SLOT_LAYER];
-               if (vs_offset != AC_EXP_PARAM_UNDEFINED) {
+               if (vs_offset != AC_EXP_PARAM_UNDEFINED)
                        pipeline->graphics.ps_input_cntl[ps_offset] = offset_to_ps_input(vs_offset, true);
-                       ++ps_offset;
-               }
+               else
+                       pipeline->graphics.ps_input_cntl[ps_offset] = offset_to_ps_input(AC_EXP_PARAM_DEFAULT_VAL_0000, true);
+               ++ps_offset;
        }
 
        if (ps->info.fs.has_pcoord) {