Foundation
Loading...
Searching...
No Matches
UploadContext.hpp
Go to the documentation of this file.
1#pragma once
2#include <Async/Future.hpp>
3#include <Bits/Format.hpp>
4#include <RHICore/Device.hpp>
6#include "StagingBuffer.hpp"
8{
9 using namespace RHI;
27 {
30
36
38 public:
40 // !! TODO: Bound checks!
41 void Upload(RHIBuffer* dst, Span<const char> data, size_t dstOffset = 0, size_t alignment = 4,
42 RHIResourceAccess dst_access = RHIResourceAccessBits::ShaderRead,
43 RHIPipelineStage dst_stage = RHIPipelineStageBits::AllGraphics);
47 RHIResourceAccess dst_access = RHIResourceAccessBits::ShaderRead,
48 RHIPipelineStage dst_stage = RHIPipelineStageBits::AllGraphics,
49 RHITextureLayout dst_layout = RHITextureLayout::ShaderReadOnly);
50 void Upload(RHITexture* dst, Span<const char> data, uint32_t mipLevel = 0, uint32_t arrayLayer = 0,
51 RHITextureAspectFlag aspect = RHITextureAspectFlagBits::Color,
52 RHIResourceAccess dst_access = RHIResourceAccessBits::ShaderRead,
53 RHIPipelineStage dst_stage = RHIPipelineStageBits::AllGraphics,
54 RHITextureLayout dst_layout = RHITextureLayout::ShaderReadOnly);
55 void SubmitAndWait();
57 };
58} // namespace Foundation::Rendering
General Purpose Allocator (GPA) interface.
Definition Allocator.hpp:24
Definition Resource.hpp:30
Definition Device.hpp:13
Definition Device.hpp:131
Definition Resource.hpp:146
Bump-only allocation buffer used for staging data to be transferred to GPU.
Definition StagingBuffer.hpp:18
Deferred upload context for transferring data to GPU resources.
Definition UploadContext.hpp:27
Vector< RHICommandPoolScopedHandle< RHICommandList > > mCommandLists
Definition UploadContext.hpp:33
StagingBuffer mStagingBuffer
Definition UploadContext.hpp:35
RHIDeviceQueue * mQueue
Definition UploadContext.hpp:31
RHIDevice * mDevice
Definition UploadContext.hpp:28
Async::Mutex mMutex
Definition UploadContext.hpp:37
RHIDeviceScopedObjectHandle< RHICommandPool > mCommandPool
Definition UploadContext.hpp:32
Allocator * mAllocator
Definition UploadContext.hpp:29
~UploadContext()
Definition UploadContext.cpp:91
void SubmitAndWait()
Definition UploadContext.cpp:73
RHIDeviceScopedObjectHandle< RHIDeviceFence > mFence
Definition UploadContext.hpp:34
std::mutex Mutex
Definition Future.hpp:15
std::unique_ptr< T, StlDeleter< T > > UniquePtr
std::unique_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
Definition Allocator.hpp:161
RHITextureLayout
Definition Common.hpp:99
Reference implementations of real-time rendering routines.
Definition Application.hpp:18