29#include "NvFlowContext.h"
34 NvFlowBufferTransient* transientBuffer =
nullptr;
35 NvFlowUint64 transientFrame = ~0llu;
36 NvFlowBuffer* buffer =
nullptr;
42 ptr->contextInterface = contextInterface;
48 NvFlowUint acquireWriteIdx = 0u;
49 for (NvFlowUint acquireReadIdx = 0u; acquireReadIdx < ptr->acquires.size; acquireReadIdx++)
51 NvFlowBuffer* acquiredBuffer =
nullptr;
52 if (ptr->contextInterface->getAcquiredBuffer(
context, ptr->acquires[acquireReadIdx], &acquiredBuffer))
56 ptr->contextInterface->destroyBuffer(
context, ptr->buffer);
57 ptr->buffer =
nullptr;
59 ptr->buffer = acquiredBuffer;
63 ptr->acquires[acquireWriteIdx++] = ptr->acquires[acquireReadIdx];
66 ptr->acquires.size = acquireWriteIdx;
71 if (ptr->transientFrame == ptr->contextInterface->getCurrentFrame(
context))
73 return ptr->transientBuffer;
76 NvFlowBufferVariable_flush(
context, ptr);
80 ptr->transientBuffer = ptr->contextInterface->registerBufferAsTransient(
context, ptr->buffer);
81 ptr->transientFrame = ptr->contextInterface->getCurrentFrame(
context);
85 ptr->transientBuffer =
nullptr;
86 ptr->transientFrame = ~0llu;
88 return ptr->transientBuffer;
91NV_FLOW_INLINE
void NvFlowBufferVariable_set(NvFlowContext*
context,
NvFlowBufferVariable* ptr, NvFlowBufferTransient* transientBuffer)
93 NvFlowBufferVariable_flush(
context, ptr);
96 ptr->contextInterface->destroyBuffer(
context, ptr->buffer);
97 ptr->buffer =
nullptr;
99 ptr->transientBuffer =
nullptr;
100 ptr->transientFrame = ~0llu;
103 ptr->transientBuffer = transientBuffer;
104 ptr->transientFrame = ptr->contextInterface->getCurrentFrame(
context);
106 ptr->acquires.pushBack(ptr->contextInterface->enqueueAcquireBuffer(
context, transientBuffer));
112 NvFlowBufferVariable_set(
context, ptr,
nullptr);
Definition NvFlowArray.h:36
Definition NvFlowBufferVariable.h:32
Definition NvFlowContext.h:362