diff options
author | Erik Faye-Lund <[email protected]> | 2019-07-19 15:49:23 +0200 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2019-10-28 08:51:47 +0000 |
commit | f048196f9e1abc461bde6e42df824734b14c2fd8 (patch) | |
tree | cbddf477322ed30838ef301f1c3a88f0c8959ac1 | |
parent | 0f697be76d7873c277d2daa520922bbf3b02fbe0 (diff) |
zink/spirv: add emit_bitcast-helper
Acked-by: Jordan Justen <[email protected]>
-rw-r--r-- | src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 17 |
1 files changed, 11 insertions, 6 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 343f615c97f..5f541c7b371 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 @@ -559,11 +559,17 @@ uvec_to_bvec(struct ntv_context *ctx, SpvId value, unsigned num_components) } static SpvId +emit_bitcast(struct ntv_context *ctx, SpvId type, SpvId value) +{ + return emit_unop(ctx, SpvOpBitcast, type, value); +} + +static SpvId bitcast_to_uvec(struct ntv_context *ctx, SpvId value, unsigned bit_size, unsigned num_components) { SpvId type = get_uvec_type(ctx, bit_size, num_components); - return emit_unop(ctx, SpvOpBitcast, type, value); + return emit_bitcast(ctx, type, value); } static SpvId @@ -571,7 +577,7 @@ bitcast_to_ivec(struct ntv_context *ctx, SpvId value, unsigned bit_size, unsigned num_components) { SpvId type = get_ivec_type(ctx, bit_size, num_components); - return emit_unop(ctx, SpvOpBitcast, type, value); + return emit_bitcast(ctx, type, value); } static SpvId @@ -579,7 +585,7 @@ bitcast_to_fvec(struct ntv_context *ctx, SpvId value, unsigned bit_size, unsigned num_components) { SpvId type = get_fvec_type(ctx, bit_size, num_components); - return emit_unop(ctx, SpvOpBitcast, type, value); + return emit_bitcast(ctx, type, value); } static void @@ -1086,9 +1092,8 @@ emit_store_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr) SpvId src = get_src_uint(ctx, &intr->src[1]); nir_variable *var = nir_intrinsic_get_var(intr, 0); - SpvId result = emit_unop(ctx, SpvOpBitcast, - get_glsl_type(ctx, glsl_without_array(var->type)), - src); + SpvId type = get_glsl_type(ctx, glsl_without_array(var->type)); + SpvId result = emit_bitcast(ctx, type, src); spirv_builder_emit_store(&ctx->builder, ptr, result); } |