Api Sandbox ComputeShader
class

ComputeShader

public class ComputeShader

A compute shader is a program that runs on the GPU, often with data provided to/from the CPU by means of a GpuBuffer`1 or a Texture.

Constructors

ComputeShader(String path)

Create a compute shader from the specified path.

Properties

Name Type Description
Attributes RenderAttributes Attributes that are passed to the compute shader on dispatch.

Methods

Void Dispatch(Int32 threadsX = 32, Int32 threadsY = 32, Int32 threadsZ = 32)

Dispatch this compute shader using explicit thread counts.

threadsX — The number of threads to dispatch in the X dimension.
threadsY — The number of threads to dispatch in the Y dimension.
threadsZ — The number of threads to dispatch in the Z dimension.
Void DispatchIndirect(GpuBuffer indirectBuffer, UInt32 indirectElementOffset = 0)

Dispatch this compute shader by reading thread group counts (x, y, z) from an indirect buffer of type IndirectDispatchArguments.

indirectBuffer — The GPU buffer containing one or more dispatch argument entries.
indirectElementOffset — The index of the dispatch arguments element to use (each element = 12 bytes).
Void DispatchWithAttributes(RenderAttributes attributes, Int32 threadsX = 32, Int32 threadsY = 32, Int32 threadsZ = 32)
Void DispatchIndirectWithAttributes(RenderAttributes attributes, GpuBuffer indirectBuffer, UInt32 indirectElementOffset = 0)

See Also

GpuBuffer`1
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.ComputeShader