---
title: "Builtin variables from GLSL ES 3.00 in TypeShade"
description: "A gl_ global is a builtin attribute on a parameter, on a class field or on the return, and the writer decides which global that becomes."
url: https://typeshade.dev/guide/language/from-glsl/variables/
language: en
---

# Builtin variables

A `gl_*` global is a `builtin<N>` type on a parameter, on a field or on the return. The type says which value it is and the writer decides which global that becomes, which is how one file reaches both targets.

GLSL ES 3.00 TypeShade Note

```glsl
gl_Position
```

```ts
builtin<"position">
```

The same id on a vertex output. A vertex entry returning a bare `vec4` carries it with nothing written.

```glsl
gl_FragCoord
```

```ts
builtin<"position">
```

The same id on a fragment input. The y origin differs: this target counts from the bottom of the window and WebGPU from the top, so a shader that reads `.y` needs a flip of its own.

```glsl
uint(gl_VertexID)
```

```ts
builtin<"vertex_index">
```

An index is a `u32` here and an `int` there, so the read is wrapped in the declared type.

```glsl
uint(gl_InstanceID)
```

```ts
builtin<"instance_index">
```

The same wrap, for the same reason.

```glsl
gl_FrontFacing
```

```ts
builtin<"front_facing">
```

A `bool` on both targets, so the read needs no cast.

```glsl
gl_FragDepth
```

```ts
builtin<"frag_depth">
```

Written as a field of the struct a fragment entry returns, beside its colour.

Two of them have no name in this surface. The front end refuses the spelling at the declaration, and the sentence below is what the WGSL backend prints for the same name, which says what to reach for instead.

GLSL ES 3.00 What to write

```glsl
gl_PointSize
```

does not exist in WGSL — WebGPU point-list primitives are always 1px. Expand an instanced quad in the vertex stage instead

```glsl
gl_PointCoord
```

does not exist in WGSL — there is no point-sprite coordinate. Interpolate a `@location(n)` corner uv from the expanded quad instead
