Urho3D
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Urho3D::ShaderVariation Class Reference

Vertex or pixel shader on the GPU. More...

#include </home/runner/work/urho3d-doxygen.github.io/urho3d-doxygen.github.io/urho3d_repo/Source/Urho3D/GraphicsAPI/ShaderVariation.h>

Inheritance diagram for Urho3D::ShaderVariation:
Urho3D::RefCounted Urho3D::GPUObject

Public Member Functions

 ShaderVariation (Shader *owner, ShaderType type)
 Construct.
 
 ~ShaderVariation () override
 Destruct.
 
void OnDeviceLost () override
 Mark the GPU resource destroyed on graphics context destruction. More...
 
void Release () override
 Release the shader. More...
 
bool Create ()
 Compile the shader. Return true if successful.
 
void SetName (const String &name)
 Set name.
 
void SetDefines (const String &defines)
 Set defines.
 
ShaderGetOwner () const
 Return the owner resource.
 
ShaderType GetShaderType () const
 Return shader type.
 
const StringGetName () const
 Return shader name.
 
String GetFullName () const
 Return full shader name.
 
bool HasParameter (StringHash param) const
 Return whether uses a parameter. Not applicable on OpenGL, where this information is contained in ShaderProgram instead.
 
bool HasTextureUnit (TextureUnit unit) const
 Return whether uses a texture unit (only for pixel shaders). Not applicable on OpenGL, where this information is contained in ShaderProgram instead.
 
const HashMap< StringHash, ShaderParameter > & GetParameters () const
 Return all parameter definitions. Not applicable on OpenGL, where this information is contained in ShaderProgram instead.
 
hash64 GetElementHash () const
 Return vertex element hash.
 
const Vector< unsigned char > & GetByteCode () const
 Return shader bytecode. Stored persistently on Direct3D11 only.
 
const StringGetDefines () const
 Return defines.
 
const StringGetCompilerOutput () const
 Return compile error/warning string.
 
const unsigned * GetConstantBufferSizes () const
 Return constant buffer data sizes.
 
const StringGetDefinesClipPlane ()
 Return defines with the CLIPPLANE define appended. Used internally on Direct3D11 only, will be empty on other APIs.
 
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
 
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
 
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
 
void AddRef ()
 Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
 
void ReleaseRef ()
 Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
 
int Refs () const
 Return reference count.
 
int WeakRefs () const
 Return weak reference count.
 
RefCountRefCountPtr ()
 Return pointer to the reference count structure.
 
- Public Member Functions inherited from Urho3D::GPUObject
 GPUObject (Graphics *graphics)
 Construct with graphics subsystem pointer.
 
virtual ~GPUObject ()
 Destruct. Remove from the Graphics.
 
virtual void OnDeviceLost ()
 Mark the GPU resource destroyed on graphics context destruction. More...
 
virtual void OnDeviceReset ()
 Recreate the GPU resource and restore data if applicable. More...
 
virtual void Release ()
 Unconditionally release the GPU resource. More...
 
void ClearDataLost ()
 Clear the data lost flag.
 
GraphicsGetGraphics () const
 Return the graphics subsystem associated with this GPU object.
 
void * GetGPUObject () const
 Return the object pointer. Applicable only on Direct3D.
 
u32 GetGPUObjectName () const
 Return the object name. Applicable only on OpenGL.
 
bool IsDataLost () const
 Return whether data is lost due to context loss.
 
bool HasPendingData () const
 Return whether has pending data assigned while graphics context was lost.
 

Static Public Attributes

static const char * elementSemanticNames_OGL []
 OpenGL vertex semantic names. Used internally. More...
 
static const char * elementSemanticNames_D3D11 []
 D3D11 vertex semantic names. Used internally.
 

Private Attributes

WeakPtr< Shaderowner_
 Shader this variation belongs to.
 
ShaderType type_
 Shader type.
 
hash64 elementHash_ {}
 Vertex element hash for vertex shaders. Zero for pixel shaders. Note that hashing is different than vertex buffers.
 
HashMap< StringHash, ShaderParameterparameters_
 Shader parameters.
 
bool useTextureUnits_ [MAX_TEXTURE_UNITS] {}
 Texture unit use flags.
 
unsigned constantBufferSizes_ [MAX_SHADER_PARAMETER_GROUPS] {}
 Constant buffer sizes. 0 if a constant buffer slot is not in use.
 
Vector< unsigned char > byteCode_
 Shader bytecode. Needed for inspecting the input signature and parameters. Not used on OpenGL.
 
String name_
 Shader name.
 
String defines_
 Defines to use in compiling.
 
String definesClipPlane_
 Defines to use in compiling + CLIPPLANE define appended. Used only on Direct3D11.
 
String compilerOutput_
 Shader compile error string.
 

Additional Inherited Members

- Protected Attributes inherited from Urho3D::GPUObject
WeakPtr< Graphicsgraphics_
 Graphics subsystem.
 
GPUObjectHandle object_ {}
 Object pointer or name.
 
bool dataLost_ {}
 Data lost flag.
 
bool dataPending_ {}
 Data pending flag.
 

Detailed Description

Vertex or pixel shader on the GPU.

Member Function Documentation

◆ OnDeviceLost()

void Urho3D::ShaderVariation::OnDeviceLost ( )
overridevirtual

Mark the GPU resource destroyed on graphics context destruction.

Reimplemented from Urho3D::GPUObject.

◆ Release()

void Urho3D::ShaderVariation::Release ( )
overridevirtual

Release the shader.

Reimplemented from Urho3D::GPUObject.

Member Data Documentation

◆ elementSemanticNames_OGL

const char * Urho3D::ShaderVariation::elementSemanticNames_OGL
static
Initial value:
=
{
"POS",
"NORMAL",
"BINORMAL",
"TANGENT",
"TEXCOORD",
"COLOR",
"BLENDWEIGHT",
"BLENDINDICES",
"OBJECTINDEX"
}

OpenGL vertex semantic names. Used internally.


The documentation for this class was generated from the following files: