API Documentation
Public Member Functions | Static Public Member Functions | List of all members
nkGraphics::TextureExternalData Class Referencefinal

External texture data, allowing to inject low-level constructs within the renderers. More...

Public Member Functions

 ~TextureExternalData ()
 
void * getResource () const
 
RESOURCE_STATE getState () const
 
unsigned int getId () const
 
TEXTURE_RENDER_FLAG getRenderFlag () const
 
RENDERING_API getTargetApi () const
 
bool getGammaCorrect () const
 
void setRenderFlag (TEXTURE_RENDER_FLAG value)
 
void setGammaCorrect (bool value)
 

Static Public Member Functions

static TextureExternalData forDx11 (void *resource)
 
static TextureExternalData forDx12 (void *resource, RESOURCE_STATE state)
 
static TextureExternalData forGles (unsigned int id)
 

Detailed Description

External texture data, allowing to inject low-level constructs within the renderers.

This structure has to be built for the target renderer using the right static construction method. Each renderer has its specificities that needs to be taken into account when feeding an external resource.
Injected resources need to be available within the device / context internal to the target renderer. To access these, check Renderer::getInternalData().
Such injection should be limited to the strict minimum, as it can lead to incorrect internal rendering state if wrongly managed. However, they can be necessary to integrate external libraries within the rendering pipeline.

Constructor & Destructor Documentation

◆ ~TextureExternalData()

nkGraphics::TextureExternalData::~TextureExternalData ( )

Destructor.

Member Function Documentation

◆ getResource()

void* nkGraphics::TextureExternalData::getResource ( ) const
Returns
The external resource stored inside.
Remarks
This is exclusive to the Dx11 and Dx12 versions.

◆ getState()

RESOURCE_STATE nkGraphics::TextureExternalData::getState ( ) const
Returns
The state of the resource stored inside.
Remarks
This is exclusive to the Dx11 and Dx12 versions.

◆ getId()

unsigned int nkGraphics::TextureExternalData::getId ( ) const
Returns
The external resource's id.
Remarks
This is exclusive to the Gles version.

◆ getRenderFlag()

TEXTURE_RENDER_FLAG nkGraphics::TextureExternalData::getRenderFlag ( ) const
Returns
The render flag linked to the resource.

◆ getTargetApi()

RENDERING_API nkGraphics::TextureExternalData::getTargetApi ( ) const
Returns
The target rendering API for the data instance.

◆ getGammaCorrect()

bool nkGraphics::TextureExternalData::getGammaCorrect ( ) const
Returns
Whether the texture is expected to be gamma corrected (true) or not (false).

◆ setRenderFlag()

void nkGraphics::TextureExternalData::setRenderFlag ( TEXTURE_RENDER_FLAG  value)

Sets the render flag the resource given is expected to be compatible with.

Parameters
valueThe render flag to assign to the resource.
Remarks
This flag needs to be set manually for the renderer to know which resource views can be created. For instance, an external color target without the correct flag set won't have its render target view created, and won't be available for usage within the TargetOperations.

◆ setGammaCorrect()

void nkGraphics::TextureExternalData::setGammaCorrect ( bool  value)

Sets whether the resource should be gamma corrected or not. This will drive the final views formats, SRGB or not.

Parameters
valueIf it should be gamma corrected (true) or not (false).

◆ forDx11()

static TextureExternalData nkGraphics::TextureExternalData::forDx11 ( void *  resource)
static

Creates an instance of external data ready for the Dx11Renderer. Use this version when feeding data to the system when initialized using RENDERING_API::D3D11.

Parameters
resourceThe ID3D11Resource to use.
Returns
An instance ready to be fed to a texture living within a D3D11 initialized system.

◆ forDx12()

static TextureExternalData nkGraphics::TextureExternalData::forDx12 ( void *  resource,
RESOURCE_STATE  state 
)
static

Creates an instance of external data ready for the Dx12Renderer. Use this version when feeding data to the system when initialized using RENDERING_API::D3D12.

Parameters
resourceThe ID3D12Resource to use.
stateThe state the resource is in.
Returns
An instance ready to be fed to a texture living within a D3D12 initialized system.
Remarks
The state is necessary for the renderer to correctly place all the transition barriers needed when rendering a frame. Note that the renderer will make sure this state is eventually the one the resource is in after rendering, even if transitions were needed internally. For instance, if a texture is passed in the render target state, it will keep this state after a frame is rendered.

◆ forGles()

static TextureExternalData nkGraphics::TextureExternalData::forGles ( unsigned int  id)
static

Creates an instance of external data ready for the GlesRenderer. Use this version when feeding data to the system when initialized using RENDERING_API::GLES.

Parameters
idThe resource id to use.
Returns
An instance ready to be fed to a texture living within a GLES initialized system.

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