mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
glsl: support unsigned increment in ir_loop controls
Current version can create ir_expression where operands have different base type, patch adds support for unsigned type. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Tested-by: Michel Dänzer <michel.daenzer@amd.com> https://bugs.freedesktop.org/show_bug.cgi?id=80880
This commit is contained in:
parent
787bac3808
commit
151fb1e808
1 changed files with 14 additions and 3 deletions
|
|
@ -123,9 +123,20 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
|
||||||
bool valid_loop = false;
|
bool valid_loop = false;
|
||||||
|
|
||||||
for (unsigned i = 0; i < Elements(bias); i++) {
|
for (unsigned i = 0; i < Elements(bias); i++) {
|
||||||
iter = (increment->type->is_integer())
|
/* Increment may be of type int, uint or float. */
|
||||||
? new(mem_ctx) ir_constant(iter_value + bias[i])
|
switch (increment->type->base_type) {
|
||||||
: new(mem_ctx) ir_constant(float(iter_value + bias[i]));
|
case GLSL_TYPE_INT:
|
||||||
|
iter = new(mem_ctx) ir_constant(iter_value + bias[i]);
|
||||||
|
break;
|
||||||
|
case GLSL_TYPE_UINT:
|
||||||
|
iter = new(mem_ctx) ir_constant(unsigned(iter_value + bias[i]));
|
||||||
|
break;
|
||||||
|
case GLSL_TYPE_FLOAT:
|
||||||
|
iter = new(mem_ctx) ir_constant(float(iter_value + bias[i]));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unreachable(!"Unsupported type for loop iterator.");
|
||||||
|
}
|
||||||
|
|
||||||
ir_expression *const mul =
|
ir_expression *const mul =
|
||||||
new(mem_ctx) ir_expression(ir_binop_mul, increment->type, iter,
|
new(mem_ctx) ir_expression(ir_binop_mul, increment->type, iter,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue