---
title: "GlslEmitOptions: interface in Emit, TypeShade API reference"
description: "GlslEmitOptions, an interface in Emit. The options accepted by emitGlslModule, emitGlslStages and emitGlslFragment…"
url: https://typeshade.dev/api/glslemitoptions/
language: en
---

# `GlslEmitOptions`

Interface in Emit

The options accepted by emitGlslModule, emitGlslStages and emitGlslFragment: the shared EmitOptions plus three that exist only for GLSL ES 3.00.

`import type { GlslEmitOptions } from 'typeshade'`

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

## Syntax

```ts
interface GlslEmitOptions extends EmitOptions {
  emulateCompute?: boolean;
  overrideValues?: Readonly<Record<string, number | boolean>>;
  floatPrecision?: 'highp' | 'mediump';
}
```

## Description

WebGL2 has no compute stage (`emulateCompute`) or pipeline-time specialization constants (`overrideValues`). Fragment shaders have no default float precision (`floatPrecision`). All three are decided when the source is emitted, never probed from the device, so emitted source can be cached under a key derived from the options. Omitting them all leaves the emitted bytes unchanged.

## Instance properties

**`emulateCompute` optional deprecated `boolean`**

Lower a gather-only `@compute` kernel to a fragment pass, as [`lowerComputeToFragment`](https://typeshade.dev/api/lowercomputetofragment/) describes. The host then runs the kernel as a fullscreen draw into an `R32UI` target instead of a compute dispatch, which is why this is opt-in where the storage lowering is automatic: it changes what the host has to do. Implies the data-texture lowering for the read-only storage bindings that remain.

**`overrideValues` optional `Readonly<Record<string, number | boolean>>`**

Pin `override` values for this emit. GLSL ES 3.00 has no pipeline-time specialization constants, so each specialization is its own emit: every override named here becomes a hard `#define NAME <value>` after the `#version` and precision lines, spelled as a GLSL literal (a `u` suffix for `u32`, a `.0` for `f32`). An override not named here keeps its `#ifndef` default. [`reflect`](https://typeshade.dev/api/reflect/) lists the module’s overrides under `overrides`; the WGSL equivalent is `createRenderPipeline({ constants })`.

**`floatPrecision` optional `'highp' | 'mediump'`**

The default float precision qualifier for the emitted stage, the `precision <p> float;` line. `'highp'` is the default and leaves the emitted bytes unchanged. It applies to floating-point declarations without an explicit precision qualifier; explicit qualifiers and the expression precision rules still apply.

GLSL ES 3.00 predeclares highp float precision in vertex shaders. Fragment shaders have no default float precision. This option sets an explicit default in either stage. It is decided at emit time, never probed from the device, so a cache of emitted source must include it in its key.

It spells the float line and nothing else. `precision highp int;` and the `precision highp <sampler type>;` lines stay highp. Index math and integer bit patterns in the storage-to-data-texture lowering need the full integer range.

Mediump specifies minimum range and precision requirements, not an IEEE 754 binary16 format. An implementation may use higher precision, including `f32`. Unqualified positions, coordinates and intermediate variables can be affected; a bounded final colour alone does not establish that the calculations meet their error budget. Keep highp for calculations that require its range or precision, including the `f32` components of the emulation behind [`f64T`](https://typeshade.dev/api/f64t/).

Measure numeric errors and performance on the target implementations. Reduced precision can improve performance or power use on some devices; this option guarantees neither. Numeric differences are not restricted to mobile hardware.

## In the guide

- [Emitting and reflection](https://typeshade.dev/guide/internals/emitting-and-reflection/)

## See also

- [`emitGlslModule`](https://typeshade.dev/api/emitglslmodule/)
- [`emitGlslStages`](https://typeshade.dev/api/emitglslstages/)
- [`emitGlslFragment`](https://typeshade.dev/api/emitglslfragment/)
- [`EmitOptions`](https://typeshade.dev/api/emitoptions/)
- [`lowerComputeToFragment`](https://typeshade.dev/api/lowercomputetofragment/)
- [`reflect`](https://typeshade.dev/api/reflect/)
- [`f64T`](https://typeshade.dev/api/f64t/)

## Source

[`src/core/backends/glsl/options.ts`, line 10](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/glsl/options.ts#L10), at commit af54ddad5
