mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-21 07:35:41 -04:00
Vulkan/Texture: Allow uploading non-zero layers/levels
This commit is contained in:
@ -422,7 +422,7 @@ bool Vulkan::Texture::BeginUpdate(u32 width, u32 height, void** out_buffer, u32*
|
||||
return true;
|
||||
}
|
||||
|
||||
void Vulkan::Texture::EndUpdate(u32 x, u32 y, u32 width, u32 height)
|
||||
void Vulkan::Texture::EndUpdate(u32 x, u32 y, u32 width, u32 height, u32 level, u32 layer)
|
||||
{
|
||||
const u32 pitch = CalcUpdatePitch(width);
|
||||
const u32 required_size = pitch * height;
|
||||
@ -431,11 +431,12 @@ void Vulkan::Texture::EndUpdate(u32 x, u32 y, u32 width, u32 height)
|
||||
const u32 buffer_offset = buffer.GetCurrentOffset();
|
||||
buffer.CommitMemory(required_size);
|
||||
|
||||
UpdateFromBuffer(g_vulkan_context->GetCurrentCommandBuffer(), 0, 0, x, y, width, height, buffer.GetBuffer(),
|
||||
UpdateFromBuffer(g_vulkan_context->GetCurrentCommandBuffer(), level, layer, x, y, width, height, buffer.GetBuffer(),
|
||||
buffer_offset, CalcUpdateRowLength(pitch));
|
||||
}
|
||||
|
||||
bool Vulkan::Texture::Update(u32 x, u32 y, u32 width, u32 height, const void* data, u32 data_pitch)
|
||||
bool Vulkan::Texture::Update(u32 x, u32 y, u32 width, u32 height, u32 level, u32 layer, const void* data,
|
||||
u32 data_pitch)
|
||||
{
|
||||
const u32 pitch = CalcUpdatePitch(width);
|
||||
const u32 row_length = CalcUpdateRowLength(pitch);
|
||||
@ -479,7 +480,8 @@ bool Vulkan::Texture::Update(u32 x, u32 y, u32 width, u32 height, const void* da
|
||||
StringUtil::StrideMemCpy(ai.pMappedData, pitch, data, data_pitch, std::min(data_pitch, pitch), height);
|
||||
vmaFlushAllocation(g_vulkan_context->GetAllocator(), allocation, 0, size);
|
||||
|
||||
UpdateFromBuffer(g_vulkan_context->GetCurrentCommandBuffer(), 0, 0, x, y, width, height, buffer, 0, row_length);
|
||||
UpdateFromBuffer(g_vulkan_context->GetCurrentCommandBuffer(), level, layer, x, y, width, height, buffer, 0,
|
||||
row_length);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -499,8 +501,8 @@ bool Vulkan::Texture::Update(u32 x, u32 y, u32 width, u32 height, const void* da
|
||||
height);
|
||||
sbuffer.CommitMemory(required_size);
|
||||
|
||||
UpdateFromBuffer(g_vulkan_context->GetCurrentCommandBuffer(), 0, 0, x, y, width, height, sbuffer.GetBuffer(),
|
||||
buffer_offset, row_length);
|
||||
UpdateFromBuffer(g_vulkan_context->GetCurrentCommandBuffer(), level, layer, x, y, width, height,
|
||||
sbuffer.GetBuffer(), buffer_offset, row_length);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ public:
|
||||
u32 CalcUpdatePitch(u32 width) const;
|
||||
u32 CalcUpdateRowLength(u32 pitch) const;
|
||||
bool BeginUpdate(u32 width, u32 height, void** out_buffer, u32* out_pitch);
|
||||
void EndUpdate(u32 x, u32 y, u32 width, u32 height);
|
||||
bool Update(u32 x, u32 y, u32 width, u32 height, const void* data, u32 data_pitch);
|
||||
void EndUpdate(u32 x, u32 y, u32 width, u32 height, u32 level, u32 layer);
|
||||
bool Update(u32 x, u32 y, u32 width, u32 height, u32 level, u32 layer, const void* data, u32 data_pitch);
|
||||
|
||||
private:
|
||||
u32 m_width = 0;
|
||||
|
Reference in New Issue
Block a user