summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-12-07 23:42:15 -0800
committerJason Ekstrand <[email protected]>2017-12-12 07:34:46 -0800
commit7d3ebd128602e9bd1f5b0b5b837016ee5fd932c4 (patch)
treed919a524a8c4e8904e29e4be89b960c00607416f /src/compiler/spirv
parente6ba457c9991490d2762d217d32b08f337e3dfbc (diff)
spirv/cfg: Refactor the function parameter loop a bit
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/vtn_cfg.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 182251358c9..9f3f55f07dc 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -51,16 +51,20 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
func->num_params = func_type->length;
func->params = ralloc_array(b->shader, nir_parameter, func->num_params);
- for (unsigned i = 0; i < func->num_params; i++) {
+ unsigned np = 0;
+ for (unsigned i = 0; i < func_type->length; i++) {
if (func_type->params[i]->base_type == vtn_base_type_pointer &&
func_type->params[i]->type == NULL) {
- func->params[i].type = func_type->params[i]->deref->type;
- func->params[i].param_type = nir_parameter_inout;
+ func->params[np].type = func_type->params[i]->deref->type;
+ func->params[np].param_type = nir_parameter_inout;
+ np++;
} else {
- func->params[i].type = func_type->params[i]->type;
- func->params[i].param_type = nir_parameter_in;
+ func->params[np].type = func_type->params[i]->type;
+ func->params[np].param_type = nir_parameter_in;
+ np++;
}
}
+ assert(np == func->num_params);
func->return_type = func_type->return_type->type;