xbmc
Public Member Functions | List of all members
KODI::SHADER::IShader Class Referenceabstract
Inheritance diagram for KODI::SHADER::IShader:
Inheritance graph
[legend]

Public Member Functions

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

Member Function Documentation

◆ Create()

virtual bool KODI::SHADER::IShader::Create ( const std::string &  shaderSource,
const std::string &  shaderPath,
ShaderParameterMap  shaderParameters,
IShaderSampler sampler,
ShaderLutVec  luts,
float2  viewPortSize,
unsigned  frameCountMod = 0 
)
pure virtual

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.

Implemented in KODI::SHADER::CShaderGL, and KODI::SHADER::CShaderDX.

◆ CreateInputBuffer()

virtual bool KODI::SHADER::IShader::CreateInputBuffer ( )
pure virtual

Creates the buffer that will be used to send "input" (as per the spec) data to the shader.

Returns
False if creating the input buffer failed, true otherwise.

Implemented in KODI::SHADER::CShaderGL, and KODI::SHADER::CShaderDX.

◆ CreateVertexBuffer()

virtual bool KODI::SHADER::IShader::CreateVertexBuffer ( unsigned  vertCount,
unsigned  vertSize 
)
pure virtual

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.

Implemented in KODI::SHADER::CShaderDX, and KODI::SHADER::CShaderGL.

◆ PrepareParameters()

virtual void KODI::SHADER::IShader::PrepareParameters ( CPoint  dest[4],
bool  isLastPass,
uint64_t  frameCount 
)
pure virtual

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

Implemented in KODI::SHADER::CShaderGL, and KODI::SHADER::CShaderDX.

◆ Render()

virtual void KODI::SHADER::IShader::Render ( IShaderTexture source,
IShaderTexture target 
)
pure virtual

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

Implemented in KODI::SHADER::CShaderGL, and KODI::SHADER::CShaderDX.

◆ SetSizes()

virtual void KODI::SHADER::IShader::SetSizes ( const float2 prevSize,
const float2 nextSize 
)
pure virtual

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

Implemented in KODI::SHADER::CShaderGL, and KODI::SHADER::CShaderDX.


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