+static SpvId
+pad_coord_vector(struct ntv_context *ctx, SpvId orig, unsigned old_size, unsigned new_size)
+{
+ SpvId int_type = spirv_builder_type_int(&ctx->builder, 32);
+ SpvId type = get_ivec_type(ctx, 32, new_size);
+ SpvId constituents[NIR_MAX_VEC_COMPONENTS] = {0};
+ SpvId zero = emit_int_const(ctx, 32, 0);
+ assert(new_size < NIR_MAX_VEC_COMPONENTS);
+
+ if (old_size == 1)
+ constituents[0] = orig;
+ else {
+ for (unsigned i = 0; i < old_size; i++)
+ constituents[i] = spirv_builder_emit_vector_extract(&ctx->builder, int_type, orig, i);
+ }
+
+ for (unsigned i = old_size; i < new_size; i++)
+ constituents[i] = zero;
+
+ return spirv_builder_emit_composite_construct(&ctx->builder, type,
+ constituents, new_size);
+}
+