ShaderProgram
Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.
Up and coming
Write a GLSL effect once and run it over any picture, or draw instanced geometry in one call.
Load one with GpuService:LoadShaderAsync, or put a ShaderProgram in the project tree whose Fragment and Vertex are ShaderModules. RunAsync is one full-picture pass into one or several textures; DrawAsync draws instanced geometry, with blending and depth set per draw. Uniforms take numbers, booleans, vectors, colours, CFrames, number lists and textures.
Made with Instance.new("ShaderProgram") or Clone().
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| Fragment | ShaderModule? | The fragment ShaderModule a program in the project tree is compiled from, on first use. | |
| Vertex | ShaderModule? | The vertex ShaderModule; nil uses the built-in full-picture vertex shader, which hands the fragment shader SamplePosition from 0 to 1. | |
| Source | string | read-only | Read-only: the folder, file or module path the program was compiled from. |
| HotReload | boolean | False by default; true recompiles when its files or modules change, for tuning a look while it is on screen. | |
| Diagnostics | { ShaderDiagnostic } | read-only | Read-only: the compile's problems, each with Path, Line, Column and Message. |
| Uniforms | { string } | read-only | Read-only: the uniform names the compiled program uses. |
Methods
| Name | Arguments | Returns | Description |
|---|---|---|---|
| SetUniform | (name: string, value: UniformValue) | () | Sets a uniform that stays until changed, without yielding; a GpuTexture becomes a sampler, its slot given by name. |
| RunAsync yields | (output: GpuTexture | { GpuTexture }, uniforms: { [string]: UniformValue }?) | (boolean, string?) | Runs one full-picture pass into the output and waits for it; several outputs go to layout(location = n) in order. |
| DrawAsync yields | (options: DrawOptions) | (boolean, string?) | Draws instanced geometry from VertexBuffers into the Targets, with Blend, DepthTest and Clear set per draw, and waits for it. |
Events
| Name | Passes | Description |
|---|---|---|
| Recompiled | (boolean) | Fires after a hot reload, passing true when it worked; on false the last good program stays and Diagnostics say why. |
From ShotInstance 33
ClassNameNameParentAncestryChangedAttributeChangedChangedChildAddedChildRemovedDestroyingAddTagClearAllChildrenCloneDestroyFindFirstAncestorFindFirstAncestorOfClassFindFirstAncestorWhichIsAFindFirstChildFindFirstChildOfClassFindFirstChildWhichIsAGetAttributeGetAttributeChangedSignalGetAttributesGetChildrenGetDescendantsGetFullNameGetPropertyChangedSignalGetTagsHasTagIsAIsAncestorOfIsDescendantOfRemoveTagSetAttribute
