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

[dxvk] Store GPU address for allocated chunk memory

This commit is contained in:
Philip Rebohle 2024-09-23 01:09:55 +02:00 committed by Philip Rebohle
parent 51649f6da6
commit 10164fdf4d
2 changed files with 10 additions and 2 deletions

View File

@ -713,8 +713,12 @@ namespace dxvk {
&& (requirements.memoryRequirements.memoryTypeBits & (1u << type.index))) {
status = vk->vkBindBufferMemory(vk->device(), buffer, result.memory, 0);
if (status == VK_SUCCESS)
if (status == VK_SUCCESS) {
result.buffer = buffer;
if (type.bufferUsage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)
result.gpuVa = getBufferDeviceAddress(buffer);
}
}
if (!result.buffer)
@ -796,6 +800,8 @@ namespace dxvk {
if (chunk.memory.buffer) {
allocation->m_buffer = chunk.memory.buffer;
allocation->m_bufferOffset = offset;
allocation->m_bufferAddress = chunk.memory.gpuVa
? chunk.memory.gpuVa + offset : 0u;
}
return allocation;
@ -819,6 +825,7 @@ namespace dxvk {
allocation->m_mapPtr = memory.mapPtr;
allocation->m_buffer = memory.buffer;
allocation->m_bufferAddress = memory.gpuVa;
return allocation;
}

View File

@ -70,8 +70,9 @@ namespace dxvk {
struct DxvkDeviceMemory {
VkBuffer buffer = VK_NULL_HANDLE;
VkDeviceMemory memory = VK_NULL_HANDLE;
VkDeviceSize size = 0;
VkDeviceSize size = 0u;
void* mapPtr = nullptr;
VkDeviceAddress gpuVa = 0u;
};