This commit is contained in:
Martin Slachta
2026-07-18 14:31:15 +02:00
commit a04f0dc262
3343 changed files with 1140208 additions and 0 deletions
@@ -0,0 +1,54 @@
#pragma once
#include "Gpu.hpp"
class ImageBusWriter {
private:
const Gpu* m_gpu;
/**
* Image to which we are writing
*/
Image *m_pTarget;
uint32_t m_formatSize;
uint32_t m_imageSize;
/**
* Intermediate staging buffer to pass data from heap 3 to heap 0
*/
Buffer m_stagingBuffer;
size_t m_stagingBufferSize;
VkCommandBuffer m_stagingCommandBuffer;
/**
* Pointing to where the staging buffer is mapped
*/
void *m_pMappedData;
std::vector<VkBufferImageCopy> m_writes;
uint32_t m_numWrites;
VkFence m_fence;
int create_staging_buffer(size_t size);
int create_staging_command_buffer();
int create_fence();
public:
ImageBusWriter(const Gpu* gpu, Image *pImage,
VkExtent2D extent, uint32_t formatSize,
size_t maxWrites);
void write(VkBufferImageCopy region, void *pData, size_t size);
void set_target(Image *pTarget) {
flush();
m_pTarget = pTarget;
}
void flush();
};