---
title: @vgpu/wgsl-std/fullscreen
description: Pure WGSL fullscreen-triangle helpers for resolver-managed shaders. Import them when a vertex shader should draw a full-screen pass with three vertices and no vertex buffer.
---

# @vgpu/wgsl-std/fullscreen



## Import

```wgsl
import { fullscreenTriangleClip, fullscreenTriangleUv } from "@vgpu/wgsl-std/fullscreen";
```

## Signature

```wgsl
export fn fullscreenTriangleClip(index: u32) -> vec4f;
export fn fullscreenTriangleUv(clipXy: vec2f) -> vec2f;
```

## Parameters

| Param  | Type    | Required | Default | Notes                                                                                                                                                                   |
| ------ | ------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| index  | `u32`   | ✔        | —       | Vertex index for `fullscreenTriangleClip`. Use `@builtin(vertex_index)` and draw exactly 3 vertices. Values `0`, `1`, and `2` map to the oversized fullscreen triangle. |
| clipXy | `vec2f` | ✔        | —       | Clip-space XY position, normally `fullscreenTriangleClip(index).xy`, for UV conversion with a render-target-friendly Y flip.                                            |

**Returns:** `fullscreenTriangleClip` returns clip-space `vec4f`; `fullscreenTriangleUv` returns `vec2f` UVs where clip-space top-left `(-1.0, 1.0)` maps to `(0.0, 0.0)`.

**Throws:** These WGSL declarations do not throw. `resolveShader()` can still throw `VGPU-WGSL-SYM-NOEXPORT` for misspelled imports, `VGPU-WGSL-PKG-NOTFOUND` if the package import cannot be resolved, or validation errors such as `VGPU-WGSL-NAGA-UNKNOWN` if caller WGSL is invalid.

## Examples

```ts
const fullscreenVertexWgsl = `
import { fullscreenTriangleClip, fullscreenTriangleUv } from "@vgpu/wgsl-std/fullscreen";

struct VertexOutput {
  @builtin(position) position: vec4f,
  @location(0) uv: vec2f,
}

@vertex
fn vs_main(@builtin(vertex_index) index: u32) -> VertexOutput {
  var out: VertexOutput;
  out.position = fullscreenTriangleClip(index);
  out.uv = fullscreenTriangleUv(out.position.xy);
  return out;
}
`;

console.log(fullscreenVertexWgsl.includes("vs_main"));
```

```ts
const postProcessWgsl = `
import { fullscreenTriangleClip } from "@vgpu/wgsl-std/fullscreen";

@vertex
fn vs_main(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
  return fullscreenTriangleClip(index);
}
`;

console.log(postProcessWgsl.length > 0);
```

## Notes

* This module is pure WGSL: it declares no `@group`, no `@binding`, no overrides, no hidden state, and no entry points.
* Clip outputs are `0 -> (-1, -3)`, `1 -> (-1, 1)`, `2 -> (3, 1)`, covering the viewport as one oversized triangle.
* `fullscreenTriangleUv` applies `clipXy * vec2f(0.5, -0.5) + vec2f(0.5)`, matching top-left texture coordinate convention for fullscreen passes.
* The helpers do not choose varying locations, fragment outputs, bind groups, or samplers; those remain in your entry shader.
* **See also:** `@vgpu/wgsl-std/color`, `resolveShader`, `wgslVitePlugin`.


---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)