radv: Implement VK_EXT_vertex_attribute_divisor.
Pretty straight forward, just pass the divisors through the shader key and then do a LLVM divide. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
@@ -1794,14 +1794,26 @@ handle_vs_input_decl(struct radv_shader_context *ctx,
|
||||
|
||||
for (unsigned i = 0; i < attrib_count; ++i, ++idx) {
|
||||
if (ctx->options->key.vs.instance_rate_inputs & (1u << (index + i))) {
|
||||
buffer_index = LLVMBuildAdd(ctx->ac.builder, ctx->abi.instance_id,
|
||||
ctx->abi.start_instance, "");
|
||||
if (ctx->options->key.vs.as_ls) {
|
||||
ctx->shader_info->vs.vgpr_comp_cnt =
|
||||
MAX2(2, ctx->shader_info->vs.vgpr_comp_cnt);
|
||||
uint32_t divisor = ctx->options->key.vs.instance_rate_divisors[index + i];
|
||||
|
||||
if (divisor) {
|
||||
buffer_index = LLVMBuildAdd(ctx->ac.builder, ctx->abi.instance_id,
|
||||
ctx->abi.start_instance, "");
|
||||
|
||||
if (divisor != 1) {
|
||||
buffer_index = LLVMBuildUDiv(ctx->ac.builder, buffer_index,
|
||||
LLVMConstInt(ctx->ac.i32, divisor, 0), "");
|
||||
}
|
||||
|
||||
if (ctx->options->key.vs.as_ls) {
|
||||
ctx->shader_info->vs.vgpr_comp_cnt =
|
||||
MAX2(2, ctx->shader_info->vs.vgpr_comp_cnt);
|
||||
} else {
|
||||
ctx->shader_info->vs.vgpr_comp_cnt =
|
||||
MAX2(1, ctx->shader_info->vs.vgpr_comp_cnt);
|
||||
}
|
||||
} else {
|
||||
ctx->shader_info->vs.vgpr_comp_cnt =
|
||||
MAX2(1, ctx->shader_info->vs.vgpr_comp_cnt);
|
||||
buffer_index = ctx->ac.i32_0;
|
||||
}
|
||||
} else
|
||||
buffer_index = LLVMBuildAdd(ctx->ac.builder, ctx->abi.vertex_id,
|
||||
|
Reference in New Issue
Block a user