candlewick 0.1.0
A renderer
Loading...
Searching...
No Matches
WriteTextureToImage.h
Go to the documentation of this file.
1#pragma once
2
3#include "../core/Core.h"
4#include <SDL3/SDL_gpu.h>
5
6namespace candlewick {
7namespace media {
8
10 Uint32 *data;
11 SDL_GPUTextureFormat format;
12 Uint16 width;
13 Uint16 height;
14 SDL_GPUTransferBuffer *buffer; // used for unmapping later
16 };
17
20 SDL_GPUDevice *_device = nullptr;
21 SDL_GPUTransferBuffer *_buffer = nullptr;
22 Uint32 _currentBufSize = 0;
23
24 public:
25 TransferBufferPool(const Device &device);
26 void release() noexcept;
27 ~TransferBufferPool() noexcept { this->release(); }
28
29 SDL_GPUTransferBuffer *acquireBuffer(Uint32 requiredSize);
30 };
31
36 const Device &device, TransferBufferPool &pool,
37 SDL_GPUTexture *texture,
38 SDL_GPUTextureFormat format,
39 const Uint16 width, const Uint16 height);
40
41 void saveTextureToFile(CommandBuffer &command_buffer, const Device &device,
42 TransferBufferPool &pool, SDL_GPUTexture *texture,
43 SDL_GPUTextureFormat format, const Uint16 width,
44 const Uint16 height, std::string_view filename);
45
46} // namespace media
47} // namespace candlewick
Definition CommandBuffer.h:17
Transfer buffer for the texture downloader.
Definition WriteTextureToImage.h:19
SDL_GPUTransferBuffer * acquireBuffer(Uint32 requiredSize)
TransferBufferPool(const Device &device)
Definition VideoRecorder.h:14
void saveTextureToFile(CommandBuffer &command_buffer, const Device &device, TransferBufferPool &pool, SDL_GPUTexture *texture, SDL_GPUTextureFormat format, const Uint16 width, const Uint16 height, std::string_view filename)
DownloadResult downloadTexture(CommandBuffer &command_buffer, const Device &device, TransferBufferPool &pool, SDL_GPUTexture *texture, SDL_GPUTextureFormat format, const Uint16 width, const Uint16 height)
Download texture to a mapped buffer.
Definition Camera.h:8
RAII wrapper for SDL_GPUDevice.
Definition Device.h:17
Definition WriteTextureToImage.h:9
SDL_GPUTransferBuffer * buffer
Definition WriteTextureToImage.h:14
SDL_GPUTextureFormat format
Definition WriteTextureToImage.h:11
Uint16 height
Definition WriteTextureToImage.h:13
Uint32 * data
Definition WriteTextureToImage.h:10
Uint32 payloadSize
Definition WriteTextureToImage.h:15
Uint16 width
Definition WriteTextureToImage.h:12