mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-03 12:33:58 +00:00
Add CAPTURE_REPLAY_BIT flags globally when descriptor buffers are used
* This applies to all ASs, images, image views, buffers and samplers. Buffer views are not used with this extension. We enable this globally even if there are resources which wouldn't be possible to put in a descriptor (e.g. transfer only) or if they are internal allocations. The ordering rules are poorly written - as the letter of the spec goes it would be impossible to ever omit this flag during capture since we can't put all capture/replay creates before all non-capture/replay creates. On replay in theory we could, but we also don't know how well drivers will implement these rules anyway.
This commit is contained in:
16 files changed
+131
-25
No files matched your search
@@ -864,7 +864,7 @@ VulkanAccelerationStructureManager::Allocation VulkanAccelerationStructureManage
|
||||
const VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultBufferCreateFlags(),
|
||||
size,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT |
|
||||
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | extraUsageFlags,
|
||||
|
||||
@@ -219,7 +219,7 @@ void GPUBuffer::Create(WrappedVulkan *driver, VkDevice dev, VkDeviceSize size, u
|
||||
ringCount = ringSize;
|
||||
|
||||
VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, NULL, 0, totalsize, 0,
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, NULL, driver->DefaultBufferCreateFlags(), totalsize, 0,
|
||||
};
|
||||
|
||||
bufInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||
@@ -271,6 +271,14 @@ void GPUBuffer::Create(WrappedVulkan *driver, VkDevice dev, VkDeviceSize size, u
|
||||
memFlags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT;
|
||||
}
|
||||
|
||||
if((driver->DefaultBufferCreateFlags() &
|
||||
VK_BUFFER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT) != 0)
|
||||
{
|
||||
allocInfo.pNext = &memFlags;
|
||||
memFlags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT |
|
||||
VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
}
|
||||
|
||||
vkr = ObjDisp(dev)->AllocateMemory(Unwrap(dev), &allocInfo, NULL, &mem);
|
||||
CHECK_VKR(driver, vkr);
|
||||
|
||||
|
||||
@@ -2676,7 +2676,7 @@ bool WrappedVulkan::EndFrameCapture(DeviceOwnedWindow devWnd)
|
||||
VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
DefaultBufferCreateFlags(),
|
||||
GetByteSize(imageInfo.extent.width, imageInfo.extent.height, 1, imageInfo.format, 0),
|
||||
VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
};
|
||||
|
||||
@@ -485,6 +485,7 @@ private:
|
||||
bool m_AccelerationStructures = false;
|
||||
bool m_ShaderObject = false;
|
||||
bool m_Maintenance5 = false;
|
||||
bool m_DescriptorBuffers = false;
|
||||
|
||||
uint32_t m_RTCaptureReplayHandleSize = 0;
|
||||
|
||||
@@ -1385,6 +1386,7 @@ public:
|
||||
bool AccelerationStructures() const { return m_AccelerationStructures; }
|
||||
bool ShaderObject() const { return m_ShaderObject; }
|
||||
bool Maintenance5() const { return m_Maintenance5; }
|
||||
bool DescriptorBuffers() const { return m_DescriptorBuffers; }
|
||||
VulkanRenderState &GetRenderState() { return m_RenderState; }
|
||||
void SetActionCB(VulkanActionCallback *cb) { m_ActionCallback = cb; }
|
||||
void SetSubmitChain(void *submitChain) { m_SubmitChain = submitChain; }
|
||||
@@ -1402,6 +1404,23 @@ public:
|
||||
static VkResult GetProvidedInstanceExtensionProperties(uint32_t *pPropertyCount,
|
||||
VkExtensionProperties *pProperties);
|
||||
|
||||
VkBufferCreateFlags DefaultBufferCreateFlags()
|
||||
{
|
||||
return DescriptorBuffers() ? VK_BUFFER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT : 0;
|
||||
}
|
||||
VkImageCreateFlags DefaultImageCreateFlags()
|
||||
{
|
||||
return DescriptorBuffers() ? VK_IMAGE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT : 0;
|
||||
}
|
||||
VkImageViewCreateFlags DefaultImageViewCreateFlags()
|
||||
{
|
||||
return DescriptorBuffers() ? VK_IMAGE_VIEW_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT : 0;
|
||||
}
|
||||
VkSamplerCreateFlags DefaultSamplerCreateFlags()
|
||||
{
|
||||
return DescriptorBuffers() ? VK_SAMPLER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT : 0;
|
||||
}
|
||||
|
||||
const VkPhysicalDeviceFeatures &GetDeviceEnabledFeatures()
|
||||
{
|
||||
return m_PhysicalDeviceData.enabledFeatures;
|
||||
|
||||
@@ -456,7 +456,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver)
|
||||
VkImageCreateInfo imInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageCreateFlags(),
|
||||
VK_IMAGE_TYPE_2D,
|
||||
// format is required to be supported for sampling
|
||||
VK_FORMAT_R8G8B8A8_UNORM,
|
||||
@@ -507,7 +507,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver)
|
||||
VkImageCreateInfo imInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageCreateFlags(),
|
||||
VK_IMAGE_TYPE_2D,
|
||||
f,
|
||||
{1, 1, 1},
|
||||
@@ -584,6 +584,14 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver)
|
||||
driver->GetGPULocalMemoryIndex(mrq.memoryTypeBits),
|
||||
};
|
||||
|
||||
VkMemoryAllocateFlagsInfo memFlags = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO};
|
||||
if(driver->DescriptorBuffers())
|
||||
{
|
||||
allocInfo.pNext = &memFlags;
|
||||
memFlags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT |
|
||||
VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
}
|
||||
|
||||
vkr = ObjDisp(dev)->AllocateMemory(Unwrap(dev), &allocInfo, NULL, &m_UnwrappedDummyMemory);
|
||||
CHECK_VKR(m_pDriver, vkr);
|
||||
|
||||
@@ -603,7 +611,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver)
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageViewCreateFlags(),
|
||||
m_UnwrappedDummyStencilImage,
|
||||
VK_IMAGE_VIEW_TYPE_2D_ARRAY,
|
||||
f,
|
||||
@@ -4143,7 +4151,7 @@ void VulkanReplay::TextureRendering::Init(WrappedVulkan *driver, VkDescriptorPoo
|
||||
VkImageCreateInfo imInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
driver->DefaultImageCreateFlags(),
|
||||
types[type],
|
||||
formats[fmt],
|
||||
{1, 1, 1},
|
||||
@@ -4162,7 +4170,7 @@ void VulkanReplay::TextureRendering::Init(WrappedVulkan *driver, VkDescriptorPoo
|
||||
if(type == 1)
|
||||
{
|
||||
imInfo.arrayLayers = 6;
|
||||
imInfo.flags = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
|
||||
imInfo.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
|
||||
}
|
||||
|
||||
// some depth images might not be supported
|
||||
@@ -4179,7 +4187,7 @@ void VulkanReplay::TextureRendering::Init(WrappedVulkan *driver, VkDescriptorPoo
|
||||
{
|
||||
// create non-cube compatible
|
||||
imInfo.arrayLayers = 1;
|
||||
imInfo.flags = 0;
|
||||
imInfo.flags &= ~VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
|
||||
|
||||
DepthCubesSupported = false;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
DefaultBufferCreateFlags(),
|
||||
0,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT |
|
||||
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
|
||||
@@ -535,7 +535,7 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
|
||||
VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
DefaultBufferCreateFlags(),
|
||||
0,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
};
|
||||
|
||||
@@ -400,6 +400,11 @@ MemoryAllocation WrappedVulkan::AllocateMemoryForResource(bool buffer, VkMemoryR
|
||||
memoryTypeIndex,
|
||||
};
|
||||
|
||||
// buffers will be created with capture/replay so we need to make the memory capture/replay
|
||||
// unconditionally too
|
||||
if(DescriptorBuffers())
|
||||
flagsInfo.flags |= VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
|
||||
if(ret.size > info.allocationSize)
|
||||
{
|
||||
// if we get an over-sized allocation, first try to immediately jump to the largest block
|
||||
|
||||
@@ -54,7 +54,7 @@ void VulkanDebugManager::CopyTex2DMSToBuffer(VkCommandBuffer cmd, VkBuffer destB
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageViewCreateFlags(),
|
||||
srcMS,
|
||||
VK_IMAGE_VIEW_TYPE_2D_ARRAY,
|
||||
VK_FORMAT_UNDEFINED,
|
||||
@@ -235,7 +235,7 @@ void VulkanDebugManager::CopyDepthTex2DMSToBuffer(VkCommandBuffer cmd, VkBuffer
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageViewCreateFlags(),
|
||||
srcMS,
|
||||
VK_IMAGE_VIEW_TYPE_2D_ARRAY,
|
||||
fmt,
|
||||
@@ -422,7 +422,7 @@ void VulkanDebugManager::CopyBufferToTex2DMS(VkCommandBuffer cmd, VkImage destMS
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageViewCreateFlags(),
|
||||
destMS,
|
||||
VK_IMAGE_VIEW_TYPE_2D_ARRAY,
|
||||
VK_FORMAT_UNDEFINED,
|
||||
@@ -631,7 +631,7 @@ void VulkanDebugManager::CopyDepthBufferToTex2DMS(VkCommandBuffer cmd, VkImage d
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageViewCreateFlags(),
|
||||
destMS,
|
||||
VK_IMAGE_VIEW_TYPE_2D_ARRAY,
|
||||
fmt,
|
||||
|
||||
@@ -483,7 +483,7 @@ void VulkanReplay::OutputWindow::Create(WrappedVulkan *driver, VkDevice device,
|
||||
VkImageViewCreateInfo info = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
driver->DefaultImageViewCreateFlags(),
|
||||
Unwrap(dsimg),
|
||||
VK_IMAGE_VIEW_TYPE_2D,
|
||||
VK_FORMAT_D32_SFLOAT,
|
||||
@@ -639,7 +639,7 @@ void VulkanReplay::OutputWindow::Create(WrappedVulkan *driver, VkDevice device,
|
||||
VkImageViewCreateInfo info = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
driver->DefaultImageViewCreateFlags(),
|
||||
Unwrap(bb),
|
||||
VK_IMAGE_VIEW_TYPE_2D,
|
||||
imformat,
|
||||
|
||||
@@ -57,6 +57,7 @@ VulkanTextRenderer::VulkanTextRenderer(WrappedVulkan *driver)
|
||||
// create linear sampler
|
||||
VkSamplerCreateInfo sampInfo = {VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO};
|
||||
|
||||
sampInfo.flags = driver->DefaultSamplerCreateFlags();
|
||||
sampInfo.minFilter = sampInfo.magFilter = VK_FILTER_LINEAR;
|
||||
sampInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||
sampInfo.addressModeU = sampInfo.addressModeV = sampInfo.addressModeW =
|
||||
@@ -273,7 +274,7 @@ VulkanTextRenderer::VulkanTextRenderer(WrappedVulkan *driver)
|
||||
VkImageCreateInfo imInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
driver->DefaultImageCreateFlags(),
|
||||
VK_IMAGE_TYPE_2D,
|
||||
VK_FORMAT_R8_UNORM,
|
||||
{width, height, 1},
|
||||
@@ -333,6 +334,14 @@ VulkanTextRenderer::VulkanTextRenderer(WrappedVulkan *driver)
|
||||
driver->GetGPULocalMemoryIndex(mrq.memoryTypeBits),
|
||||
};
|
||||
|
||||
VkMemoryAllocateFlagsInfo memFlags = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO};
|
||||
if(driver->DescriptorBuffers())
|
||||
{
|
||||
allocInfo.pNext = &memFlags;
|
||||
memFlags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT |
|
||||
VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
}
|
||||
|
||||
vkr = ObjDisp(dev)->AllocateMemory(Unwrap(dev), &allocInfo, NULL, &m_TextAtlasMem);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
@@ -342,7 +351,7 @@ VulkanTextRenderer::VulkanTextRenderer(WrappedVulkan *driver)
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
driver->DefaultImageViewCreateFlags(),
|
||||
m_TextAtlas,
|
||||
VK_IMAGE_VIEW_TYPE_2D,
|
||||
imInfo.format,
|
||||
|
||||
@@ -4069,7 +4069,7 @@ void VulkanReplay::GetTextureData(ResourceId tex, const Subresource &sub,
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
m_pDriver->DefaultImageViewCreateFlags(),
|
||||
tmpImage,
|
||||
VK_IMAGE_VIEW_TYPE_2D,
|
||||
imCreateInfo.format,
|
||||
|
||||
@@ -4284,6 +4284,15 @@ bool WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
|
||||
|
||||
m_PhysicalDeviceData.enabledFeatures = enabledFeatures;
|
||||
|
||||
const VkPhysicalDeviceDescriptorBufferFeaturesEXT *descBufFeats =
|
||||
(const VkPhysicalDeviceDescriptorBufferFeaturesEXT *)FindNextStruct(
|
||||
&createInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT);
|
||||
|
||||
if(m_EnabledExtensions.ext_EXT_descriptor_buffer && descBufFeats && descBufFeats->descriptorBuffer)
|
||||
{
|
||||
m_DescriptorBuffers = true;
|
||||
}
|
||||
|
||||
// MoltenVK reports 0x3fffffff for this limit so just ignore that value if it comes up
|
||||
RDCASSERT(m_PhysicalDeviceData.props.limits.maxBoundDescriptorSets <
|
||||
ARRAY_COUNT(BakedCmdBufferInfo::pushDescriptorID[0]) ||
|
||||
@@ -4864,6 +4873,12 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
|
||||
GetPhysicalDeviceDriverProperties(ObjDisp(physicalDevice), Unwrap(physicalDevice),
|
||||
m_PhysicalDeviceData.driverProps);
|
||||
|
||||
if(m_EnabledExtensions.ext_EXT_descriptor_buffer && descBufFeatures &&
|
||||
descBufFeatures->descriptorBuffer)
|
||||
{
|
||||
m_DescriptorBuffers = true;
|
||||
}
|
||||
|
||||
m_PhysicalDeviceData.driverInfo =
|
||||
VkDriverInfo(m_PhysicalDeviceData.props, m_PhysicalDeviceData.driverProps, true);
|
||||
|
||||
|
||||
@@ -121,6 +121,8 @@ void WrappedVulkan::PatchImageCreateInfo(VkImageCreateInfo *info, VkFormat *newV
|
||||
|
||||
info->flags &= ~VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT;
|
||||
|
||||
info->flags |= DefaultImageCreateFlags();
|
||||
|
||||
VkImageStencilUsageCreateInfo *separateStencilUsage =
|
||||
(VkImageStencilUsageCreateInfo *)FindNextStruct(
|
||||
info, VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO);
|
||||
|
||||
@@ -631,6 +631,8 @@ bool WrappedVulkan::Serialise_vkCreateSampler(SerialiserType &ser, VkDevice devi
|
||||
|
||||
VkSamplerCreateInfo patched = CreateInfo;
|
||||
|
||||
patched.flags |= DefaultSamplerCreateFlags();
|
||||
|
||||
byte *tempMem = GetTempMemory(GetNextPatchSize(patched.pNext));
|
||||
|
||||
UnwrapNextChain(m_State, "VkSamplerCreateInfo", tempMem, (VkBaseInStructure *)&patched);
|
||||
@@ -689,6 +691,8 @@ VkResult WrappedVulkan::vkCreateSampler(VkDevice device, const VkSamplerCreateIn
|
||||
info_adjusted.flags &= ~VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT;
|
||||
info_adjusted.flags &= ~VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT;
|
||||
|
||||
info_adjusted.flags |= DefaultSamplerCreateFlags();
|
||||
|
||||
byte *tempMem = GetTempMemory(GetNextPatchSize(info_adjusted.pNext));
|
||||
|
||||
UnwrapNextChain(m_State, "VkSamplerCreateInfo", tempMem, (VkBaseInStructure *)&info_adjusted);
|
||||
|
||||
@@ -443,7 +443,7 @@ bool WrappedVulkan::Serialise_vkAllocateMemory(SerialiserType &ser, VkDevice dev
|
||||
VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
DefaultBufferCreateFlags(),
|
||||
AllocateInfo.allocationSize,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
};
|
||||
@@ -510,11 +510,17 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
|
||||
VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
DefaultBufferCreateFlags(),
|
||||
info.allocationSize,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
};
|
||||
|
||||
if(DescriptorBuffers())
|
||||
{
|
||||
bufInfo.usage |= VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT;
|
||||
bufInfo.flags |= VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
}
|
||||
|
||||
// since this is very short lived, it's not wrapped
|
||||
VkBuffer buf;
|
||||
|
||||
@@ -651,7 +657,7 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
|
||||
VkBufferCreateInfo bufInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
IsCaptureMode(m_State) ? DefaultBufferCreateFlags() : 0,
|
||||
info.allocationSize,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
};
|
||||
@@ -1850,6 +1856,8 @@ bool WrappedVulkan::Serialise_vkCreateBuffer(SerialiserType &ser, VkDevice devic
|
||||
queueFamiles[q] = m_QueueRemapping[queueFamiles[q]][0].family;
|
||||
}
|
||||
|
||||
CreateInfo.flags |= DefaultBufferCreateFlags();
|
||||
|
||||
VkBufferCreateInfo patched = CreateInfo;
|
||||
|
||||
byte *tempMem = GetTempMemory(GetNextPatchSize(patched.pNext));
|
||||
@@ -1939,6 +1947,9 @@ VkResult WrappedVulkan::vkCreateBuffer(VkDevice device, const VkBufferCreateInfo
|
||||
adjusted_info.flags |= VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
}
|
||||
|
||||
if(IsCaptureMode(m_State))
|
||||
adjusted_info.flags |= DefaultBufferCreateFlags();
|
||||
|
||||
SetBufferUsageFlags(&adjusted_info, adjusted_usage);
|
||||
|
||||
byte *tempMem = GetTempMemory(GetNextPatchSize(adjusted_info.pNext));
|
||||
@@ -2342,6 +2353,8 @@ bool WrappedVulkan::Serialise_vkCreateImage(SerialiserType &ser, VkDevice device
|
||||
// create non-subsampled image to be able to copy its content
|
||||
CreateInfo.flags &= ~VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT;
|
||||
|
||||
CreateInfo.flags |= DefaultImageCreateFlags();
|
||||
|
||||
APIProps.YUVTextures |= IsYUVFormat(CreateInfo.format);
|
||||
|
||||
const bool isSparse = (CreateInfo.flags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
|
||||
@@ -2561,6 +2574,9 @@ VkResult WrappedVulkan::vkCreateImage(VkDevice device, const VkImageCreateInfo *
|
||||
// create non-subsampled image to be able to copy its content
|
||||
createInfo_adjusted.flags &= ~VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT;
|
||||
|
||||
if(IsCaptureMode(m_State))
|
||||
createInfo_adjusted.flags |= DefaultImageCreateFlags();
|
||||
|
||||
size_t tempMemSize = GetNextPatchSize(createInfo_adjusted.pNext);
|
||||
|
||||
// reserve space for a patched view format list if necessary
|
||||
@@ -2953,6 +2969,8 @@ bool WrappedVulkan::Serialise_vkCreateImageView(SerialiserType &ser, VkDevice de
|
||||
PatchImageViewUsage(usageInfo, CreateInfo.format, samples);
|
||||
}
|
||||
|
||||
unwrappedInfo->flags |= DefaultImageViewCreateFlags();
|
||||
|
||||
VkResult ret = ObjDisp(device)->CreateImageView(Unwrap(device), unwrappedInfo, NULL, &view);
|
||||
|
||||
APIProps.YUVTextures |= IsYUVFormat(CreateInfo.format);
|
||||
@@ -3015,6 +3033,8 @@ VkResult WrappedVulkan::vkCreateImageView(VkDevice device, const VkImageViewCrea
|
||||
PatchImageViewUsage(usageInfo, pCreateInfo->format, samples);
|
||||
}
|
||||
|
||||
unwrappedInfo->flags |= DefaultImageViewCreateFlags();
|
||||
|
||||
VkResult ret;
|
||||
SERIALISE_TIME_CALL(
|
||||
ret = ObjDisp(device)->CreateImageView(Unwrap(device), unwrappedInfo, NULL, pView));
|
||||
@@ -3510,6 +3530,10 @@ bool WrappedVulkan::Serialise_vkCreateAccelerationStructureKHR(
|
||||
VkAccelerationStructureCreateInfoKHR unwrappedInfo = CreateInfo;
|
||||
unwrappedInfo.buffer = Unwrap(unwrappedInfo.buffer);
|
||||
|
||||
if(m_DescriptorBuffers)
|
||||
unwrappedInfo.createFlags |=
|
||||
VK_ACCELERATION_STRUCTURE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT;
|
||||
|
||||
VkAccelerationStructureKHR acc = VK_NULL_HANDLE;
|
||||
VkResult ret =
|
||||
ObjDisp(device)->CreateAccelerationStructureKHR(Unwrap(device), &unwrappedInfo, NULL, &acc);
|
||||
@@ -3566,6 +3590,10 @@ VkResult WrappedVulkan::vkCreateAccelerationStructureKHR(
|
||||
unwrappedInfo.createFlags |=
|
||||
VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR;
|
||||
|
||||
if(m_DescriptorBuffers)
|
||||
unwrappedInfo.createFlags |=
|
||||
VK_ACCELERATION_STRUCTURE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT;
|
||||
|
||||
unwrappedInfo.buffer = Unwrap(unwrappedInfo.buffer);
|
||||
VkResult ret;
|
||||
SERIALISE_TIME_CALL(ret = ObjDisp(device)->CreateAccelerationStructureKHR(
|
||||
|
||||
@@ -369,7 +369,7 @@ bool WrappedVulkan::Serialise_vkCreateSwapchainKHR(SerialiserType &ser, VkDevice
|
||||
|
||||
swapinfo.images.resize(NumImages);
|
||||
|
||||
VkImageCreateFlags imageFlags = 0;
|
||||
VkImageCreateFlags imageFlags = DefaultImageCreateFlags();
|
||||
|
||||
if(CreateInfo.flags & VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR)
|
||||
imageFlags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
|
||||
@@ -429,6 +429,14 @@ bool WrappedVulkan::Serialise_vkCreateSwapchainKHR(SerialiserType &ser, VkDevice
|
||||
GetGPULocalMemoryIndex(mrq.memoryTypeBits),
|
||||
};
|
||||
|
||||
VkMemoryAllocateFlagsInfo memFlags = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO};
|
||||
if(DescriptorBuffers())
|
||||
{
|
||||
allocInfo.pNext = &memFlags;
|
||||
memFlags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT |
|
||||
VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
|
||||
}
|
||||
|
||||
vkr = ObjDisp(device)->AllocateMemory(Unwrap(device), &allocInfo, NULL, &mem);
|
||||
CHECK_VKR(this, vkr);
|
||||
|
||||
@@ -645,7 +653,7 @@ void WrappedVulkan::WrapAndProcessCreatedSwapchain(VkDevice device,
|
||||
VkImageViewCreateInfo info = {
|
||||
VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
DefaultImageViewCreateFlags(),
|
||||
Unwrap(images[i]),
|
||||
VK_IMAGE_VIEW_TYPE_2D,
|
||||
pCreateInfo->imageFormat,
|
||||
|
||||
Reference in new issue
Block a user