mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Add InitReqType to classify FrameRefType by init/reset requirements.
The accumulated `FrameRefType` of the accesses to a resource within a frame determines how the resource needs to be initialized. The possibilities are: * `None`: The initial value of the resource is never used within the frame, either because it is never read, or because it is only read after being cleared * `InitOnce`: The resource needs to be initialized before replaying the frame for the first time, but does not ever need to be reset; this occurs when a resource is read within the frame, but not written within the frame. * `Reset`: The resource needs to be reset each time before replaying the frame. This occurs when the resource is read and later written within the frame.
This commit is contained in:
committed by
Baldur Karlsson
parent
264fd6ac39
commit
6fa39fbbcb
@@ -114,6 +114,39 @@ FrameRefType ComposeFrameRefsUnordered(FrameRefType first, FrameRefType second);
|
||||
|
||||
bool IsDirtyFrameRef(FrameRefType refType);
|
||||
|
||||
// Captures the possible initialization/reset requirements for resources.
|
||||
// These requirements are entirely determined by the resource's FrameRefType,
|
||||
// but this type improves the readability of the code that checks
|
||||
// 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.
|
||||
eInitReq_None,
|
||||
|
||||
// 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.
|
||||
// Corresponds to `Read` ref type.
|
||||
eInitReq_InitOnce,
|
||||
|
||||
// Initial contents of the resource are read, and later overwritten;
|
||||
// the resource needs to be reset before each replay.
|
||||
// Corresponds to `ReadBeforeWrite` ref type.
|
||||
eInitReq_Reset,
|
||||
};
|
||||
|
||||
// Return the initialization/reset requirements for a FrameRefType
|
||||
inline InitReqType InitReq(FrameRefType refType)
|
||||
{
|
||||
switch(refType)
|
||||
{
|
||||
case eFrameRef_Read: return eInitReq_InitOnce;
|
||||
case eFrameRef_ReadBeforeWrite: return eInitReq_Reset;
|
||||
default: return eInitReq_None;
|
||||
}
|
||||
}
|
||||
|
||||
// handle marking a resource referenced for read or write and storing RAW access etc.
|
||||
bool MarkReferenced(std::map<ResourceId, FrameRefType> &refs, ResourceId id, FrameRefType refType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user