summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-03-22 18:48:01 -0700
committerJason Ekstrand <[email protected]>2018-06-22 20:15:58 -0700
commit58799b6a5b3e281365bce91fac2e54903fbd2c41 (patch)
tree5c3aec35c5ff79d5e1ce41d2923b3018834aea72 /src/compiler/spirv
parent3fc3798677545610f624c0887065e9cb6fcc6db2 (diff)
spirv/cfg: Make the builder fully capable for both walks
We were only initializing vtn_builder::func for the pre-walk where we build the CFG. We were only initializing the nir_builder for the later walk through the instructions even though were were setting b->cursor for the pre-walk. Let's set both both places so that everything is consistent. This useful because we handle OpFunctionParameter in the pre-walk and we're going to need to be able to emit instructions. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/vtn_cfg.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index efae35ccc1e..d0634d59c0f 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -95,6 +95,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
func->return_type = func_type->return_type->type;
b->func->impl = nir_function_impl_create(func);
+ nir_builder_init(&b->nb, func->impl);
b->nb.cursor = nir_before_cf_list(&b->func->impl->body);
b->func_param_idx = 0;
@@ -891,6 +892,7 @@ vtn_function_emit(struct vtn_builder *b, struct vtn_function *func,
vtn_instruction_handler instruction_handler)
{
nir_builder_init(&b->nb, func->impl);
+ b->func = func;
b->nb.cursor = nir_after_cf_list(&func->impl->body);
b->has_loop_continue = false;
b->phi_table = _mesa_hash_table_create(b, _mesa_hash_pointer,