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.
This commit is contained in:
Benson Joeris
2019-02-08 18:07:51 -05:00
committed by Baldur Karlsson
parent da2375586c
commit b78f2056c4
+13 -3
View File
@@ -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;
}
}