Add Unknown FrameRefType

This represents a (sub)resource for which no usage info is available.
It should be conservatively assumed that such a resource needs to be
re-initialized before each replay (and this behaviour is reflected in
`InitReq()`).

Change-Id: I12235a6cb1c4b2e3e21bed8834653ec6a3aea009
This commit is contained in:
Benson Joeris
2020-01-07 14:23:04 -05:00
committed by Baldur Karlsson
parent ecd108c6c3
commit 35a15cf8d1
2 changed files with 18 additions and 0 deletions
+8
View File
@@ -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)
+10
View File
@@ -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)