diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2023-01-27 18:46:53 -0600 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2023-01-27 18:46:53 -0600 |
| commit | 7bea39b39e9978ca8461adf68a2c28535719c48e (patch) | |
| tree | 7329c4aab053fada727c88bf996050f04e2bdb4f /Source/Core/VideoBackends/Vulkan | |
| parent | 41272dc5f1b62f4a5a0562cc29eb3e83367d0f14 (diff) | |
VideoBackends: add a way to load data into a specific level AND layer, default to layer 0
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/VKTexture.cpp | 16 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/VKTexture.h | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp index 412deaf5f9..c39756f3d7 100644 --- a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp @@ -320,7 +320,7 @@ void VKTexture::ResolveFromTexture(const AbstractTexture* src, const MathUtil::R } void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, - size_t buffer_size) + size_t buffer_size, u32 layer) { // Can't copy data larger than the texture extents. width = std::max(1u, std::min(width, GetWidth() >> level)); @@ -396,12 +396,12 @@ void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* // Copy from the streaming buffer to the actual image. VkBufferImageCopy image_copy = { - upload_buffer_offset, // VkDeviceSize bufferOffset - row_length, // uint32_t bufferRowLength - 0, // uint32_t bufferImageHeight - {VK_IMAGE_ASPECT_COLOR_BIT, level, 0, 1}, // VkImageSubresourceLayers imageSubresource - {0, 0, 0}, // VkOffset3D imageOffset - {width, height, 1} // VkExtent3D imageExtent + upload_buffer_offset, // VkDeviceSize bufferOffset + row_length, // uint32_t bufferRowLength + 0, // uint32_t bufferImageHeight + {VK_IMAGE_ASPECT_COLOR_BIT, level, layer, 1}, // VkImageSubresourceLayers imageSubresource + {0, 0, 0}, // VkOffset3D imageOffset + {width, height, 1} // VkExtent3D imageExtent }; vkCmdCopyBufferToImage(g_command_buffer_mgr->GetCurrentInitCommandBuffer(), upload_buffer, m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &image_copy); @@ -410,7 +410,7 @@ void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* // likely finished with writes to this texture for now. We can't do this in common with a // FinishedRendering() call because the upload happens in the init command buffer, and we // don't want to interrupt the render pass with calls which were executed ages before. - if (level == (m_config.levels - 1)) + if (level == (m_config.levels - 1) && layer == (m_config.layers - 1)) { TransitionToLayout(g_command_buffer_mgr->GetCurrentInitCommandBuffer(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); diff --git a/Source/Core/VideoBackends/Vulkan/VKTexture.h b/Source/Core/VideoBackends/Vulkan/VKTexture.h index f2eae6d80c..1862da3825 100644 --- a/Source/Core/VideoBackends/Vulkan/VKTexture.h +++ b/Source/Core/VideoBackends/Vulkan/VKTexture.h @@ -46,8 +46,8 @@ public: u32 dst_layer, u32 dst_level) override; void ResolveFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& rect, u32 layer, u32 level) override; - 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 FinishedRendering() override; VkImage GetImage() const { return m_image; } |
