![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <MultiBufferResource.h>
Inheritance diagram for Chaos::FGuardedTripleBuffer< ResourceType >:Public Member Functions | |
| FGuardedTripleBuffer () | |
| virtual EMultiBufferMode | GetBufferMode () override |
| virtual ResourceType * | AccessProducerBuffer () override |
| virtual ResourceType * | GetConsumerBufferMutable () override |
| virtual const ResourceType * | GetProducerBuffer () const override |
| virtual const ResourceType * | GetConsumerBuffer () const override |
| const ResourceType * | PeekConsumerBuffer () const |
| virtual void | FlipProducer () |
Public Member Functions inherited from Chaos::IBufferResource< ResourceType > | |
| virtual | ~IBufferResource () |
Triple buffer based on a single atomic variable, that guards against the consumer thread using old values.
Not thread-safe, requires external locks.
|
inline |
This class implements a circular buffer access pattern, such that during normal serial operation each buffer will be used. However, we can alter how we use the API to use only 2 or 1 buffer:
SERIAL ACCESS BUFFER USE - NORMAL OPERATION: P C I Init: 0, 1, 2
AccP: *0, 1, 2 - *write access Flip: 2, 1, 0 Cons: 2, ^0, 1 - ^read access
AccP: *2, 0, 1 Flip: 1, 0, 2 Cons: 1, ^2, 0
AccP: *1, 2, 0 Flip: 0, 2, 1 Cons: 0, ^1, 2
SERIAL ACCESS BUFFER USE - DOUBLE BUFFER EMULATION: Init: 0, 1, 2
AccP: *0, 1, 2 - *write access Flip: 2, 1, 0 Cons: 2, ^0, 1 - ^read access Flip: 1, 0, 2 <- Add an extra flip and only use 2 buffers.
AccP: *1, 0, 2 Flip: 2, 0, 1 Cons: 2, ^1, 0 Flip: 0, 1, 2
SERIAL ACCESS BUFFER USE - SINGLE BUFFER EMULATION: Init: 0, 1, 2
AccP: *0, 1, 2 - *write access Flip: 2, 1, 0 Cons: 2, ^0, 1 - ^read access Cons: 2, 1, 0 <- Add an extra consume... Flip: 0, 1, 2 <- and an extra flip and only use 1 buffer.
|
inlineoverridevirtual |
Get the current producer buffer for writing.
The returned pointer will never be null.
This function should only be called by the producer thread.
Implements Chaos::IBufferResource< ResourceType >.
|
inlinevirtual |
Make the current producer buffer available to the consumer thread.
This function should only be called by the producer thread.
Implements Chaos::IBufferResource< ResourceType >.
|
inlineoverridevirtual |
Implements Chaos::IBufferResource< ResourceType >.
|
inlineoverridevirtual |
Get an updated buffer for the consuming thread to read from.
The returned pointer may be null if the producer thread hasn't done an update since the last time this function was called.
This function should only be called by the consumer thread.
Implements Chaos::IBufferResource< ResourceType >.
|
inlineoverridevirtual |
Implements Chaos::IBufferResource< ResourceType >.
|
inlineoverridevirtual |
Get the current producer buffer.
The returned pointer will never be null.
This function should only be called by the producer thread.
Implements Chaos::IBufferResource< ResourceType >.
|
inline |
Get access to the currently held consumer buffer, ignoring whether it's already been consumed.