zink: break out program primtype->idx conversion function

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17225>
This commit is contained in:
Mike Blumenkrantz
2022-06-23 17:00:18 -04:00
committed by Marge Bot
parent 2215377aa0
commit 5b7eb0d9d3
+16 -10
View File
@@ -757,6 +757,21 @@ zink_destroy_compute_program(struct zink_context *ctx,
ralloc_free(comp);
}
static unsigned
get_primtype_idx(enum pipe_prim_type mode)
{
if (mode == PIPE_PRIM_PATCHES)
return 3;
switch (u_reduced_prim(mode)) {
case PIPE_PRIM_POINTS:
return 0;
case PIPE_PRIM_LINES:
return 1;
default:
return 2;
}
}
static unsigned
get_pipeline_idx(bool have_EXT_extended_dynamic_state, enum pipe_prim_type mode, VkPrimitiveTopology vkmode)
{
@@ -766,16 +781,7 @@ get_pipeline_idx(bool have_EXT_extended_dynamic_state, enum pipe_prim_type mode,
* with vkCmdSetPrimitiveTopology before any drawing commands.
*/
if (have_EXT_extended_dynamic_state) {
if (mode == PIPE_PRIM_PATCHES)
return 3;
switch (u_reduced_prim(mode)) {
case PIPE_PRIM_POINTS:
return 0;
case PIPE_PRIM_LINES:
return 1;
default:
return 2;
}
return get_primtype_idx(mode);
}
return vkmode;
}