{
LLVMValueRef gs_next_vertex;
LLVMValueRef can_emit;
- int idx;
+ unsigned offset = 0;
struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
assert(stream == 0);
LLVMConstInt(ctx->ac.i32, ctx->gs_max_out_vertices, false), "");
ac_build_kill_if_false(&ctx->ac, can_emit);
- /* loop num outputs */
- idx = 0;
for (unsigned i = 0; i < AC_LLVM_MAX_OUTPUTS; ++i) {
unsigned output_usage_mask =
ctx->shader_info->info.gs.output_usage_mask[i];
LLVMValueRef *out_ptr = &addrs[i * 4];
int length = 4;
- int slot = idx;
- int slot_inc = 1;
if (!(ctx->output_mask & (1ull << i)))
continue;
if (i == VARYING_SLOT_CLIP_DIST0) {
/* pack clip and cull into a single set of slots */
length = util_last_bit(output_usage_mask);
- if (length > 4)
- slot_inc = 2;
}
for (unsigned j = 0; j < length; j++) {
LLVMValueRef out_val = LLVMBuildLoad(ctx->ac.builder,
out_ptr[j], "");
- LLVMValueRef voffset = LLVMConstInt(ctx->ac.i32, (slot * 4 + j) * ctx->gs_max_out_vertices, false);
+ LLVMValueRef voffset =
+ LLVMConstInt(ctx->ac.i32, offset *
+ ctx->gs_max_out_vertices, false);
+
+ offset++;
+
voffset = LLVMBuildAdd(ctx->ac.builder, voffset, gs_next_vertex, "");
voffset = LLVMBuildMul(ctx->ac.builder, voffset, LLVMConstInt(ctx->ac.i32, 4, false), "");
voffset, ctx->gs2vs_offset, 0,
1, 1, true, true);
}
- idx += slot_inc;
}
gs_next_vertex = LLVMBuildAdd(ctx->ac.builder, gs_next_vertex,
LLVMValueRef vtx_offset =
LLVMBuildMul(ctx->ac.builder, ctx->abi.vertex_id,
LLVMConstInt(ctx->ac.i32, 4, false), "");
- int idx = 0;
+ unsigned offset = 0;
for (unsigned i = 0; i < AC_LLVM_MAX_OUTPUTS; ++i) {
unsigned output_usage_mask =
ctx->shader_info->info.gs.output_usage_mask[i];
int length = 4;
- int slot = idx;
- int slot_inc = 1;
+
if (!(ctx->output_mask & (1ull << i)))
continue;
if (i == VARYING_SLOT_CLIP_DIST0) {
/* unpack clip and cull from a single set of slots */
length = util_last_bit(output_usage_mask);
- if (length > 4)
- slot_inc = 2;
}
for (unsigned j = 0; j < length; j++) {
continue;
soffset = LLVMConstInt(ctx->ac.i32,
- (slot * 4 + j) *
+ offset *
ctx->gs_max_out_vertices * 16 * 4, false);
+ offset++;
+
value = ac_build_buffer_load(&ctx->ac, ctx->gsvs_ring,
1, ctx->ac.i32_0,
vtx_offset, soffset,
LLVMBuildStore(ctx->ac.builder,
ac_to_float(&ctx->ac, value), ctx->abi.outputs[ac_llvm_reg_index_soa(i, j)]);
}
- idx += slot_inc;
}
handle_vs_outputs_post(ctx, false, false, &ctx->shader_info->vs.outinfo);
}