From b78f2056c4a85e894151d575c3e8349d8d42cce2 Mon Sep 17 00:00:00 2001 From: Benson Joeris Date: Fri, 8 Feb 2019 18:07:51 -0500 Subject: [PATCH] Added `Clear` value to `InitReqType` This value is similar to `None`, in that the resource need not be initialized for correct replay; however, a resource with `Clear` type might be modified in the frame, where a resource with `None` type may not be modified in the frame. This distinction may be helpful in initializing the irrelevant initial contents to some known value (e.g. 0), so that users inspecting these resources don't see unexpected values (such as a value written later in the frame). `None` resources need only set this dummy initial contents once, where `Clear` resources need to reset this dummy initial contents every frame. --- renderdoc/core/resource_manager.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/renderdoc/core/resource_manager.h b/renderdoc/core/resource_manager.h index b1114dd2d..ecdc48eba 100644 --- a/renderdoc/core/resource_manager.h +++ b/renderdoc/core/resource_manager.h @@ -120,10 +120,19 @@ bool IsDirtyFrameRef(FrameRefType refType); // init/reset requirements. enum InitReqType { - // Initial contents of the resource are not used, and need not be initialized. - // Corresponds to `None`, `Write` or `Clear` ref types. + // Initial contents of the resource are not used, and also not modified. + // No initialization/reset is required for correct replay, but may be helpful + // to avoid user confusion when analyzing the resource. + // Corresponds to `None` ref type. eInitReq_None, + // Initial contents of the resource are not used, but the contents are + // potentially modified during the frame. + // No initialization/reset is required for correct replay, but may be helpful + // to avoid user confusion when analyzing the resource. + // Corresponds to `PartialWrite` and `CompleteWrite` ref types. + eInitReq_Clear, + // Initial contents of the resource are read, but not overwritten; // the resource needs to be initialized before the first replay, but need not // be reset before subsequent replays. @@ -141,9 +150,10 @@ inline InitReqType InitReq(FrameRefType refType) { switch(refType) { + case eFrameRef_None: return eInitReq_None; case eFrameRef_Read: return eInitReq_InitOnce; case eFrameRef_ReadBeforeWrite: return eInitReq_Reset; - default: return eInitReq_None; + default: return eInitReq_Clear; } }