Struct ComputeShaderKernel
Wrapper struct for caching information on a single kernel in a compute shader.
Namespace: Holoride.ElasticSDK.Compute
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
[PublicAPI]
public readonly struct ComputeShaderKernel
Constructors
ComputeShaderKernel(ComputeShader, string, int, uint, uint, uint)
Declaration
public ComputeShaderKernel(ComputeShader shader, string name, int id, uint threadsX, uint threadsY, uint threadsZ)
Parameters
Type | Name | Description |
---|---|---|
ComputeShader | shader | |
string | name | |
int | id | |
uint | threadsX | |
uint | threadsY | |
uint | threadsZ |
Fields
Id
The id of the kernel.
Declaration
public readonly int Id
Field Value
Type | Description |
---|---|
int |
Name
The name of the kernel.
Declaration
public readonly string Name
Field Value
Type | Description |
---|---|
string |
Shader
The compute shader containing the kernel.
Declaration
public readonly ComputeShader Shader
Field Value
Type | Description |
---|---|
ComputeShader |
ThreadsX
The thread group size of the kernel for the X dimension.
Declaration
public readonly uint ThreadsX
Field Value
Type | Description |
---|---|
uint |
ThreadsY
The thread group size of the kernel for the Y dimension.
Declaration
public readonly uint ThreadsY
Field Value
Type | Description |
---|---|
uint |
ThreadsZ
The thread group size of the kernel for the Z dimension.
Declaration
public readonly uint ThreadsZ
Field Value
Type | Description |
---|---|
uint |
Methods
Create(ComputeShader, string)
Creates a new kernel descriptor for the specified shader and kernel.
Declaration
public static ComputeShaderKernel Create(ComputeShader shader, string kernelName)
Parameters
Type | Name | Description |
---|---|---|
ComputeShader | shader | The shader containing the kernel. |
string | kernelName | The name of the kernel. |
Returns
Type | Description |
---|---|
ComputeShaderKernel | The descriptor for the specified kernel. |
Dispatch(int, int, int)
Dispatches the kernel with the specified number of thread counts. These counts will be divided by the size of the thread groups declared by the kernel to dispatch the appropriate number of thread groups.
Declaration
public void Dispatch(int countX = 1, int countY = 1, int countZ = 1)
Parameters
Type | Name | Description |
---|---|---|
int | countX | The count of cells the kernel should run on in the X axis. |
int | countY | The count of cells the kernel should run on in the Y axis. |
int | countZ | The count of cells the kernel should run on in the Z axis. |
Dispatch(CommandBuffer, int, int, int)
Dispatches the kernel with the specified number of thread counts. These counts will be divided by the size of the thread groups declared by the kernel to dispatch the appropriate number of thread groups.
Declaration
public void Dispatch(CommandBuffer commandBuffer, int countX = 1, int countY = 1, int countZ = 1)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | commandBuffer | The command buffer to run the compute shader in. |
int | countX | The count of cells the kernel should run on in the X axis. |
int | countY | The count of cells the kernel should run on in the Y axis. |
int | countZ | The count of cells the kernel should run on in the Z axis. |
Equals(ComputeShaderKernel)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(ComputeShaderKernel other)
Parameters
Type | Name | Description |
---|---|---|
ComputeShaderKernel | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
Operators
operator ==(ComputeShaderKernel, ComputeShaderKernel)
Declaration
public static bool operator ==(ComputeShaderKernel left, ComputeShaderKernel right)
Parameters
Type | Name | Description |
---|---|---|
ComputeShaderKernel | left | |
ComputeShaderKernel | right |
Returns
Type | Description |
---|---|
bool |
operator !=(ComputeShaderKernel, ComputeShaderKernel)
Declaration
public static bool operator !=(ComputeShaderKernel left, ComputeShaderKernel right)
Parameters
Type | Name | Description |
---|---|---|
ComputeShaderKernel | left | |
ComputeShaderKernel | right |
Returns
Type | Description |
---|---|
bool |