VideoBackends: add a way to load data into a specific level AND layer, default to layer 0

This commit is contained in:
iwubcode
2023-01-27 18:46:53 -06:00
parent 41272dc5f1
commit 7bea39b39e
15 changed files with 43 additions and 42 deletions

View File

@ -203,7 +203,7 @@ bool DXTexture::CreateUAVDescriptor()
}
void DXTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size)
size_t buffer_size, u32 layer)
{
// Textures greater than 1024*1024 will be put in staging textures that are released after
// execution instead. A 2048x2048 texture is 16MB, and we'd only fit four of these in our
@ -301,7 +301,7 @@ void DXTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
const u32 aligned_height = Common::AlignUp(height, block_size);
const D3D12_TEXTURE_COPY_LOCATION dst_loc = {m_resource.Get(),
D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
{static_cast<UINT>(CalcSubresource(level, 0))}};
{static_cast<UINT>(CalcSubresource(level, layer))}};
const D3D12_TEXTURE_COPY_LOCATION src_loc = {
upload_buffer_resource,
D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT,

View File

@ -23,8 +23,8 @@ public:
static std::unique_ptr<DXTexture> Create(const TextureConfig& config, std::string_view name);
static std::unique_ptr<DXTexture> CreateAdopted(ID3D12Resource* resource);
void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size) override;
void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, size_t buffer_size,
u32 layer) override;
void CopyRectangleFromTexture(const AbstractTexture* src,
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
u32 src_level, const MathUtil::Rectangle<int>& dst_rect,