panvk: Handle input varyings without previous writes
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>
This commit is contained in:
parent
9c60de9b57
commit
d43912b188
|
@ -116,7 +116,13 @@ panvk_varying_hw_format(const struct panvk_device *dev,
|
|||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -827,6 +827,9 @@ panvk_pipeline_builder_collect_varyings(struct panvk_pipeline_builder *builder,
|
|||
/* 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);
|
||||
|
|
Loading…
Reference in New Issue