88 if (this->buffer ==
nullptr)
90 this->capacity =
Math::max(numBytes, this->capacity);
91 this->buffer =
new byte[this->
capacity];
93 else if (this->size + numBytes > this->capacity)
97 this->capacity += grow;
98 byte* newBuf =
new byte[this->
capacity];
101 memcpy(newBuf, this->buffer, this->size);
103 this->buffer = newBuf;
107 memcpy(this->buffer + this->size, buf, numBytes);
108 this->size += numBytes;
121 this->buffer =
nullptr;
137 template<
typename T>
void Push(
const T& command);
168 entry.
size =
sizeof(T);
169 entry.
type = T::Type;
A CoreGraphics thread meant to only record draw commands to command buffers.
Definition drawthread.h:18
void Push(const T &command)
push command to thread
Definition drawthread.h:161
Threading::Event signalEvent
Definition drawthread.h:145
void EmitWakeupSignal() override
called if thread needs a wakeup call before stopping
Definition drawthread.cc:22
DrawThread()
constructor
Definition drawthread.cc:13
CommandType
Definition drawthread.h:25
@ StencilWriteMask
Definition drawthread.h:45
@ ViewportArray
Definition drawthread.h:40
@ ScissorRect
Definition drawthread.h:41
@ Draw
Definition drawthread.h:33
@ GraphicsPipeline
Definition drawthread.h:29
@ Viewport
Definition drawthread.h:39
@ Dispatch
Definition drawthread.h:36
@ BindDescriptors
Definition drawthread.h:37
@ EndCommand
Definition drawthread.h:28
@ WaitForEvent
Definition drawthread.h:49
@ InputAssemblyIndex
Definition drawthread.h:32
@ SetEvent
Definition drawthread.h:47
@ Barrier
Definition drawthread.h:50
@ InsertMarker
Definition drawthread.h:57
@ ComputePipeline
Definition drawthread.h:30
@ StencilRefs
Definition drawthread.h:43
@ BeginMarker
Definition drawthread.h:55
@ PushRange
Definition drawthread.h:38
@ ResetCommand
Definition drawthread.h:27
@ ScissorRectArray
Definition drawthread.h:42
@ IndirectIndexedDraw
Definition drawthread.h:35
@ BeginQuery
Definition drawthread.h:53
@ StencilReadMask
Definition drawthread.h:44
@ BeginCommand
Definition drawthread.h:26
@ Sync
Definition drawthread.h:51
@ UpdateBuffer
Definition drawthread.h:46
@ EndMarker
Definition drawthread.h:56
@ ResetEvent
Definition drawthread.h:48
@ EndQuery
Definition drawthread.h:54
@ InputAssemblyVertex
Definition drawthread.h:31
@ Timestamp
Definition drawthread.h:52
@ IndirectDraw
Definition drawthread.h:34
void Signal(Threading::Event *event)
submit sync call
Definition drawthread.cc:40
Threading::CriticalSection lock
Definition drawthread.h:144
CommandBuffer commandBuffer
Definition drawthread.h:148
void Flush()
flush commands
Definition drawthread.cc:31
Util::Array< Command > commands
Definition drawthread.h:147
Threading::Event * event
Definition drawthread.h:149
Critical section objects are used to protect a portion of code from parallel execution.
Nebula's dynamic array class.
Definition array.h:60
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
DrawThread * CreateDrawThread()
create new draw thread, define in implementation thread
Definition vkcommandbufferthread.cc:14
__forceinline TYPE max(TYPE a, TYPE b)
Definition scalar.h:359
Definition drawthread.h:73
byte * buffer
Definition drawthread.h:74
void Reset()
reset buffer
Definition drawthread.h:127
void Append(const byte *buf, SizeT numBytes)
append to buffer
Definition drawthread.h:85
void Clear()
clear buffer
Definition drawthread.h:118
CommandBuffer()
Definition drawthread.h:78
SizeT size
Definition drawthread.h:75
const SizeT Size() const
get size
Definition drawthread.h:112
SizeT capacity
Definition drawthread.h:76
Definition drawthread.h:61
CommandType type
Definition drawthread.h:63
IndexT size
Definition drawthread.h:62
Definition drawthread.h:67
static const CommandType Type
Definition drawthread.h:68
Threading::Event * event
Definition drawthread.h:69
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48