Scripting API

Scripting API

ShaderCompiler

Class in Abyss.Core, from Abyss.Core.

A game's shaders and Bevy's shader library as they were when it was made, ready to compile variants of the game's shaders to SPIR-V from.

public sealed class ShaderCompiler : IDisposable

Remarks

Made where the world is, used anywhere — on a thread of its own, say, while the editor draws — but by one thread at a time. See World.ShaderCompiler.

Methods

VariantsFor

public static IReadOnlyList<string> VariantsFor(ShaderTarget target, string variant)

The variants target asks a shader for where the GPU a variant was collected on asked for variant: itself, for that GPU; for WebGL2, the ones a browser asks for instead, worked out by rule rather than collected, as the editor draws on no WebGL2.

Parameters

Exceptions

  • AbyssException: A word of it is not a switch.

Stamp

public string Stamp(string path)

What a shader's variants are compiled from, as one hash: this compiler, the GPU, Bevy's library, the shader's file and every file of the game's it imports. A variant compiled under another stamp is out of date.

Parameters

  • path: The shader, relative to the shaders folder.

Exceptions

  • AbyssException: No file in the folder has that path.

Compile

public CompiledShader Compile(string path, string variant, string artifact)

Compiles one variant of a shader into a SPIR-V file, and says how big it is.

Parameters

  • path: The shader, relative to the shaders folder.
  • variant: Its switches, as DrawnVariant.Variant has them.
  • artifact: Where to write it, its whole path; its folder is made.

Exceptions

  • AbyssException: The shader is not in the folder, has a mistake — said with its file, line and column — or the file cannot be written.

Dispose

public void Dispose()