zink: use template to eliminate more instructions in pipeline state comparison

these values don't need to be checked at all if dynamic vertex is enabled,
which wouldn't previously have been possible without adding even more
data to check to the pipeline state

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
This commit is contained in:
Mike Blumenkrantz
2022-08-04 16:00:37 -04:00
committed by Marge Bot
parent d862871682
commit c58f3ec6fc

View File

@@ -267,12 +267,15 @@ equals_gfx_pipeline_state(const void *a, const void *b)
{
const struct zink_gfx_pipeline_state *sa = (const struct zink_gfx_pipeline_state *)a;
const struct zink_gfx_pipeline_state *sb = (const struct zink_gfx_pipeline_state *)b;
if (sa->uses_dynamic_stride != sb->uses_dynamic_stride)
return false;
if (DYNAMIC_STATE < ZINK_PIPELINE_DYNAMIC_VERTEX_INPUT) {
if (sa->uses_dynamic_stride != sb->uses_dynamic_stride)
return false;
}
/* dynamic vs rp */
if (!!sa->render_pass != !!sb->render_pass)
return false;
if (DYNAMIC_STATE == ZINK_PIPELINE_NO_DYNAMIC_STATE || !sa->uses_dynamic_stride) {
if (DYNAMIC_STATE == ZINK_PIPELINE_NO_DYNAMIC_STATE ||
(DYNAMIC_STATE < ZINK_PIPELINE_DYNAMIC_VERTEX_INPUT && !sa->uses_dynamic_stride)) {
if (sa->vertex_buffers_enabled_mask != sb->vertex_buffers_enabled_mask)
return false;
/* if we don't have dynamic states, we have to hash the enabled vertex buffer bindings */