OGRE-Next  3.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::D3D11StagingTexture Class Referencefinal

#include <OgreD3D11StagingTexture.h>

+ Inheritance diagram for Ogre::D3D11StagingTexture:

Public Member Functions

 D3D11StagingTexture (VaoManager *vaoManager, PixelFormatGpu formatFamily, uint32 width, uint32 height, uint32 depthOrSlices, D3D11Device &device)
 
 ~D3D11StagingTexture () override
 
size_t _getSizeBytes () override
 Returns size in bytes. More...
 
bool isSmallerThan (const StagingTexture *other) const override
 
void startMapRegion () override
 Must be called from main thread when the StagingBuffer is grabbed. More...
 
void stopMapRegion () override
 Must be called from main thread when the StagingBuffer is released. More...
 
bool supportsFormat (uint32 width, uint32 height, uint32 depth, uint32 slices, PixelFormatGpu pixelFormat) const override
 D3D11 has restrictions about which StagingTextures can be uploaded to which textures based on texture families (for example all PFG_RGBA32_* belong to the same family). More...
 
void upload (const TextureBox &srcBox, TextureGpu *dstTexture, uint8 mipLevel, const TextureBox *cpuSrcBox=0, const TextureBox *dstBox=0, bool skipSysRamCopy=false) override
 Uploads a region of data in srcBox (which must have been created with mapRegion) into dstTexture. More...
 
- Public Member Functions inherited from Ogre::StagingTexture
 StagingTexture (VaoManager *vaoManager, PixelFormatGpu formatFamily)
 
virtual ~StagingTexture ()
 
PixelFormatGpu getFormatFamily () const
 Returns the format family it was requested. More...
 
uint32 getLastFrameUsed () const
 
TextureBox mapRegion (uint32 width, uint32 height, uint32 depth, uint32 slices, PixelFormatGpu pixelFormat)
 Can be called from worker thread, but not from multiple threads at the same time, also you can't call anything else either. More...
 
bool uploadWillStall ()
 If it returns true, startMapRegion will stall. More...
 

Constructor & Destructor Documentation

◆ D3D11StagingTexture()

Ogre::D3D11StagingTexture::D3D11StagingTexture ( VaoManager vaoManager,
PixelFormatGpu  formatFamily,
uint32  width,
uint32  height,
uint32  depthOrSlices,
D3D11Device device 
)

◆ ~D3D11StagingTexture()

Ogre::D3D11StagingTexture::~D3D11StagingTexture ( )
override

Member Function Documentation

◆ _getSizeBytes()

size_t Ogre::D3D11StagingTexture::_getSizeBytes ( )
overridevirtual

Returns size in bytes.

Note it's tagged as advanced use (via _underscore) because Just because a StagingTexture has enough available size, does not mean it can hold the data you'll want (a D3D11 StagingTexture of 256x512 cannot hold 1024x1 texture data even though it has the available capacity)

Returns
Size in bytes of this staging texture.

Implements Ogre::StagingTexture.

◆ isSmallerThan()

bool Ogre::D3D11StagingTexture::isSmallerThan ( const StagingTexture other) const
overridevirtual

Implements Ogre::StagingTexture.

◆ startMapRegion()

void Ogre::D3D11StagingTexture::startMapRegion ( )
overridevirtual

Must be called from main thread when the StagingBuffer is grabbed.

Remarks
Calling this function if you've already called upload() may stall. Grab another StagingTexture to prevent stall. See uploadWillStall.

Reimplemented from Ogre::StagingTexture.

◆ stopMapRegion()

void Ogre::D3D11StagingTexture::stopMapRegion ( )
overridevirtual

Must be called from main thread when the StagingBuffer is released.

Reimplemented from Ogre::StagingTexture.

◆ supportsFormat()

bool Ogre::D3D11StagingTexture::supportsFormat ( uint32  width,
uint32  height,
uint32  depth,
uint32  slices,
PixelFormatGpu  pixelFormat 
) const
overridevirtual

D3D11 has restrictions about which StagingTextures can be uploaded to which textures based on texture families (for example all PFG_RGBA32_* belong to the same family).

This function will return true if the StagingTexture can be used with the given format. On all the other RenderSystems, this nonsense does not exist thus it returns always true unless the request is so big it could never be fullfilled (it's larger than our maximum capacity)

Implements Ogre::StagingTexture.

◆ upload()

void Ogre::D3D11StagingTexture::upload ( const TextureBox srcBox,
TextureGpu dstTexture,
uint8  mipLevel,
const TextureBox cpuSrcBox = 0,
const TextureBox dstBox = 0,
bool  skipSysRamCopy = false 
)
overridevirtual

Uploads a region of data in srcBox (which must have been created with mapRegion) into dstTexture.

Parameters
srcBoxThe source data to copy from. Must have been created from mapRegion and must not have been altered (i.e. changed its internal variables) Values inside srcBox such as x, y, z & sliceStart will be ignored.
dstTextureThe destination texture. If dstBox is a null pointer, srcBox must match the texture dimensions exactly (x,y,z = 0; same resolution)
cpuSrcBoxA CPU-based copy that we can copy CPU -> CPU to our System RAM copy. This parameters must be present if skipSysRamCopy is false and the dstTexture strategy is GpuPageOutStrategy::AlwaysKeepSystemRamCopy or it is in OnSystemRam state.
mipLevelDestination mipmap.
dstBoxOptional. Region inside dstTexture to copy to. Must have the same dimensions as srcBox. Values inside dstBox such as bytesPerRow, bytesPerImage & data will be ignored.
skipSysRamCopyWhether to skip the copy to system RAM. Should only be used if the System RAM copy is already up to date, which is often the case when you're transitioning to Resident while loading at the same time. If misused, readbacks will be incorrect as data in CPU won't mirror that of the data in GPU, and possibly other bugs too.

Reimplemented from Ogre::StagingTexture.


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