diff --git a/renderdoc/core/resource_manager.cpp b/renderdoc/core/resource_manager.cpp index ef1482f62..77674c387 100644 --- a/renderdoc/core/resource_manager.cpp +++ b/renderdoc/core/resource_manager.cpp @@ -125,6 +125,14 @@ FrameRefType ComposeFrameRefsDisjoint(FrameRefType x, FrameRefType y) return RDCMAX(x, y); } +FrameRefType ComposeFrameRefsFirstKnown(FrameRefType first, FrameRefType second) +{ + if(eFrameRef_Minimum <= first && first <= eFrameRef_Maximum) + return first; + else + return second; +} + bool IncludesRead(FrameRefType refType) { switch(refType) diff --git a/renderdoc/core/resource_manager.h b/renderdoc/core/resource_manager.h index 663600746..370d23255 100644 --- a/renderdoc/core/resource_manager.h +++ b/renderdoc/core/resource_manager.h @@ -103,6 +103,11 @@ enum FrameRefType // read could, incorrectly, be observed. This is because read-only resources // are not reset, so the write from the previous replay may still be present. eFrameRef_WriteBeforeRead = 5, + + // No reference info is available; + // This should only appear durring replay, and any (sub)resource with `Unknown` + // reference type should be conservatively reset before each replay. + eFrameRef_Unknown = 1000000000, }; bool IncludesRead(FrameRefType refType); @@ -135,6 +140,9 @@ FrameRefType ComposeFrameRefsUnordered(FrameRefType first, FrameRefType second); // frame refs of their subresources. FrameRefType ComposeFrameRefsDisjoint(FrameRefType x, FrameRefType y); +// Returns whichever of `first` or `second` is valid. +FrameRefType ComposeFrameRefsFirstKnown(FrameRefType first, FrameRefType second); + bool IsDirtyFrameRef(FrameRefType refType); // Captures the possible initialization/reset requirements for resources. @@ -200,6 +208,8 @@ enum InitPolicy // Return the initialization/reset requirements for a FrameRefType inline InitReqType InitReq(FrameRefType refType, InitPolicy policy, bool initialized) { + if(eFrameRef_Minimum > refType || refType > eFrameRef_Maximum) + return eInitReq_Copy; #define COPY_ONCE (initialized ? eInitReq_None : eInitReq_Copy) #define CLEAR_ONCE (initialized ? eInitReq_None : eInitReq_Clear) switch(policy)