mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Fix non-coherent atom alignment issues
This commit is contained in:
@@ -1306,9 +1306,11 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V
|
||||
{
|
||||
if(initial && initial->mem.mem != VK_NULL_HANDLE)
|
||||
{
|
||||
VkDeviceSize size = AlignUp(initial->mem.size, nonCoherentAtomSize);
|
||||
|
||||
mappedMem = initial->mem;
|
||||
vkr = ObjDisp(d)->MapMemory(Unwrap(d), Unwrap(mappedMem.mem), initial->mem.offs,
|
||||
initial->mem.size, 0, (void **)&Contents);
|
||||
vkr = ObjDisp(d)->MapMemory(Unwrap(d), Unwrap(mappedMem.mem), initial->mem.offs, size, 0,
|
||||
(void **)&Contents);
|
||||
CheckVkResult(vkr);
|
||||
|
||||
// invalidate the cpu cache for this memory range to avoid reading stale data
|
||||
@@ -1317,7 +1319,7 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V
|
||||
NULL,
|
||||
Unwrap(mappedMem.mem),
|
||||
mappedMem.offs,
|
||||
mappedMem.size,
|
||||
size,
|
||||
};
|
||||
|
||||
vkr = ObjDisp(d)->InvalidateMappedMemoryRanges(Unwrap(d), 1, &range);
|
||||
|
||||
@@ -207,6 +207,10 @@ MemoryAllocation WrappedVulkan::AllocateMemoryForResource(bool buffer, VkMemoryR
|
||||
// offs is where we can put our next sub-allocation
|
||||
VkDeviceSize offs = block.offs;
|
||||
|
||||
// for ease, ensure all allocations are allocated to the non-coherent atom size, so we can
|
||||
// invalidate/flush safely. This is at most 256 bytes which is likely already satisfied.
|
||||
offs = AlignUp(offs, nonCoherentAtomSize);
|
||||
|
||||
// if we are on a buffer/image, account for any alignment we might have to do
|
||||
if(ret.buffer != block.buffer)
|
||||
offs = AlignUp(offs, m_PhysicalDeviceData.props.limits.bufferImageGranularity);
|
||||
|
||||
Reference in New Issue
Block a user