# Editor.ShaderUpgrade

Upgrading a VFX `.shader` to Slang, as the editor's upgrade prompt and the asset browser's "Upgrade to Slang" do it
(shader spec 3.6). The shader becomes a standalone module through `T:Borealis.Slang.PassConverter`, the converter that draws
VFX shaders at run time: its code as it is, its modes declared, a geometry or tessellation stage dropped with a
`// compat:` note (`M:Borealis.Slang.PassConverter.Notes(System.String)`). Slang shaders are `.shader` files too, so the module takes
the shader's place (its materials draw it under the same name) and the VFX source is kept beside it as
`name.shader.legacy`, which nothing compiles: renaming it back undoes the upgrade. The module is compiled; when it
doesn't compile the VFX source goes back in its place and nothing else is left behind.

- Kind: class
- Namespace: `Editor`
- Assembly: `Sandbox.Tools`
- Modifiers: static, abstract, sealed

## Properties

- [`DontAsk`](/api/Editor.ShaderUpgrade/DontAsk): Whether the project said not to ask about its VFX shaders again (a project cookie).

## Methods

- [`CompileModule`](/api/Editor.ShaderUpgrade/CompileModule): The module's stages, each compiled with the combinations `M:Borealis.Slang.PassCombinations.ToCheck(Borealis.Slang.PassModule,Borealis.Slang.StageKind,System.Int32,System.Action{System.String})` gives (all of a few; else every pair of combos at every pair of values, so features that break only together are found); the first error, after the stage and combination it's from, or null.
- [`CompileSurfaceAsync`](/api/Editor.ShaderUpgrade/CompileSurfaceAsync): The surface compiled with every pass; the first error, or null.
- [`FindLegacy`](/api/Editor.ShaderUpgrade/FindLegacy): The project's own VFX `.shader` files under `projectRoot`, sorted by path: not those of installed libraries (`Libraries`), cloud packages (`.sbox`) or any other dot or build folder.
- [`FirstLine`](/api/Editor.ShaderUpgrade/FirstLine): A compile error's gist: its first line, and the line naming what it's about (Slang puts that under the source line).
- [`IsLegacy`](/api/Editor.ShaderUpgrade/IsLegacy): Whether the file is a VFX `.shader` (by its content, not its name: `M:Borealis.Slang.ShaderFormat.Classify(System.String)`); false when it can't be read.
- [`IsLegacySource`](/api/Editor.ShaderUpgrade/IsLegacySource): Whether a shader's text is VFX's (the legacy format): top-level `HEADER`, `MODES`, `VS`, `PS`, ... blocks (`M:Borealis.Slang.ShaderFormat.IsVfxSource(System.String)`).
- [`LegacyPath`](/api/Editor.ShaderUpgrade/LegacyPath): Where an upgrade keeps the VFX source it replaced: `name.shader.legacy`, which nothing compiles.
- [`LegacyWarning`](/api/Editor.ShaderUpgrade/LegacyWarning): What the editor logs when it compiles a VFX `.shader` of a project: once a session per shader.
- [`UpgradeAsync`](/api/Editor.ShaderUpgrade/UpgradeAsync)
