---
title: "lowerWgsl(): function in Emit, TypeShade API reference"
description: "lowerWgsl, a function in Emit. Run the passes emitModule runs before writing text (validation, the capability check, autoVars…"
url: https://typeshade.dev/api/lowerwgsl/
language: en
---

# `lowerWgsl()`

Function in Emit

Run the passes emitModule runs before writing text (validation, the capability check, autoVars, lowerModule and the optimizer at level) and return the resulting ModuleDecl.

`import { lowerWgsl } from 'typeshade'`

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

## Syntax

```ts
const lowerWgsl: (m: ModuleDecl, level: OptLevel) => ModuleDecl
```

## Parameters

**`m` `ModuleDecl`**

**`level` `OptLevel`**

## Return value

`ModuleDecl`

## Description

The string emit and this function share one recipe, so a tool that inspects the lowered module (an instruction count, for example) sees exactly the module [`emitModuleAt`](https://typeshade.dev/api/emitmoduleat/) would write at the same level.

## See also

- [`emitModule`](https://typeshade.dev/api/emitmodule/)
- [`autoVars`](https://typeshade.dev/api/autovars/)
- [`lowerModule`](https://typeshade.dev/api/lowermodule/)
- [`ModuleDecl`](https://typeshade.dev/api/moduledecl/)
- [`emitModuleAt`](https://typeshade.dev/api/emitmoduleat/)

## Source

[`src/core/backends/wgsl.ts`, line 271](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/wgsl.ts#L271), at commit af54ddad5
