mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Always check mapped memory for changes if it has BDA buffers
* Normally we only check mapped memory when it's referenced during capture by some binding, but for BDA we don't have bindings so we have to conservatively check it every time.
This commit is contained in:
@@ -2195,6 +2195,7 @@ public:
|
||||
VkResourceType resType;
|
||||
bool storable = false;
|
||||
bool dedicated = false;
|
||||
bool hasBDA = false;
|
||||
|
||||
void MarkMemoryFrameReferenced(ResourceId mem, VkDeviceSize offset, VkDeviceSize size,
|
||||
FrameRefType refType);
|
||||
|
||||
@@ -1013,8 +1013,9 @@ void WrappedVulkan::CaptureQueueSubmit(VkQueue queue,
|
||||
// potential persistent map
|
||||
if(state.mapCoherent && state.mappedPtr && !state.mapFlushed)
|
||||
{
|
||||
// only need to flush memory that could affect this submitted batch of work
|
||||
if(refdIDs.find(record->GetResourceID()) == refdIDs.end())
|
||||
// only need to flush memory that could affect this submitted batch of work, or if there are
|
||||
// BDA buffers bound (as we can't track those!)
|
||||
if(!record->hasBDA && refdIDs.find(record->GetResourceID()) == refdIDs.end())
|
||||
{
|
||||
RDCDEBUG("Map of memory %s not referenced in this queue - not flushing",
|
||||
ToStr(record->GetResourceID()).c_str());
|
||||
|
||||
@@ -1387,6 +1387,8 @@ VkResult WrappedVulkan::vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkD
|
||||
eFrameRef_ReadBeforeWrite);
|
||||
GetResourceManager()->MarkMemoryFrameReferenced(id, memoryOffset, record->memSize,
|
||||
eFrameRef_ReadBeforeWrite);
|
||||
|
||||
memrecord->hasBDA = true;
|
||||
}
|
||||
|
||||
// the memory is immediately dirty because we don't use dirty tracking, it's too expensive to
|
||||
|
||||
@@ -296,15 +296,18 @@ void main()
|
||||
// look ma, no binds
|
||||
DrawData *bindptr = drawsgpu;
|
||||
drawscpu[0].scale.x = (abs(sinf(time)) + 0.1f) * 0.5f;
|
||||
drawscpu[0].scale.y = 0.5f;
|
||||
vkCmdPushConstants(cmd, layout, VK_SHADER_STAGE_ALL, 0, 8, &bindptr);
|
||||
vkCmdDraw(cmd, 3, 1, 0, 0);
|
||||
|
||||
bindptr++;
|
||||
drawscpu[1].scale.x = 0.5f;
|
||||
drawscpu[1].scale.y = (abs(cosf(time)) + 0.1f) * 0.5f;
|
||||
vkCmdPushConstants(cmd, layout, VK_SHADER_STAGE_ALL, 0, 8, &bindptr);
|
||||
vkCmdDraw(cmd, 3, 1, 0, 0);
|
||||
|
||||
bindptr++;
|
||||
drawscpu[2].scale = Vec2f(0.5f, 0.5f);
|
||||
drawscpu[2].tint = Vec4f(cosf(time) * 0.5f + 0.5f, sinf(time) * 0.5f + 0.5f,
|
||||
cosf(time + 3.14f) * 0.5f + 0.5f, 1.0f);
|
||||
vkCmdPushConstants(cmd, layout, VK_SHADER_STAGE_ALL, 0, 8, &bindptr);
|
||||
@@ -318,6 +321,12 @@ void main()
|
||||
|
||||
Submit(0, 1, {cmd});
|
||||
|
||||
vkDeviceWaitIdle(device);
|
||||
|
||||
drawscpu[0].scale = Vec2f(0.0f, 0.0f);
|
||||
drawscpu[1].scale = Vec2f(0.0f, 0.0f);
|
||||
drawscpu[2].scale = Vec2f(0.0f, 0.0f);
|
||||
|
||||
Present();
|
||||
|
||||
time += 0.1f;
|
||||
|
||||
Reference in New Issue
Block a user