|
| StagingTexture (VaoManager *vaoManager, PixelFormatGpu formatFamily) |
|
virtual | ~StagingTexture () |
|
virtual size_t | _getSizeBytes ()=0 |
| Returns size in bytes. More...
|
|
PixelFormatGpu | getFormatFamily () const |
| Returns the format family it was requested. More...
|
|
uint32 | getLastFrameUsed () const |
|
virtual bool | isSmallerThan (const StagingTexture *other) const =0 |
|
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...
|
|
void | operator delete (void *ptr) |
|
void | operator delete (void *ptr, const char *, int, const char *) |
|
void | operator delete (void *ptr, void *) |
|
void | operator delete[] (void *ptr) |
|
void | operator delete[] (void *ptr, const char *, int, const char *) |
|
void * | operator new (size_t sz) |
|
void * | operator new (size_t sz, const char *file, int line, const char *func) |
| operator new, with debug line info More...
|
|
void * | operator new (size_t sz, void *ptr) |
| placement operator new More...
|
|
void * | operator new[] (size_t sz) |
|
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
| array operator new, with debug line info More...
|
|
virtual void | startMapRegion () |
| Must be called from main thread when the StagingBuffer is grabbed. More...
|
|
virtual void | stopMapRegion () |
| Must be called from main thread when the StagingBuffer is released. More...
|
|
virtual bool | supportsFormat (uint32 width, uint32 height, uint32 depth, uint32 slices, PixelFormatGpu pixelFormat) const =0 |
| 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...
|
|
virtual void | upload (const TextureBox &srcBox, TextureGpu *dstTexture, uint8 mipLevel, const TextureBox *cpuSrcBox=0, const TextureBox *dstBox=0, bool skipSysRamCopy=false) |
| Uploads a region of data in srcBox (which must have been created with mapRegion) into dstTexture. More...
|
|
bool | uploadWillStall () |
| If it returns true, startMapRegion will stall. More...
|
|
A StagingTexture is an intermediate texture that can be read and be written from both CPU & GPU.
However the access in both cases is limited. GPUs can only copy (i.e. memcpy) to another real texture (can't be used directly as a texture or render target) and CPUs can only map it. In other words, a staging texture is an intermediate to transfer data between CPU & GPU
- How to write to 2 textures (texture0 & texture1; we pass twice the amount of slices to getStagingTexture): TextureGpuManager &textureManager = ...; StagingTexture *stagingTexture = textureManager.getStagingTexture( width, height, depth, slices * 2, pixelFormat ); stagingTexture->startMapRegion(); TextureBox box0 = stagingTexture->mapRegion( width, height, depth, slices, pixelFormat ); ... write to box0.data ... TextureBox box1 = stagingTexture->mapRegion( width, height, depth, slices, pixelFormat ); ... write to box1.data ... stagingTexture->stopMapRegion(); stagingTexture->upload( box0, texture0 ); stagingTexture->upload( box1, texture1 ); textureManager.removeStagingTexture( stagingTexture );
- There are other possibilities, as you can request a StagingTexture with twice the width & height and then start calling mapRegion with smaller textures and we'll handle the packing. However you have to check mapRegion doesn't return nullptr in TextureBox::data. If so, that means we have ran out of space.
- Notably derived classes are: StagingTextureBufferImpl GL3PlusStagingTexture MetalStagingTexture D3D11StagingTexture
Returns the format family it was requested.
Note that in non-D3D11 RenderSystems, supportsFormat may return true despite a format not being from the same family. This information is mostly useful for keeping memory budgets consistent between different APIs (e.g. on D3D11 two StagingTextures, one that supports RGB8, another for BC1 of 64 MB each; on OpenGL we need to request two textures of 64MB each, and not just one because the first one can fulfill every request)