Some input varyings might not be written by any of the active stages
preceding the stage reading the varying (e.g. gl_Layer should be set
to 0 when not written by vertex/geometry shaders). In this case, we can
insert a dummy varying attribute returning zero. This is actually what
the code intended to do, but 2 things were missing:
1. formats[NONE] is not mapping to the CONSTANT0 format
2. the offset and strides should always be set to 0 when using a
CONSTANT0 attribute
All of this is needed to have the input attachments working. Indeed, we
use the nir_lower_input_attachments() pass which lowers input attachment
loads to texel fetches, and the txf operation is passed the layer_id
in its 3rd coordinate.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13077>
panfrost_get_default_swizzle(4);
default:
assert(!panvk_varying_is_builtin(stage, loc));
- return pdev->formats[varyings->varying[loc].format].hw;
+ if (varyings->varying[loc].format != PIPE_FORMAT_NONE)
+ return pdev->formats[varyings->varying[loc].format].hw;
+#if PAN_ARCH >= 7
+ return (MALI_CONSTANT << 12) | MALI_RGB_COMPONENT_ORDER_0000;
+#else
+ return (MALI_CONSTANT << 12) | PAN_V6_SWIZZLE(0, 0, 0, 0);
+#endif
}
}
/* TODO: Xfb */
gl_varying_slot loc;
BITSET_FOREACH_SET(loc, pipeline->varyings.active, VARYING_SLOT_MAX) {
+ if (pipeline->varyings.varying[loc].format == PIPE_FORMAT_NONE)
+ continue;
+
enum panvk_varying_buf_id buf_id =
panvk_varying_buf_id(false, loc);
unsigned buf_idx = panvk_varying_buf_index(&pipeline->varyings, buf_id);