radv: pre-calculate viewport transforms

this requires more storage in the viewport struct, but it avoids
the need to repeatedly calculate the same transform if e.g., a meta
operation occurs, which can save about 5% cpu in some cases

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11839>
This commit is contained in:
Mike Blumenkrantz
2021-07-09 14:30:43 -04:00
committed by Marge Bot
parent 1e13cb1965
commit a2ef92d7a5
4 changed files with 23 additions and 13 deletions

View File

@@ -1540,6 +1540,9 @@ radv_pipeline_init_dynamic_state(struct radv_pipeline *pipeline,
if (states & RADV_DYNAMIC_VIEWPORT) {
typed_memcpy(dynamic->viewport.viewports, pCreateInfo->pViewportState->pViewports,
pCreateInfo->pViewportState->viewportCount);
for (unsigned i = 0; i < dynamic->viewport.count; i++)
radv_get_viewport_xform(&dynamic->viewport.viewports[i],
dynamic->viewport.xform[i].scale, dynamic->viewport.xform[i].translate);
}
}