1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 04:24:11 +01:00

[dxvk] Use DxvkBufferAllocation in swap chain blitter

This commit is contained in:
Philip Rebohle 2024-09-22 12:10:23 +02:00 committed by Philip Rebohle
parent 5c2f56c9cc
commit 75dadf2c1c
2 changed files with 8 additions and 10 deletions

View File

@ -76,7 +76,7 @@ namespace dxvk {
VkDeviceSize size = cpCount * sizeof(*cpData);
if (cpCount) {
if (m_gammaBuffer == nullptr || m_gammaBuffer->info().size < size) {
if (!m_gammaBuffer || m_gammaBuffer->info().size < size) {
DxvkBufferCreateInfo bufInfo;
bufInfo.size = size;
bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
@ -86,15 +86,15 @@ namespace dxvk {
m_gammaBuffer = m_device->createBuffer(bufInfo,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
m_gammaSlice = m_gammaBuffer->getAllocation();
} else {
m_gammaSlice = m_gammaBuffer->allocateSlice();
}
if (!m_gammaSlice.handle)
m_gammaSlice = m_gammaBuffer->allocSlice();
std::memcpy(m_gammaSlice.mapPtr, cpData, size);
std::memcpy(m_gammaSlice.mapPtr(), cpData, size);
} else {
m_gammaBuffer = nullptr;
m_gammaSlice = DxvkBufferSliceHandle();
m_gammaSlice = DxvkBufferAllocation();
}
m_gammaCpCount = cpCount;
@ -270,14 +270,12 @@ namespace dxvk {
m_gammaView = m_device->createImageView(m_gammaImage, viewInfo);
}
ctx->invalidateBuffer(m_gammaBuffer, m_gammaSlice);
ctx->invalidateBuffer(m_gammaBuffer, std::move(m_gammaSlice));
ctx->copyBufferToImage(m_gammaImage,
VkImageSubresourceLayers { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 },
VkOffset3D { 0, 0, 0 },
VkExtent3D { n, 1, 1 },
m_gammaBuffer, 0, 0, 0);
m_gammaSlice = DxvkBufferSliceHandle();
} else {
m_gammaImage = nullptr;
m_gammaView = nullptr;

View File

@ -81,7 +81,7 @@ namespace dxvk {
Rc<DxvkImageView> m_gammaView;
uint32_t m_gammaCpCount = 0;
bool m_gammaDirty = false;
DxvkBufferSliceHandle m_gammaSlice = { };
DxvkBufferAllocation m_gammaSlice = { };
Rc<DxvkImage> m_resolveImage;
Rc<DxvkImageView> m_resolveView;