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

#include <OGLShaderVariation.h>

Inheritance diagram for Urho3D::ShaderVariation:
[legend]
Collaboration diagram for Urho3D::ShaderVariation:
[legend]

Public Member Functions

 ShaderVariation (Shader *owner, ShaderType type)
 Construct.
 
virtual ~ShaderVariation ()
 Destruct.
 
virtual void Release ()
 Release the shader.
 
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.
 
bool HasTextureUnit (TextureUnit unit) const
 Return whether uses a texture unit (only for pixel shaders.)
 
const HashMap< StringHash,
ShaderParameter > & 
GetParameters () const
 Return all parameter definitions.
 
unsigned GetElementMask () const
 Return vertex element mask.
 
const PODVector< unsigned char > & GetByteCode () const
 Return shader bytecode.
 
const StringGetDefines () const
 Return defines.
 
const StringGetCompilerOutput () const
 Return compile error/warning string.
 
const unsigned * GetConstantBufferSizes () const
 Return constant buffer data sizes.
 
 ShaderVariation (Shader *owner, ShaderType type)
 Construct.
 
virtual ~ShaderVariation ()
 Destruct.
 
virtual void OnDeviceLost ()
 Mark the GPU resource destroyed on context destruction.
 
virtual void Release ()
 Release the shader.
 
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 name.
 
const StringGetDefines () const
 Return defines.
 
String GetFullName () const
 Return full shader name.
 
const StringGetCompilerOutput () const
 Return compile error/warning string.
 
- 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.
 
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 subsystem.
 
void ClearDataLost ()
 Clear the data lost flag. No-op on D3D11.
 
GraphicsGetGraphics () const
 Return the graphics subsystem.
 
void * GetGPUObject () const
 Return Direct3D object.
 
bool IsDataLost () const
 Return whether data is lost due to device loss. Always false on D3D11.
 
bool HasPendingData () const
 Return whether has pending data assigned while device was lost. Always false on D3D11.
 
 GPUObject (Graphics *graphics)
 Construct with graphics subsystem pointer.
 
virtual ~GPUObject ()
 Destruct. Remove from the Graphics.
 
virtual void OnDeviceReset ()
 Recreate the GPU resource and restore data if applicable.
 
void ClearDataLost ()
 Clear the data lost flag.
 
GraphicsGetGraphics () const
 Return the graphics subsystem.
 
unsigned GetGPUObject () const
 Return the object's OpenGL handle.
 
bool IsDataLost () const
 Return whether data is lost due to context loss.
 
bool HasPendingData () const
 Return whether has pending data assigned while context was lost.
 

Private Member Functions

bool LoadByteCode (const String &binaryShaderName)
 Load bytecode from a file. Return true if successful. More...
 
bool Compile ()
 Compile from source. Return true if successful.
 
void ParseParameters (unsigned char *bufData, unsigned bufSize)
 Inspect the constant parameters and input layout (if applicable) from the shader bytecode.
 
void SaveByteCode (const String &binaryShaderName)
 Save bytecode to a file.
 
void CalculateConstantBufferSizes ()
 Calculate constant buffer sizes from parameters.
 

Private Attributes

WeakPtr< Shaderowner_
 Shader this variation belongs to.
 
ShaderType type_
 Shader type.
 
unsigned elementMask_
 Vertex element mask for vertex shaders. Zero for pixel shaders.
 
HashMap< StringHash,
ShaderParameter
parameters_
 Shader parameters.
 
bool useTextureUnit_ [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.
 
PODVector< unsigned char > byteCode_
 Bytecode. Needed for inspecting the input signature and parameters.
 
String name_
 Shader name.
 
String defines_
 Defines to use in compiling.
 
String compilerOutput_
 Shader compile error string.
 

Additional Inherited Members

- Protected Attributes inherited from Urho3D::GPUObject
WeakPtr< Graphicsgraphics_
 Graphics subsystem.
 
void * object_
 Direct3D object.
 
unsigned object_
 Object handle.
 
bool dataLost_
 Data lost flag.
 
bool dataPending_
 Data pending flag.
 

Detailed Description

Vertex or pixel shader on the GPU.

Member Function Documentation

bool Urho3D::ShaderVariation::LoadByteCode ( const String binaryShaderName)
private

Load bytecode from a file. Return true if successful.

Todo:
Check that shader type and model match

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Graphics/Direct3D11/D3D11ShaderVariation.h
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Graphics/OpenGL/OGLShaderVariation.h
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Graphics/Direct3D11/D3D11ShaderVariation.cpp
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Graphics/OpenGL/OGLShaderVariation.cpp