Add buffer_device_address path to vertex output fetch on vulkan

This commit is contained in:
baldurk
2021-04-23 19:07:31 +01:00
parent dc5a26ece5
commit 203c4d688e
3 changed files with 580 additions and 217 deletions
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -3334,7 +3334,6 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
// add capabilities
editor.AddCapability(rdcspv::Capability::PhysicalStorageBufferAddresses);
editor.AddCapability(rdcspv::Capability::Int64);
// declare the address constant which we will specialise later. There is a chicken-and-egg where
// this function determines how big the buffer needs to be so instead of hardcoding the address
@@ -3353,6 +3352,8 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
}
else
{
editor.AddCapability(rdcspv::Capability::Int64);
addressConstant =
editor.AddSpecConstantImmediate<uint64_t>(0ULL, (uint32_t)InputSpecConstant::Address);
}
@@ -276,6 +276,22 @@ bool WrappedVulkan::Serialise_vkCreateDescriptorSetLayout(
VkDescriptorSetLayout layout = VK_NULL_HANDLE;
VkDescriptorSetLayoutCreateInfo unwrapped = UnwrapInfo(&CreateInfo);
// on replay we add compute access to any vertex descriptors, so that we can access them for
// mesh output. This is only needed if we are using buffer device address and update-after-bind
// descriptors, because non update-after-bind descriptors we can duplicate and patch. However to
// keep things simple we just always do this whenever using BDA
if(GetExtensions(NULL).ext_KHR_buffer_device_address ||
GetExtensions(NULL).ext_EXT_buffer_device_address)
{
for(uint32_t b = 0; b < unwrapped.bindingCount; b++)
{
VkDescriptorSetLayoutBinding &bind = (VkDescriptorSetLayoutBinding &)unwrapped.pBindings[b];
if(bind.stageFlags & VK_SHADER_STAGE_VERTEX_BIT)
bind.stageFlags |= VK_SHADER_STAGE_COMPUTE_BIT;
}
}
VkResult ret =
ObjDisp(device)->CreateDescriptorSetLayout(Unwrap(device), &unwrapped, NULL, &layout);