GPUDevice: Add GPUDownloadTexture
Which can also be based in host/client memory. Use it for screenshots and VRAM downloads.
This commit is contained in:
@@ -30,6 +30,7 @@ class D3D12Pipeline;
|
||||
class D3D12SwapChain;
|
||||
class D3D12Texture;
|
||||
class D3D12TextureBuffer;
|
||||
class D3D12DownloadTexture;
|
||||
|
||||
namespace D3D12MA {
|
||||
class Allocator;
|
||||
@@ -39,6 +40,7 @@ class D3D12Device final : public GPUDevice
|
||||
{
|
||||
public:
|
||||
friend D3D12Texture;
|
||||
friend D3D12DownloadTexture;
|
||||
|
||||
template<typename T>
|
||||
using ComPtr = Microsoft::WRL::ComPtr<T>;
|
||||
@@ -74,8 +76,11 @@ public:
|
||||
std::unique_ptr<GPUSampler> CreateSampler(const GPUSampler::Config& config) override;
|
||||
std::unique_ptr<GPUTextureBuffer> CreateTextureBuffer(GPUTextureBuffer::Format format, u32 size_in_elements) override;
|
||||
|
||||
bool DownloadTexture(GPUTexture* texture, u32 x, u32 y, u32 width, u32 height, void* out_data,
|
||||
u32 out_data_stride) override;
|
||||
std::unique_ptr<GPUDownloadTexture> CreateDownloadTexture(u32 width, u32 height, GPUTexture::Format format) override;
|
||||
std::unique_ptr<GPUDownloadTexture> CreateDownloadTexture(u32 width, u32 height, GPUTexture::Format format,
|
||||
void* memory, size_t memory_size,
|
||||
u32 memory_stride) override;
|
||||
|
||||
bool SupportsTextureFormat(GPUTexture::Format format) const override;
|
||||
void CopyTextureRegion(GPUTexture* dst, u32 dst_x, u32 dst_y, u32 dst_layer, u32 dst_level, GPUTexture* src,
|
||||
u32 src_x, u32 src_y, u32 src_layer, u32 src_level, u32 width, u32 height) override;
|
||||
@@ -244,9 +249,6 @@ private:
|
||||
|
||||
bool IsRenderTargetBound(const GPUTexture* tex) const;
|
||||
|
||||
bool CheckDownloadBufferSize(u32 required_size);
|
||||
void DestroyDownloadBuffer();
|
||||
|
||||
/// Set dirty flags on everything to force re-bind at next draw time.
|
||||
void InvalidateCachedState();
|
||||
void SetVertexBuffer(ID3D12GraphicsCommandList4* cmdlist);
|
||||
@@ -321,10 +323,6 @@ private:
|
||||
SamplerMap m_sampler_map;
|
||||
ComPtr<ID3D12PipelineLibrary> m_pipeline_library;
|
||||
|
||||
ComPtr<D3D12MA::Allocation> m_download_buffer_allocation;
|
||||
ComPtr<ID3D12Resource> m_download_buffer;
|
||||
u32 m_download_buffer_size = 0;
|
||||
|
||||
// Which bindings/state has to be updated before the next draw.
|
||||
u32 m_dirty_flags = ALL_DIRTY_STATE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user