|
sKit
0.0.9
|
An SDL_GPUTexture download helper. Can be used to download a texture from the gpu and get as raw data.
More...
#include <TextureDownloader.hpp>
Public Member Functions | |
| TextureDownloader ()=default | |
| TextureDownloader (SDL_GPUDevice *device, SDL_GPUCopyPass *pass, SDL_GPUTexture *sourceTexture, Uint32 width, Uint32 height) | |
| ~TextureDownloader () | |
| Unmaps and releases the SDL_GPUTransferBuffer. More... | |
| auto | getData () -> unsigned char * |
Public Attributes | |
| SDL_GPUTransferBuffer * | buffer |
An SDL_GPUTexture download helper. Can be used to download a texture from the gpu and get as raw data.
Example usage:
Definition at line 22 of file TextureDownloader.hpp.
|
default |
| sKit::SDL::TextureDownloader::TextureDownloader | ( | SDL_GPUDevice * | device, |
| SDL_GPUCopyPass * | pass, | ||
| SDL_GPUTexture * | sourceTexture, | ||
| Uint32 | width, | ||
| Uint32 | height | ||
| ) |
On construction, creates an SDL_GPUTransferBuffer and downloads sourceTexture into it. Must be called within a copy pass.
Definition at line 8 of file TextureDownloader.cpp.
References buffer.
| sKit::SDL::TextureDownloader::~TextureDownloader | ( | ) |
Unmaps and releases the SDL_GPUTransferBuffer.
Definition at line 32 of file TextureDownloader.cpp.
References buffer.
| auto sKit::SDL::TextureDownloader::getData | ( | ) | -> unsigned char* |
Maps the SDL_GPUTransferBuffer as raw data. The data must be used before the TextureDownloaded is destroyed because the unsigned char* will be invalidated.
Definition at line 37 of file TextureDownloader.cpp.
| SDL_GPUTransferBuffer* sKit::SDL::TextureDownloader::buffer |
Definition at line 24 of file TextureDownloader.hpp.
Referenced by TextureDownloader(), and ~TextureDownloader().