aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-11-13 10:19:25 -0600
committerJason Ekstrand <[email protected]>2018-11-15 19:59:30 -0600
commitb5c48271d4b80438f83b7efa78c7542ba13e6cb9 (patch)
tree0692436c9e8ffde001b9e0d76456b085a1f11d76 /src
parent44b7005581c4dfab43493d9739e326403cc04614 (diff)
nir/glsl: Force 32-bit for UBO and SSBO Booleans
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 0479f8fcfe4..9bb0f5d4044 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -1000,7 +1000,10 @@ nir_visitor::visit(ir_call *ir)
ir_constant *write_mask = ((ir_instruction *)param)->as_constant();
assert(write_mask);
- instr->src[0] = nir_src_for_ssa(evaluate_rvalue(val));
+ nir_ssa_def *nir_val = evaluate_rvalue(val);
+ assert(!val->type->is_boolean() || nir_val->bit_size == 32);
+
+ instr->src[0] = nir_src_for_ssa(nir_val);
instr->src[1] = nir_src_for_ssa(evaluate_rvalue(block));
instr->src[2] = nir_src_for_ssa(evaluate_rvalue(offset));
nir_intrinsic_set_write_mask(instr, write_mask->value.u[0]);
@@ -1023,7 +1026,7 @@ nir_visitor::visit(ir_call *ir)
instr->num_components = type->vector_elements;
/* Setup destination register */
- unsigned bit_size = glsl_get_bit_size(type);
+ unsigned bit_size = type->is_boolean() ? 32 : glsl_get_bit_size(type);
nir_ssa_dest_init(&instr->instr, &instr->dest,
type->vector_elements, bit_size, NULL);
@@ -1100,7 +1103,7 @@ nir_visitor::visit(ir_call *ir)
instr->num_components = type->vector_elements;
/* Setup destination register */
- unsigned bit_size = glsl_get_bit_size(type);
+ unsigned bit_size = type->is_boolean() ? 32 : glsl_get_bit_size(type);
nir_ssa_dest_init(&instr->instr, &instr->dest,
type->vector_elements, bit_size, NULL);
@@ -1123,7 +1126,10 @@ nir_visitor::visit(ir_call *ir)
nir_intrinsic_set_write_mask(instr, write_mask->value.u[0]);
- instr->src[0] = nir_src_for_ssa(evaluate_rvalue(val));
+ nir_ssa_def *nir_val = evaluate_rvalue(val);
+ assert(!val->type->is_boolean() || nir_val->bit_size == 32);
+
+ instr->src[0] = nir_src_for_ssa(nir_val);
instr->num_components = val->type->vector_elements;
nir_builder_instr_insert(&b, &instr->instr);
@@ -1377,7 +1383,8 @@ nir_visitor::visit(ir_expression *ir)
case ir_binop_ubo_load: {
nir_intrinsic_instr *load =
nir_intrinsic_instr_create(this->shader, nir_intrinsic_load_ubo);
- unsigned bit_size = glsl_get_bit_size(ir->type);
+ unsigned bit_size = ir->type->is_boolean() ? 32 :
+ glsl_get_bit_size(ir->type);
load->num_components = ir->type->vector_elements;
load->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[0]));
load->src[1] = nir_src_for_ssa(evaluate_rvalue(ir->operands[1]));