Class ComputeShader
Represents a compute shader program, including its source code and execution parameters.
public class ComputeShader : IShaderProgram, IIdentifier, IGraphicsResource
- Inheritance
-
ComputeShader
- Implements
- Derived
- Inherited Members
Remarks
Use this class to manage the source and configuration of a compute shader for GPU-based parallel processing tasks. The properties provide access to the shader's source code, the number of invocations, and the program identifier required for execution within a graphics or compute API.
Properties
ID
Unique identifier for the compute shader.
public Guid ID { get; }
Property Value
Invocations
Gets or sets the number of times the associated operation has been invoked.
public int Invocations { get; set; }
Property Value
IsInitialized
Gets a value indicating whether the object has been successfully initialized.
public bool IsInitialized { get; }
Property Value
Name
Name of the compute shader.
public string Name { get; set; }
Property Value
ProgramID
Program ID of the compute shader.
public int ProgramID { get; set; }
Property Value
ShaderSource
Gets or sets the source code of the shader program.
public string ShaderSource { get; set; }
Property Value
Methods
Dispose(IRenderDevice)
Disposes of the resources used by the compute shader.
public void Dispose(IRenderDevice renderer)
Parameters
rendererIRenderDevice
FreeCPUResources()
Releases any CPU resources that are currently allocated by the component.
public void FreeCPUResources()
Remarks
Call this method when the component no longer needs to perform CPU-intensive operations to allow the system to reclaim resources. After calling this method, the component may not be able to perform certain operations until resources are reallocated.
Init(IRenderDevice)
Initializes the component using the specified render device.
public void Init(IRenderDevice renderer)
Parameters
rendererIRenderDeviceThe render device to be used for initialization. Cannot be null.