mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 08:40:55 +00:00
version-detect AMD unreliable image memory requirements needing padding
* From driver 2.0.33 (18.5.2) onwards, the image memory requirements don't vary randomly so don't need any padding. * It should only be applied also for the AMD binary driver.
This commit is contained in:
@@ -738,6 +738,10 @@ VkDriverInfo::VkDriverInfo(const VkPhysicalDeviceProperties &physProps)
|
||||
|
||||
if(Major() < 1)
|
||||
texelFetchBrokenDriver = true;
|
||||
|
||||
// driver 18.5.2 which is vulkan version >= 2.0.33 contains the fix
|
||||
if(physProps.driverVersion < VK_MAKE_VERSION(2, 0, 33))
|
||||
unreliableImgMemReqs = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -192,6 +192,11 @@ public:
|
||||
// A workaround for a couple of bugs, removing texelFetch use from shaders.
|
||||
// It means broken functionality but at least no instant crashes
|
||||
bool TexelFetchBrokenDriver() { return texelFetchBrokenDriver; }
|
||||
// Older AMD driver versions could sometimes cause image memory requirements to vary randomly
|
||||
// between identical images. This means the memory required at capture could be less than at
|
||||
// replay. To counteract this, on drivers with this issue we pad out the memory requirements
|
||||
// enough to account for the change
|
||||
bool UnreliableImageMemoryRequirements() { return unreliableImgMemReqs; }
|
||||
// another workaround, on some AMD driver versions creating an MSAA image with STORAGE_BIT
|
||||
// causes graphical corruption trying to sample from it. We workaround it by preventing the
|
||||
// MSAA <-> Array pipelines from creating, which removes the STORAGE_BIT and skips the copies.
|
||||
@@ -207,6 +212,7 @@ private:
|
||||
uint32_t m_Major, m_Minor, m_Patch;
|
||||
|
||||
bool texelFetchBrokenDriver = false;
|
||||
bool unreliableImgMemReqs = false;
|
||||
bool amdStorageMSAABrokenDriver = false;
|
||||
bool qualcommLeakingUBOOffsets = false;
|
||||
};
|
||||
|
||||
@@ -284,7 +284,7 @@ void WrappedVulkan::vkGetImageMemoryRequirements(VkDevice device, VkImage image,
|
||||
// allow for this. The variability isn't quite clear, but for now we assume aligning size to
|
||||
// alignment * 4 should be sufficient (adding on a fixed padding won't help the problem as it
|
||||
// won't remove the variability, nor will adding then aligning for the same reason).
|
||||
if(GetDriverVersion().Vendor() == GPUVendor::AMD && pMemoryRequirements->size > 0)
|
||||
if(GetDriverInfo().UnreliableImageMemoryRequirements() && pMemoryRequirements->size > 0)
|
||||
{
|
||||
VkMemoryRequirements &memreq = *pMemoryRequirements;
|
||||
|
||||
@@ -376,7 +376,8 @@ void WrappedVulkan::vkGetImageMemoryRequirements2(VkDevice device,
|
||||
// allow for this. The variability isn't quite clear, but for now we assume aligning size to
|
||||
// alignment * 4 should be sufficient (adding on a fixed padding won't help the problem as it
|
||||
// won't remove the variability, nor will adding then aligning for the same reason).
|
||||
if(GetDriverVersion().Vendor() == GPUVendor::AMD && pMemoryRequirements->memoryRequirements.size > 0)
|
||||
if(GetDriverInfo().UnreliableImageMemoryRequirements() &&
|
||||
pMemoryRequirements->memoryRequirements.size > 0)
|
||||
{
|
||||
VkMemoryRequirements &memreq = pMemoryRequirements->memoryRequirements;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user