diff options
author | Erik Faye-Lund <[email protected]> | 2019-10-30 15:37:42 +0100 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2019-11-06 13:43:14 +0100 |
commit | 4e0ca477d868c8cbb62cbe4d030fd0a2f739e3b6 (patch) | |
tree | 904bea42582eedc26187363e8e0ac417a1ed6216 /src/gallium | |
parent | 6630baecf13df823b038e5a4faad79abedd145fa (diff) |
zink/spirv: support loading bool constants
Seems I missed this before; let's add support for this.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index b72c731dd85..47d93efc910 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -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); } |