llvmpipe: fix variable naming insanity in cs generator
in the top part of this function, the x/y/z size variables are used to represent the loop iterator limits in the bottom part, they change to represent the loop iterator values my brain. Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15354>
This commit is contained in:

committed by
Marge Bot

parent
102f6ebc57
commit
f150bff04f
@@ -75,7 +75,7 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
LLVMTypeRef func_type, coro_func_type;
|
||||
LLVMTypeRef int32_type = LLVMInt32TypeInContext(gallivm->context);
|
||||
LLVMValueRef context_ptr;
|
||||
LLVMValueRef x_size_arg, y_size_arg, z_size_arg;
|
||||
LLVMValueRef block_x_size_arg, block_y_size_arg, block_z_size_arg;
|
||||
LLVMValueRef grid_x_arg, grid_y_arg, grid_z_arg;
|
||||
LLVMValueRef grid_size_x_arg, grid_size_y_arg, grid_size_z_arg;
|
||||
LLVMValueRef work_dim_arg, thread_data_ptr;
|
||||
@@ -152,9 +152,9 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
return;
|
||||
|
||||
context_ptr = LLVMGetParam(function, 0);
|
||||
x_size_arg = LLVMGetParam(function, 1);
|
||||
y_size_arg = LLVMGetParam(function, 2);
|
||||
z_size_arg = LLVMGetParam(function, 3);
|
||||
block_x_size_arg = LLVMGetParam(function, 1);
|
||||
block_y_size_arg = LLVMGetParam(function, 2);
|
||||
block_z_size_arg = LLVMGetParam(function, 3);
|
||||
grid_x_arg = LLVMGetParam(function, 4);
|
||||
grid_y_arg = LLVMGetParam(function, 5);
|
||||
grid_z_arg = LLVMGetParam(function, 6);
|
||||
@@ -165,9 +165,9 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
thread_data_ptr = LLVMGetParam(function, 11);
|
||||
|
||||
lp_build_name(context_ptr, "context");
|
||||
lp_build_name(x_size_arg, "x_size");
|
||||
lp_build_name(y_size_arg, "y_size");
|
||||
lp_build_name(z_size_arg, "z_size");
|
||||
lp_build_name(block_x_size_arg, "x_size");
|
||||
lp_build_name(block_y_size_arg, "y_size");
|
||||
lp_build_name(block_z_size_arg, "z_size");
|
||||
lp_build_name(grid_x_arg, "grid_x");
|
||||
lp_build_name(grid_y_arg, "grid_y");
|
||||
lp_build_name(grid_z_arg, "grid_z");
|
||||
@@ -187,13 +187,13 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
struct lp_build_loop_state loop_state[4];
|
||||
LLVMValueRef num_x_loop;
|
||||
LLVMValueRef vec_length = lp_build_const_int32(gallivm, cs_type.length);
|
||||
num_x_loop = LLVMBuildAdd(gallivm->builder, x_size_arg, vec_length, "");
|
||||
num_x_loop = LLVMBuildAdd(gallivm->builder, block_x_size_arg, vec_length, "");
|
||||
num_x_loop = LLVMBuildSub(gallivm->builder, num_x_loop, lp_build_const_int32(gallivm, 1), "");
|
||||
num_x_loop = LLVMBuildUDiv(gallivm->builder, num_x_loop, vec_length, "");
|
||||
LLVMValueRef partials = LLVMBuildURem(gallivm->builder, x_size_arg, vec_length, "");
|
||||
LLVMValueRef partials = LLVMBuildURem(gallivm->builder, block_x_size_arg, vec_length, "");
|
||||
|
||||
LLVMValueRef coro_num_hdls = LLVMBuildMul(gallivm->builder, num_x_loop, y_size_arg, "");
|
||||
coro_num_hdls = LLVMBuildMul(gallivm->builder, coro_num_hdls, z_size_arg, "");
|
||||
LLVMValueRef coro_num_hdls = LLVMBuildMul(gallivm->builder, num_x_loop, block_y_size_arg, "");
|
||||
coro_num_hdls = LLVMBuildMul(gallivm->builder, coro_num_hdls, block_z_size_arg, "");
|
||||
|
||||
/* build a ptr in memory to store all the frames in later. */
|
||||
LLVMTypeRef hdl_ptr_type = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0);
|
||||
@@ -234,13 +234,13 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
args[11] = thread_data_ptr;
|
||||
args[12] = num_x_loop;
|
||||
args[13] = partials;
|
||||
args[14] = x_size_arg;
|
||||
args[15] = y_size_arg;
|
||||
args[16] = z_size_arg;
|
||||
args[14] = block_x_size_arg;
|
||||
args[15] = block_y_size_arg;
|
||||
args[16] = block_z_size_arg;
|
||||
|
||||
/* idx = (z * (size_x * size_y) + y * size_x + x */
|
||||
LLVMValueRef coro_hdl_idx = LLVMBuildMul(gallivm->builder, loop_state[2].counter,
|
||||
LLVMBuildMul(gallivm->builder, num_x_loop, y_size_arg, ""), "");
|
||||
LLVMBuildMul(gallivm->builder, num_x_loop, block_y_size_arg, ""), "");
|
||||
coro_hdl_idx = LLVMBuildAdd(gallivm->builder, coro_hdl_idx,
|
||||
LLVMBuildMul(gallivm->builder, loop_state[1].counter,
|
||||
num_x_loop, ""), "");
|
||||
@@ -280,10 +280,10 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
num_x_loop,
|
||||
NULL, LLVMIntUGE);
|
||||
lp_build_loop_end_cond(&loop_state[1],
|
||||
y_size_arg,
|
||||
block_y_size_arg,
|
||||
NULL, LLVMIntUGE);
|
||||
lp_build_loop_end_cond(&loop_state[2],
|
||||
z_size_arg,
|
||||
block_z_size_arg,
|
||||
NULL, LLVMIntUGE);
|
||||
lp_build_loop_end_cond(&loop_state[3],
|
||||
lp_build_const_int32(gallivm, end_coroutine),
|
||||
@@ -295,7 +295,7 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
LLVMBuildRetVoid(builder);
|
||||
|
||||
/* This is stage (b) - generate the compute shader code inside the coroutine. */
|
||||
LLVMValueRef block_x_size_arg, block_y_size_arg, block_z_size_arg;
|
||||
LLVMValueRef x_size_arg, y_size_arg, z_size_arg;
|
||||
context_ptr = LLVMGetParam(coro, 0);
|
||||
x_size_arg = LLVMGetParam(coro, 1);
|
||||
y_size_arg = LLVMGetParam(coro, 2);
|
||||
|
Reference in New Issue
Block a user