xbmc
Classes | Public Member Functions | Protected Member Functions | List of all members
KODI::SHADER::CShaderGL Class Reference
Inheritance diagram for KODI::SHADER::CShaderGL:
Inheritance graph
[legend]
Collaboration diagram for KODI::SHADER::CShaderGL:
Collaboration graph
[legend]

Public Member Functions

 CShaderGL (RETRO::CRenderContext &context)
 
bool CreateVertexBuffer (unsigned vertCount, unsigned vertSize) override
 Construct the vertex buffer that will be used to render the shader. More...
 
bool Create (const std::string &shaderSource, const std::string &shaderPath, ShaderParameterMap shaderParameters, IShaderSampler *sampler, ShaderLutVec luts, float2 viewPortSize, unsigned frameCountMod=0) override
 Construct the vidoe shader instance. More...
 
void Render (IShaderTexture *source, IShaderTexture *target) override
 Renders the video shader to the target texture. More...
 
void SetSizes (const float2 &prevSize, const float2 &nextSize) override
 Sets the input and output sizes in pixels. More...
 
void PrepareParameters (CPoint dest[4], bool isLastPass, uint64_t frameCount) override
 Called before rendering. Updates any internal state needed to ensure that correct data is passed to the shader when rendering. More...
 
void UpdateMVP () override
 Updates the model view projection matrix. Should usually only be called when the viewport/window size changes.
 
bool CreateInputBuffer () override
 
void UpdateInputBuffer (uint64_t frameCount)
 
void GetUniformLocs ()
 

Protected Member Functions

void SetShaderParameters ()
 

Member Function Documentation

◆ Create()

bool CShaderGL::Create ( const std::string &  shaderSource,
const std::string &  shaderPath,
ShaderParameterMap  shaderParameters,
IShaderSampler sampler,
ShaderLutVec  luts,
float2  viewPortSize,
unsigned  frameCountMod = 0 
)
overridevirtual

Construct the vidoe shader instance.

Parameters
shaderSourceSource code of the shader (both vertex and pixel/fragment)
shaderPathFull path to the shader file
shaderParametersStruct with all parameters pertaining to the shader
samplerPointer to the sampler that the will be used when sampling textures
lutsLook-up textures pertaining to shader
viewPortSizeSize of the window/viewport
frameCountModModulo that must be applied to the frame count before sendign it to the shader
Returns
False if creating the shader failed, true otherwise.
Todo:
Remove sampler input from IShader.h
Todo:
Make this good

Implements KODI::SHADER::IShader.

◆ CreateInputBuffer()

bool CShaderGL::CreateInputBuffer ( )
overridevirtual
Todo:
Change name of this method in IShader.h to CreateInputs

Implements KODI::SHADER::IShader.

◆ CreateVertexBuffer()

bool CShaderGL::CreateVertexBuffer ( unsigned  vertCount,
unsigned  vertSize 
)
overridevirtual

Construct the vertex buffer that will be used to render the shader.

Parameters
vertCountNumber of vertices to construct. Commonly 4, for rectangular screens.
vertSizeSize of each vertex's data in bytes
Returns
False if creating the vertex buffer failed, true otherwise.

Implements KODI::SHADER::IShader.

◆ PrepareParameters()

void CShaderGL::PrepareParameters ( CPoint  dest[4],
bool  isLastPass,
uint64_t  frameCount 
)
overridevirtual

Called before rendering. Updates any internal state needed to ensure that correct data is passed to the shader when rendering.

Parameters
destCoordinates of the 4 corners of the output viewport/window
isLastPassTrue if the current shader is last one in the pipeline // TODO: this could be a member
frameCountNumber of frames that have passed

Implements KODI::SHADER::IShader.

◆ Render()

void CShaderGL::Render ( IShaderTexture source,
IShaderTexture target 
)
overridevirtual

Renders the video shader to the target texture.

Parameters
sourceSource texture to pass to the shader as input
targetTarget texture to render the shader to

Implements KODI::SHADER::IShader.

◆ SetSizes()

void CShaderGL::SetSizes ( const float2 prevSize,
const float2 nextSize 
)
overridevirtual

Sets the input and output sizes in pixels.

Parameters
prevSizeInput image size of the shader in pixels
nextSizeOutput image size of the shader in pixels

Implements KODI::SHADER::IShader.

◆ UpdateInputBuffer()

void CShaderGL::UpdateInputBuffer ( uint64_t  frameCount)
Todo:
Change name of this method in IShader.h to UpdateInputs

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