mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 09:58:05 +02:00
zink/spirv: support loading bool constants
Seems I missed this before; let's add support for this.
This commit is contained in:
parent
6630baecf1
commit
4e0ca477d8
1 changed files with 21 additions and 5 deletions
|
|
@ -1058,18 +1058,34 @@ emit_load_const(struct ntv_context *ctx, nir_load_const_instr *load_const)
|
|||
SpvId constant;
|
||||
if (num_components > 1) {
|
||||
SpvId components[num_components];
|
||||
for (int i = 0; i < num_components; i++)
|
||||
components[i] = emit_uint_const(ctx, bit_size,
|
||||
load_const->value[i].u32);
|
||||
SpvId type;
|
||||
if (bit_size == 1) {
|
||||
for (int i = 0; i < num_components; i++)
|
||||
components[i] = spirv_builder_const_bool(&ctx->builder,
|
||||
load_const->value[i].b);
|
||||
|
||||
SpvId type = get_uvec_type(ctx, bit_size, num_components);
|
||||
type = get_bvec_type(ctx, num_components);
|
||||
} else {
|
||||
for (int i = 0; i < num_components; i++)
|
||||
components[i] = emit_uint_const(ctx, bit_size,
|
||||
load_const->value[i].u32);
|
||||
|
||||
type = get_uvec_type(ctx, bit_size, num_components);
|
||||
}
|
||||
constant = spirv_builder_const_composite(&ctx->builder, type,
|
||||
components, num_components);
|
||||
} else {
|
||||
assert(num_components == 1);
|
||||
constant = emit_uint_const(ctx, bit_size, load_const->value[0].u32);
|
||||
if (bit_size == 1)
|
||||
constant = spirv_builder_const_bool(&ctx->builder,
|
||||
load_const->value[0].b);
|
||||
else
|
||||
constant = emit_uint_const(ctx, bit_size, load_const->value[0].u32);
|
||||
}
|
||||
|
||||
if (bit_size == 1)
|
||||
constant = bvec_to_uvec(ctx, constant, num_components);
|
||||
|
||||
store_ssa_def_uint(ctx, &load_const->def, constant);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue