radv: fix handling multiview with GPL

When multiview is used, the last pre-rasterization stage should export
the layer to the fragment shader. With GPL, the next stage is
implicitly FS.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18699>
This commit is contained in:
Samuel Pitoiset
2022-09-20 12:53:11 +02:00
committed by Marge Bot
parent 0c6f52a999
commit 29305a89b0

View File

@@ -2091,9 +2091,11 @@ radv_should_export_multiview(const struct radv_pipeline_stage *producer,
const struct radv_pipeline_stage *consumer, const struct radv_pipeline_stage *consumer,
const struct radv_pipeline_key *pipeline_key) const struct radv_pipeline_key *pipeline_key)
{ {
/* Export the layer in the last VGT stage if multiview is used. */ /* Export the layer in the last VGT stage if multiview is used. When the next stage is unknown
* (with graphics pipeline library), the layer is exported unconditionally.
*/
return pipeline_key->has_multiview_view_index && return pipeline_key->has_multiview_view_index &&
consumer->stage == MESA_SHADER_FRAGMENT && (!consumer || consumer->stage == MESA_SHADER_FRAGMENT) &&
!(producer->nir->info.outputs_written & VARYING_BIT_LAYER); !(producer->nir->info.outputs_written & VARYING_BIT_LAYER);
} }
@@ -2495,15 +2497,15 @@ radv_pipeline_link_vs(const struct radv_device *device, struct radv_pipeline_sta
NIR_PASS(_, vs_stage->nir, radv_export_implicit_primitive_id); NIR_PASS(_, vs_stage->nir, radv_export_implicit_primitive_id);
} }
if (radv_should_export_multiview(vs_stage, next_stage, pipeline_key)) {
NIR_PASS(_, vs_stage->nir, radv_export_multiview);
}
if (next_stage) { if (next_stage) {
assert(next_stage->nir->info.stage == MESA_SHADER_TESS_CTRL || assert(next_stage->nir->info.stage == MESA_SHADER_TESS_CTRL ||
next_stage->nir->info.stage == MESA_SHADER_GEOMETRY || next_stage->nir->info.stage == MESA_SHADER_GEOMETRY ||
next_stage->nir->info.stage == MESA_SHADER_FRAGMENT); next_stage->nir->info.stage == MESA_SHADER_FRAGMENT);
if (radv_should_export_multiview(vs_stage, next_stage, pipeline_key)) {
NIR_PASS(_, vs_stage->nir, radv_export_multiview);
}
radv_pipeline_link_shaders(device, vs_stage->nir, next_stage->nir, pipeline_key); radv_pipeline_link_shaders(device, vs_stage->nir, next_stage->nir, pipeline_key);
} }
@@ -2565,14 +2567,14 @@ radv_pipeline_link_tes(const struct radv_device *device, struct radv_pipeline_st
NIR_PASS(_, tes_stage->nir, radv_export_implicit_primitive_id); NIR_PASS(_, tes_stage->nir, radv_export_implicit_primitive_id);
} }
if (radv_should_export_multiview(tes_stage, next_stage, pipeline_key)) {
NIR_PASS(_, tes_stage->nir, radv_export_multiview);
}
if (next_stage) { if (next_stage) {
assert(next_stage->nir->info.stage == MESA_SHADER_GEOMETRY || assert(next_stage->nir->info.stage == MESA_SHADER_GEOMETRY ||
next_stage->nir->info.stage == MESA_SHADER_FRAGMENT); next_stage->nir->info.stage == MESA_SHADER_FRAGMENT);
if (radv_should_export_multiview(tes_stage, next_stage, pipeline_key)) {
NIR_PASS(_, tes_stage->nir, radv_export_multiview);
}
radv_pipeline_link_shaders(device, tes_stage->nir, next_stage->nir, pipeline_key); radv_pipeline_link_shaders(device, tes_stage->nir, next_stage->nir, pipeline_key);
} }
@@ -2596,13 +2598,13 @@ radv_pipeline_link_gs(const struct radv_device *device, struct radv_pipeline_sta
{ {
assert(gs_stage->nir->info.stage == MESA_SHADER_GEOMETRY); assert(gs_stage->nir->info.stage == MESA_SHADER_GEOMETRY);
if (radv_should_export_multiview(gs_stage, fs_stage, pipeline_key)) {
NIR_PASS(_, gs_stage->nir, radv_export_multiview);
}
if (fs_stage) { if (fs_stage) {
assert(fs_stage->nir->info.stage == MESA_SHADER_FRAGMENT); assert(fs_stage->nir->info.stage == MESA_SHADER_FRAGMENT);
if (radv_should_export_multiview(gs_stage, fs_stage, pipeline_key)) {
NIR_PASS(_, gs_stage->nir, radv_export_multiview);
}
radv_pipeline_link_shaders(device, gs_stage->nir, fs_stage->nir, pipeline_key); radv_pipeline_link_shaders(device, gs_stage->nir, fs_stage->nir, pipeline_key);
} }