---
title: "vec2i(): IR builder function in typeshade/core/ir, TypeShade"
description: "vec2i, an IR builder function in typeshade/core/ir. A vec2<i32> constructor, WGSL-style: vec2i(x, y)."
url: https://typeshade.dev/api/vec2i/
language: en
---

# `vec2i()`

Function in Builtins

A `vec2<i32>` constructor, WGSL-style: `vec2i`(x, y).

`import { vec2i } from 'typeshade/core/ir'`

This export returns an IR node. A `"use typeshade"` file calls the builtin itself: [`vec2i()`](https://typeshade.dev/reference/functions/vec2i/)

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
const vec2i: (...a: NodeLike[]) => Node<"vec2<i32>">
```

## Parameters

**`...a` `NodeLike[]`**

## Return value

`Node<'vec2<i32>'>`

## Description

Bare number components lift to `i32`, the type of the integer texel coordinate [`textureLoad`](https://typeshade.dev/api/textureload/) takes (`vec2i(toI32(...), toI32(...))`).

## Examples

### Example

```ts
import { vec2i, toI32, f32T, fn } from 'typeshade/core/ir'

const coord = fn('coord', { u: f32T, v: f32T }, ({ u, v }) => vec2i(toI32(u), toI32(v)))
```

## In the guide

- [Values and mutation](https://typeshade.dev/guide/internals/values-and-mutation/)

## See also

- [`vec2i()`](https://typeshade.dev/reference/functions/vec2i/)
- [`textureLoad`](https://typeshade.dev/api/textureload/)

## Source

[`src/core/ir/node.ts`, line 2273](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L2273), at commit af54ddad5
