mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 16:24:29 +01:00
[dxvk] Use DxvkBufferAllocation in swap chain blitter
This commit is contained in:
parent
5c2f56c9cc
commit
75dadf2c1c
@ -76,7 +76,7 @@ namespace dxvk {
|
|||||||
VkDeviceSize size = cpCount * sizeof(*cpData);
|
VkDeviceSize size = cpCount * sizeof(*cpData);
|
||||||
|
|
||||||
if (cpCount) {
|
if (cpCount) {
|
||||||
if (m_gammaBuffer == nullptr || m_gammaBuffer->info().size < size) {
|
if (!m_gammaBuffer || m_gammaBuffer->info().size < size) {
|
||||||
DxvkBufferCreateInfo bufInfo;
|
DxvkBufferCreateInfo bufInfo;
|
||||||
bufInfo.size = size;
|
bufInfo.size = size;
|
||||||
bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
|
bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
|
||||||
@ -86,15 +86,15 @@ namespace dxvk {
|
|||||||
m_gammaBuffer = m_device->createBuffer(bufInfo,
|
m_gammaBuffer = m_device->createBuffer(bufInfo,
|
||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||||
|
m_gammaSlice = m_gammaBuffer->getAllocation();
|
||||||
|
} else {
|
||||||
|
m_gammaSlice = m_gammaBuffer->allocateSlice();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_gammaSlice.handle)
|
std::memcpy(m_gammaSlice.mapPtr(), cpData, size);
|
||||||
m_gammaSlice = m_gammaBuffer->allocSlice();
|
|
||||||
|
|
||||||
std::memcpy(m_gammaSlice.mapPtr, cpData, size);
|
|
||||||
} else {
|
} else {
|
||||||
m_gammaBuffer = nullptr;
|
m_gammaBuffer = nullptr;
|
||||||
m_gammaSlice = DxvkBufferSliceHandle();
|
m_gammaSlice = DxvkBufferAllocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gammaCpCount = cpCount;
|
m_gammaCpCount = cpCount;
|
||||||
@ -270,14 +270,12 @@ namespace dxvk {
|
|||||||
m_gammaView = m_device->createImageView(m_gammaImage, viewInfo);
|
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,
|
ctx->copyBufferToImage(m_gammaImage,
|
||||||
VkImageSubresourceLayers { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 },
|
VkImageSubresourceLayers { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 },
|
||||||
VkOffset3D { 0, 0, 0 },
|
VkOffset3D { 0, 0, 0 },
|
||||||
VkExtent3D { n, 1, 1 },
|
VkExtent3D { n, 1, 1 },
|
||||||
m_gammaBuffer, 0, 0, 0);
|
m_gammaBuffer, 0, 0, 0);
|
||||||
|
|
||||||
m_gammaSlice = DxvkBufferSliceHandle();
|
|
||||||
} else {
|
} else {
|
||||||
m_gammaImage = nullptr;
|
m_gammaImage = nullptr;
|
||||||
m_gammaView = nullptr;
|
m_gammaView = nullptr;
|
||||||
|
@ -81,7 +81,7 @@ namespace dxvk {
|
|||||||
Rc<DxvkImageView> m_gammaView;
|
Rc<DxvkImageView> m_gammaView;
|
||||||
uint32_t m_gammaCpCount = 0;
|
uint32_t m_gammaCpCount = 0;
|
||||||
bool m_gammaDirty = false;
|
bool m_gammaDirty = false;
|
||||||
DxvkBufferSliceHandle m_gammaSlice = { };
|
DxvkBufferAllocation m_gammaSlice = { };
|
||||||
|
|
||||||
Rc<DxvkImage> m_resolveImage;
|
Rc<DxvkImage> m_resolveImage;
|
||||||
Rc<DxvkImageView> m_resolveView;
|
Rc<DxvkImageView> m_resolveView;
|
||||||
|
Loading…
Reference in New Issue
Block a user