From 9077203f715f90f434986e6ef572b7398e6cceb0 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 11 Jan 2017 14:46:44 +0000 Subject: [PATCH] Always allocate at least 2048 slots for pixel history * This means that any 'degenerate' cases of only one event or so on will still have enough slots to be able to handle reasonable amount of overdraw. The only case that will fail is if every event has loads of hits, but on average there should be enough slots allocated. --- renderdoc/driver/d3d11/d3d11_analyse.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_analyse.cpp b/renderdoc/driver/d3d11/d3d11_analyse.cpp index 1fdf6ddc5..adc26f411 100644 --- a/renderdoc/driver/d3d11/d3d11_analyse.cpp +++ b/renderdoc/driver/d3d11/d3d11_analyse.cpp @@ -4759,9 +4759,14 @@ vector D3D11DebugManager::PixelHistory(vector eve details.texFmt == DXGI_FORMAT_D32_FLOAT_S8X24_UINT) details.texFmt = DXGI_FORMAT_R32G32B32A32_UINT; - // define a texture that we can copy before/after results into + // define a texture that we can copy before/after results into. + // We always allocate at least 2048 slots, to allow for pixel history that only touches a couple + // of events still being able to overdraw many times. The idea being that if we're taking the + // history over many events, then the events which don't take up any slots or only one will mostly + // dominate over those that take more than the average. If we only have one or two candidate + // events then at least 2048 slots gives a huge amount of potential overdraw. D3D11_TEXTURE2D_DESC pixstoreDesc = { - RDCMIN(2048U, AlignUp16(pixstoreSlots)), + 2048U, RDCMAX(1U, (pixstoreSlots / 2048) + 1), 1U, 1U,