Class GPUShader
The GPU resource with shader programs that can run on the GPU and are able to perform rendering calculation using textures, vertices and other resources.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Graphics/Shaders/GPUShader.h
Syntax
public class GPUShader : public GPUResource
Constructors
GPUShader()
Declaration
protected GPUShader()
Fields
_constantBuffers
Declaration
protected GPUConstantBuffer* _constantBuffers[GPU_MAX_CB_BINDED]
Field Value
GPUConstantBuffer
|
_shaders
Declaration
protected Dictionary<uint32, GPUShaderProgram* > _shaders
Field Value
Dictionary<uint32, GPUShaderProgram >
|
Methods
Create(class MemoryReadStream& stream)
Creates the shader resource and loads its data from the bytes. The stream with compiled shader data. True if cannot create state, otherwise false.
Declaration
public virtual bool Create(class MemoryReadStream& stream)
Parameters
class MemoryReadStream
stream
|
Returns
bool
|
CreateGPUShaderProgram(ShaderStage type, const GPUShaderProgramInitializer& initializer, Span<byte> bytecode, MemoryReadStream& stream)
Declaration
protected virtual GPUShaderProgram* CreateGPUShaderProgram(ShaderStage type, const GPUShaderProgramInitializer& initializer, Span<byte> bytecode, MemoryReadStream& stream) = 0
Parameters
ShaderStage
type
|
GPUShaderProgramInitializer
initializer
|
Span<byte>
bytecode
|
MemoryReadStream
stream
|
Returns
GPUShaderProgram
|
GetCB(int32 slot)
Gets the constant buffer.
Declaration
public GPUConstantBuffer* GetCB(int32 slot) const
Parameters
int32
slot
The buffer slot index. |
Returns
GPUConstantBuffer
The Constant Buffer object. |
GetCS(const StringAnsiView& name, int32 permutationIndex = 0)
Gets the compute shader.
Declaration
public GPUShaderProgramCS* GetCS(const StringAnsiView& name, int32 permutationIndex = 0) const
Parameters
StringAnsiView
name
The shader program name. |
int32
permutationIndex
The shader permutation index. |
Returns
GPUShaderProgramCS
The shader object. |
GetDS(const StringAnsiView& name, int32 permutationIndex = 0)
Gets domain shader.
Declaration
public GPUShaderProgramDS* GetDS(const StringAnsiView& name, int32 permutationIndex = 0) const
Parameters
StringAnsiView
name
The shader program name. |
int32
permutationIndex
The shader permutation index. |
Returns
GPUShaderProgramDS
The shader object. |
GetGS(const StringAnsiView& name, int32 permutationIndex = 0)
Gets the geometry shader.
Declaration
public GPUShaderProgramGS* GetGS(const StringAnsiView& name, int32 permutationIndex = 0) const
Parameters
StringAnsiView
name
The shader program name. |
int32
permutationIndex
The shader permutation index. |
Returns
GPUShaderProgramGS
The shader object. |
GetHS(const StringAnsiView& name, int32 permutationIndex = 0)
Gets the hull shader.
Declaration
public GPUShaderProgramHS* GetHS(const StringAnsiView& name, int32 permutationIndex = 0) const
Parameters
StringAnsiView
name
The shader program name. |
int32
permutationIndex
The shader permutation index. |
Returns
GPUShaderProgramHS
The shader object. |
GetPS(const StringAnsiView& name, int32 permutationIndex = 0)
Gets the pixel shader.
Declaration
public GPUShaderProgramPS* GetPS(const StringAnsiView& name, int32 permutationIndex = 0) const
Parameters
StringAnsiView
name
The shader program name. |
int32
permutationIndex
The shader permutation index. |
Returns
GPUShaderProgramPS
The shader object. |
GetResourceType()
Gets the GPU resource type.
Declaration
public virtual GPUResourceType GetResourceType() const final override
Returns
GPUResourceType
|
Overrides
GetShader(ShaderStage stage, const StringAnsiView& name, int32 permutationIndex)
Declaration
protected GPUShaderProgram* GetShader(ShaderStage stage, const StringAnsiView& name, int32 permutationIndex) const
Parameters
ShaderStage
stage
|
StringAnsiView
name
|
int32
permutationIndex
|
Returns
GPUShaderProgram
|
GetVS(const StringAnsiView& name, int32 permutationIndex = 0)
Gets the vertex shader.
Declaration
public GPUShaderProgramVS* GetVS(const StringAnsiView& name, int32 permutationIndex = 0) const
Parameters
StringAnsiView
name
The shader program name. |
int32
permutationIndex
The shader permutation index. |
Returns
GPUShaderProgramVS
The shader object. |
HasShader(const StringAnsiView& name, int32 permutationIndex = 0)
Determines whether the specified shader program is in the shader.
Declaration
public bool HasShader(const StringAnsiView& name, int32 permutationIndex = 0) const
Parameters
StringAnsiView
name
The shader program name. |
int32
permutationIndex
The shader permutation index. |
Returns
bool
|
OnReleaseGPU()
Releases GPU resource data (implementation).
Declaration
protected virtual void OnReleaseGPU() override
Overrides
ReadVertexLayout(MemoryReadStream& stream, GPUVertexLayout*& inputLayout, GPUVertexLayout*& vertexLayout)
Declaration
protected static void ReadVertexLayout(MemoryReadStream& stream, GPUVertexLayout*& inputLayout, GPUVertexLayout*& vertexLayout)
Parameters
MemoryReadStream
stream
|
GPUVertexLayout
inputLayout
|
GPUVertexLayout
vertexLayout
|