mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-25 20:00:37 +02:00
radv: store the topology instead of the output primitive type in the key
To match the pipeline key. 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/13032>
This commit is contained in:
parent
112d526f77
commit
c97147984b
5 changed files with 32 additions and 30 deletions
|
|
@ -1617,8 +1617,10 @@ handle_ngg_outputs_post_2(struct radv_shader_context *ctx)
|
|||
LLVMValueRef provoking_vtx_in_prim = LLVMConstInt(ctx->ac.i32, 0, false);
|
||||
|
||||
/* For provoking vertex last mode, use num_vtx_in_prim - 1. */
|
||||
if (ctx->args->options->key.vs.provoking_vtx_last)
|
||||
provoking_vtx_in_prim = LLVMConstInt(ctx->ac.i32, ctx->args->options->key.vs.outprim, false);
|
||||
if (ctx->args->options->key.vs.provoking_vtx_last) {
|
||||
uint8_t outprim = si_conv_prim_to_gs_out(ctx->args->options->key.vs.topology);
|
||||
provoking_vtx_in_prim = LLVMConstInt(ctx->ac.i32, outprim, false);
|
||||
}
|
||||
|
||||
/* provoking_vtx_index = vtxindex[provoking_vtx_in_prim]; */
|
||||
LLVMValueRef indices = ac_build_gather_values(&ctx->ac, vtxindex, 3);
|
||||
|
|
|
|||
|
|
@ -1237,30 +1237,6 @@ si_conv_gl_prim_to_gs_out(unsigned gl_prim)
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
si_conv_prim_to_gs_out(enum VkPrimitiveTopology topology)
|
||||
{
|
||||
switch (topology) {
|
||||
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
|
||||
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
|
||||
return V_028A6C_POINTLIST;
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
|
||||
return V_028A6C_LINESTRIP;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
|
||||
return V_028A6C_TRISTRIP;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
radv_dynamic_state_mask(VkDynamicState state)
|
||||
{
|
||||
|
|
@ -2771,8 +2747,8 @@ radv_fill_shader_keys(struct radv_device *device, struct radv_shader_variant_key
|
|||
}
|
||||
for (unsigned i = 0; i < MAX_VBS; ++i)
|
||||
keys[MESA_SHADER_VERTEX].vs.vertex_binding_align[i] = key->vertex_binding_align[i];
|
||||
keys[MESA_SHADER_VERTEX].vs.outprim = si_conv_prim_to_gs_out(key->topology);
|
||||
keys[MESA_SHADER_VERTEX].vs.provoking_vtx_last = key->provoking_vtx_last;
|
||||
keys[MESA_SHADER_VERTEX].vs.topology = key->topology;
|
||||
|
||||
if (nir[MESA_SHADER_TESS_CTRL]) {
|
||||
keys[MESA_SHADER_VERTEX].vs_common_out.as_ls = true;
|
||||
|
|
|
|||
|
|
@ -2716,6 +2716,30 @@ si_conv_gl_prim_to_vertices(unsigned gl_prim)
|
|||
}
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
si_conv_prim_to_gs_out(enum VkPrimitiveTopology topology)
|
||||
{
|
||||
switch (topology) {
|
||||
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
|
||||
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
|
||||
return V_028A6C_POINTLIST;
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
|
||||
return V_028A6C_LINESTRIP;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
|
||||
return V_028A6C_TRISTRIP;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct radv_extra_render_pass_begin_info {
|
||||
bool disable_dcc;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -949,7 +949,7 @@ void radv_lower_ngg(struct radv_device *device, struct nir_shader *nir,
|
|||
|
||||
} else if (nir->info.stage == MESA_SHADER_VERTEX) {
|
||||
/* Need to add 1, because: V_028A6C_POINTLIST=0, V_028A6C_LINESTRIP=1, V_028A6C_TRISTRIP=2, etc. */
|
||||
num_vertices_per_prim = key->vs.outprim + 1;
|
||||
num_vertices_per_prim = si_conv_prim_to_gs_out(pl_key->topology) + 1;
|
||||
|
||||
/* Manually mark the instance ID used, so the shader can repack it. */
|
||||
if (key->vs.instance_rate_inputs)
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ struct radv_vs_variant_key {
|
|||
/* For some formats the channels have to be shuffled. */
|
||||
uint32_t post_shuffle;
|
||||
|
||||
/* Output primitive type. */
|
||||
uint8_t outprim;
|
||||
/* Topology. */
|
||||
uint8_t topology;
|
||||
|
||||
/* Provoking vertex mode. */
|
||||
bool provoking_vtx_last;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue