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

Public Member Functions

 CShaderDX (RETRO::CRenderContext &context)
 
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...
 
CD3DEffectGetEffect ()
 
void UpdateMVP () override
 Updates the model view projection matrix. Should usually only be called when the viewport/window size changes.
 
bool CreateInputBuffer () override
 Creates the buffer that will be used to send "input" (as per the spec) data to the shader. More...
 
void UpdateInputBuffer (uint64_t frameCount)
 
bool CreateVertexBuffer (unsigned vertCount, unsigned vertSize) override
 Construct the vertex buffer that will be used to render the shader. More...
 
bool CreateInputLayout (D3D11_INPUT_ELEMENT_DESC *layout, unsigned numElements)
 Creates the data layout of the input-assembler stage. More...
 

Protected Member Functions

void SetShaderParameters (CD3DTexture &sourceTexture)
 
- Protected Member Functions inherited from CWinShader
virtual bool CreateVertexBuffer (unsigned int vertCount, unsigned int vertSize)
 
virtual bool LockVertexBuffer (void **data)
 
virtual bool UnlockVertexBuffer ()
 
virtual bool LoadEffect (const std::string &filename, DefinesMap *defines)
 
virtual bool Execute (const std::vector< CD3DTexture *> &targets, unsigned int vertexIndexStep)
 
virtual void SetStepParams (unsigned stepIndex)
 

Additional Inherited Members

- Protected Attributes inherited from CWinShader
CD3DEffect m_effect
 
CD3DTexturem_target = nullptr
 

Member Function Documentation

◆ Create()

bool CShaderDX::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.

Implements KODI::SHADER::IShader.

◆ CreateInputBuffer()

bool CShaderDX::CreateInputBuffer ( )
overridevirtual

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.

Implements KODI::SHADER::IShader.

◆ CreateInputLayout()

bool CShaderDX::CreateInputLayout ( D3D11_INPUT_ELEMENT_DESC *  layout,
unsigned  numElements 
)
virtual

Creates the data layout of the input-assembler stage.

Parameters
layoutDescription of the inputs to the vertex shader
numElementsNumber of inputs to the vertex shader
Returns
False if creating the input layout failed, true otherwise.

Reimplemented from CWinShader.

◆ CreateVertexBuffer()

bool CShaderDX::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 CShaderDX::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 CShaderDX::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 CShaderDX::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.


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