doubly-linked-stack helper macros
This commit is contained in:
parent
18c54c4507
commit
13b942efb2
122
src/base/base.h
122
src/base/base.h
@ -292,61 +292,117 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t);
|
|||||||
#define CheckNil(nil,p) ((p) == 0 || (p) == nil)
|
#define CheckNil(nil,p) ((p) == 0 || (p) == nil)
|
||||||
#define SetNil(nil,p) ((p) = nil)
|
#define SetNil(nil,p) ((p) = nil)
|
||||||
|
|
||||||
//- Singly linked list stack (first & next pointers)
|
//- Singly linked stack (first & next pointers)
|
||||||
|
|
||||||
#define StackPushN(f,n,next) ((n)->next=(f), (f)=(n))
|
#define SllStackPushN(f,n,next) ((n)->next=(f), (f)=(n))
|
||||||
#define StackPopN(f,next) ((f)=(f)->next)
|
#define SllStackPopN(f,next) ((f)=(f)->next)
|
||||||
#define StackPush(f,n) StackPushN(f,n,next)
|
#define SllStackPush(f,n) SllStackPushN(f,n,next)
|
||||||
#define StackPop(f) StackPopN(f,next)
|
#define SllStackPop(f) SllStackPopN(f,next)
|
||||||
|
|
||||||
//- Singly linked list queue (first, last, & next pointers)
|
//- Singly linked queue (first, last, & next pointers)
|
||||||
|
|
||||||
#define QueuePushNZ(nil,f,l,n,next) (CheckNil(nil,f) ? \
|
#define SllQueuePushNZ(nil,f,l,n,next) \
|
||||||
|
( \
|
||||||
|
CheckNil(nil,f) ? \
|
||||||
((f)=(l)=(n),SetNil(nil,(n)->next)) : \
|
((f)=(l)=(n),SetNil(nil,(n)->next)) : \
|
||||||
((l)->next=(n),(l)=(n),SetNil(nil,(n)->next)))
|
((l)->next=(n),(l)=(n),SetNil(nil,(n)->next)) \
|
||||||
|
)
|
||||||
|
|
||||||
#define QueuePushFrontNZ(nil,f,l,n,next) (CheckNil(nil,f) ? \
|
#define SllQueuePushFrontNZ(nil,f,l,n,next) \
|
||||||
|
( \
|
||||||
|
CheckNil(nil,f) ? \
|
||||||
((f)=(l)=(n),SetNil(nil,(n)->next)) : \
|
((f)=(l)=(n),SetNil(nil,(n)->next)) : \
|
||||||
((n)->next=(f),(f)=(n)))
|
((n)->next=(f),(f)=(n)) \
|
||||||
|
)
|
||||||
|
|
||||||
#define QueuePopNZ(nil,f,l,next) ((f)==(l) ? \
|
#define SllQueuePopNZ(nil,f,l,next) \
|
||||||
|
( \
|
||||||
|
(f)==(l) ? \
|
||||||
(SetNil(nil,f),SetNil(nil,l)) : \
|
(SetNil(nil,f),SetNil(nil,l)) : \
|
||||||
((f)=(f)->next))
|
((f)=(f)->next) \
|
||||||
|
)
|
||||||
|
|
||||||
#define QueuePushN(f,l,n,next) QueuePushNZ(0,f,l,n,next)
|
#define SllQueuePushN(f,l,n,next) SllQueuePushNZ(0,f,l,n,next)
|
||||||
#define QueuePushFrontN(f,l,n,next) QueuePushFrontNZ(0,f,l,n,next)
|
#define SllQueuePush(f,l,n) SllQueuePushNZ(0,f,l,n,next)
|
||||||
#define QueuePopN(f,l,next) QueuePopNZ(0,f,l,next)
|
#define SllQueuePushFrontN(f,l,n,next) SllQueuePushFrontNZ(0,f,l,n,next)
|
||||||
#define QueuePush(f,l,n) QueuePushNZ(0,f,l,n,next)
|
#define SllQueuePushFront(f,l,n) SllQueuePushFrontNZ(0,f,l,n,next)
|
||||||
#define QueuePushFront(f,l,n) QueuePushFrontNZ(0,f,l,n,next)
|
#define SllQueuePopN(f,l,next) SllQueuePopNZ(0,f,l,next)
|
||||||
#define QueuePop(f,l) QueuePopNZ(0,f,l,next)
|
#define SllQueuePop(f,l) SllQueuePopNZ(0,f,l,next)
|
||||||
|
|
||||||
//- Doubly linked list (first, last, next, & prev pointers)
|
//- Doubly linked stack (first, next, & prev pointers)
|
||||||
|
|
||||||
#define DllInsertNPZ(nil,f,l,p,n,next,prev) (CheckNil(nil,f) ? \
|
#define DllStackPushNPZ(nil,f,n,next,prev) \
|
||||||
|
( \
|
||||||
|
SetNil(nil,(n)->prev), \
|
||||||
|
((n)->next = (f)), \
|
||||||
|
CheckNil(nil,f) ? (0) : ((f)->prev = (n)), \
|
||||||
|
((f) = (n)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define DllStackInsertNPZ(nil,f,p,n,next,prev) \
|
||||||
|
( \
|
||||||
|
(CheckNil(nil,f) || CheckNil(nil,p)) ? (DllStackPushNPZ(nil,(f),(n),next,prev)) : \
|
||||||
|
( \
|
||||||
|
((n)->prev = (p)), \
|
||||||
|
((n)->next = (p)->next), \
|
||||||
|
((p)->next = (n)), \
|
||||||
|
CheckNil(nil,(p)->next) ? (0) : ((p)->next->prev = (n)) \
|
||||||
|
) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define DllStackRemoveNPZ(nil,f,n,next,prev) \
|
||||||
|
( \
|
||||||
|
((n) == (f) ? ((f) = (n)->next) : (0)), \
|
||||||
|
(CheckNil(nil,(n)->next) ? (0) : ((n)->next->prev = (n)->prev)), \
|
||||||
|
(CheckNil(nil,(n)->prev) ? (0) : ((n)->prev->next = (n)->next)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define DllStackPushNP(f,n,next,prev) DllStackPushNPZ(0,f,n,next,prev)
|
||||||
|
#define DllStackPush(f,n) DllStackPushNPZ(0,f,n,next,prev)
|
||||||
|
#define DllStackInsertNP(f,p,n,next,prev) DllStackInsertNPZ(0,f,p,n,next,prev)
|
||||||
|
#define DllStackInsert(f,p,n) DllStackInsertNPZ(0,f,p,n,next,prev)
|
||||||
|
#define DllStackRemoveNP(f,n,next,prev) DllStackRemoveNPZ(0,f,n,next,prev)
|
||||||
|
#define DllStackRemove(f,n) DllStackRemoveNPZ(0,f,n,next,prev)
|
||||||
|
|
||||||
|
//- Doubly linked queue (first, last, next, & prev pointers)
|
||||||
|
|
||||||
|
#define DllQueueInsertNPZ(nil,f,l,p,n,next,prev) \
|
||||||
|
( \
|
||||||
|
CheckNil(nil,f) ? \
|
||||||
((f) = (l) = (n), SetNil(nil,(n)->next), SetNil(nil,(n)->prev)) : \
|
((f) = (l) = (n), SetNil(nil,(n)->next), SetNil(nil,(n)->prev)) : \
|
||||||
CheckNil(nil,p) ? \
|
CheckNil(nil,p) ? \
|
||||||
((n)->next = (f), (f)->prev = (n), (f) = (n), SetNil(nil,(n)->prev)) : \
|
((n)->next = (f), (f)->prev = (n), (f) = (n), SetNil(nil,(n)->prev)) : \
|
||||||
((p)==(l)) ? \
|
((p)==(l)) ? \
|
||||||
((l)->next = (n), (n)->prev = (l), (l) = (n), SetNil(nil, (n)->next)) : \
|
((l)->next = (n), (n)->prev = (l), (l) = (n), SetNil(nil, (n)->next)) : \
|
||||||
(((!CheckNil(nil,p) && CheckNil(nil,(p)->next)) ? (0) : ((p)->next->prev = (n))), ((n)->next = (p)->next), ((p)->next = (n)), ((n)->prev = (p))))
|
(((!CheckNil(nil,p) && CheckNil(nil,(p)->next)) ? (0) : \
|
||||||
|
( \
|
||||||
|
(p)->next->prev = (n))), \
|
||||||
|
((n)->next = (p)->next), \
|
||||||
|
((p)->next = (n)), \
|
||||||
|
((n)->prev = (p)) \
|
||||||
|
) \
|
||||||
|
)
|
||||||
|
|
||||||
#define DllRemoveNPZ(nil,f,l,n,next,prev) (((n) == (f) ? (f) = (n)->next : (0)), \
|
#define DllQueueRemoveNPZ(nil,f,l,n,next,prev) \
|
||||||
|
( \
|
||||||
|
((n) == (f) ? (f) = (n)->next : (0)), \
|
||||||
((n) == (l) ? (l) = (l)->prev : (0)), \
|
((n) == (l) ? (l) = (l)->prev : (0)), \
|
||||||
(CheckNil(nil,(n)->prev) ? (0) : \
|
(CheckNil(nil,(n)->prev) ? (0) : \
|
||||||
((n)->prev->next = (n)->next)), \
|
((n)->prev->next = (n)->next)), \
|
||||||
(CheckNil(nil,(n)->next) ? (0) : \
|
(CheckNil(nil,(n)->next) ? (0) : \
|
||||||
((n)->next->prev = (n)->prev)))
|
((n)->next->prev = (n)->prev)) \
|
||||||
|
)
|
||||||
|
|
||||||
#define DllPushBackNPZ(nil,f,l,n,next,prev) DllInsertNPZ(nil,f,l,l,n,next,prev)
|
#define DllQueuePushNPZ(nil,f,l,n,next,prev) DllQueueInsertNPZ(nil,f,l,l,n,next,prev)
|
||||||
#define DllPushFrontNPZ(nil,f,l,n,next,prev) DllInsertNPZ(nil,l,f,f,n,prev,next)
|
#define DllQueuePushNP(f,l,n,next,prev) DllQueuePushNPZ(0,f,l,n,next,prev)
|
||||||
#define DllInsertNP(f,l,p,n,next,prev) DllInsertNPZ(0,f,l,p,n,next,prev)
|
#define DllQueuePush(f,l,n) DllQueuePushNPZ(0,f,l,n,next,prev)
|
||||||
#define DllPushBackNP(f,l,n,next,prev) DllPushBackNPZ(0,f,l,n,next,prev)
|
#define DllQueuePushFrontNPZ(nil,f,l,n,next,prev) DllQueueInsertNPZ(nil,l,f,f,n,prev,next)
|
||||||
#define DllPushFrontNP(f,l,n,next,prev) DllPushFrontNPZ(0,f,l,n,next,prev)
|
#define DllQueuePushFrontNP(f,l,n,next,prev) DllQueuePushFrontNPZ(0,f,l,n,next,prev)
|
||||||
#define DllRemoveNP(f,l,n,next,prev) DllRemoveNPZ(0,f,l,n,next,prev)
|
#define DllQueuePushFront(f,l,n) DllQueuePushFrontNPZ(0,f,l,n,next,prev)
|
||||||
#define DllInsert(f,l,p,n) DllInsertNPZ(0,f,l,p,n,next,prev)
|
#define DllQueueInsertNP(f,l,p,n,next,prev) DllQueueInsertNPZ(0,f,l,p,n,next,prev)
|
||||||
#define DllPushBack(f,l,n) DllPushBackNPZ(0,f,l,n,next,prev)
|
#define DllQueueInsert(f,l,p,n) DllQueueInsertNPZ(0,f,l,p,n,next,prev)
|
||||||
#define DllPushFront(f,l,n) DllPushFrontNPZ(0,f,l,n,next,prev)
|
#define DllQueueRemoveNP(f,l,n,next,prev) DllQueueRemoveNPZ(0,f,l,n,next,prev)
|
||||||
#define DllRemove(f,l,n) DllRemoveNPZ(0,f,l,n,next,prev)
|
#define DllQueueRemove(f,l,n) DllQueueRemoveNPZ(0,f,l,n,next,prev)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Bit helper macros
|
//~ Bit helper macros
|
||||||
|
|||||||
@ -33,8 +33,8 @@ void InitResourceSystem(u64 archive_strings_count, String *archive_strings)
|
|||||||
entry->hash = HashFnv64(Fnv64Basis, entry->name);
|
entry->hash = HashFnv64(Fnv64Basis, entry->name);
|
||||||
|
|
||||||
ResourceEntryBin *bin = &g->bins[entry->hash % NumResourceEntryBins];
|
ResourceEntryBin *bin = &g->bins[entry->hash % NumResourceEntryBins];
|
||||||
QueuePushN(bin->first, bin->last, entry, next_in_bin);
|
SllQueuePushN(bin->first, bin->last, entry, next_in_bin);
|
||||||
QueuePushN(g->first_entry, g->last_entry, entry, next);
|
SllQueuePushN(g->first_entry, g->last_entry, entry, next);
|
||||||
}
|
}
|
||||||
g->entries_count += num_entries;
|
g->entries_count += num_entries;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,7 +295,7 @@ void W32_FiberEntryPoint(void *_)
|
|||||||
/* Free job */
|
/* Free job */
|
||||||
LockTicketMutex(&pool->free_jobs_tm);
|
LockTicketMutex(&pool->free_jobs_tm);
|
||||||
{
|
{
|
||||||
StackPush(pool->first_free_job, job);
|
SllStackPush(pool->first_free_job, job);
|
||||||
}
|
}
|
||||||
UnlockTicketMutex(&pool->free_jobs_tm);
|
UnlockTicketMutex(&pool->free_jobs_tm);
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ void W32_FiberEntryPoint(void *_)
|
|||||||
{
|
{
|
||||||
LockTicketMutex(&pool->free_tasks_tm);
|
LockTicketMutex(&pool->free_tasks_tm);
|
||||||
{
|
{
|
||||||
StackPush(pool->first_free_task, task);
|
SllStackPush(pool->first_free_task, task);
|
||||||
}
|
}
|
||||||
UnlockTicketMutex(&pool->free_tasks_tm);
|
UnlockTicketMutex(&pool->free_tasks_tm);
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ W32_ThreadDef(W32_JobWorkerEntryPoint, worker_ctx_arg)
|
|||||||
task = pool->first_task;
|
task = pool->first_task;
|
||||||
if (task)
|
if (task)
|
||||||
{
|
{
|
||||||
QueuePop(pool->first_task, pool->last_task);
|
SllQueuePop(pool->first_task, pool->last_task);
|
||||||
Atomic64FetchAdd(&pool->tasks_count.v, -1);
|
Atomic64FetchAdd(&pool->tasks_count.v, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ void ResumeFibers(i16 fiber_ids_count, i16 *fiber_ids)
|
|||||||
/* Group task based on pool */
|
/* Group task based on pool */
|
||||||
JobPoolId pool_id = fiber->pool;
|
JobPoolId pool_id = fiber->pool;
|
||||||
W32_TaskList *pool_tasks = &tasks_by_pool[pool_id];
|
W32_TaskList *pool_tasks = &tasks_by_pool[pool_id];
|
||||||
QueuePush(pool_tasks->first, pool_tasks->last, task);
|
SllQueuePush(pool_tasks->first, pool_tasks->last, task);
|
||||||
++pool_tasks->count;
|
++pool_tasks->count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -666,7 +666,7 @@ u32 CloseJob(Job *job)
|
|||||||
if (task)
|
if (task)
|
||||||
{
|
{
|
||||||
tasks_array[num_tasks_allocated++] = task;
|
tasks_array[num_tasks_allocated++] = task;
|
||||||
StackPop(pool->first_free_task);
|
SllStackPop(pool->first_free_task);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -702,7 +702,7 @@ u32 CloseJob(Job *job)
|
|||||||
ZeroStruct(task);
|
ZeroStruct(task);
|
||||||
task->job = job;
|
task->job = job;
|
||||||
task->task_id = tasks.count++;
|
task->task_id = tasks.count++;
|
||||||
QueuePush(tasks.first, tasks.last, task);
|
SllQueuePush(tasks.first, tasks.last, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Push tasks to back of pool */
|
/* Push tasks to back of pool */
|
||||||
|
|||||||
@ -160,7 +160,7 @@ GPU_Resource *GPU_UploadTransientBuffer(GPU_TransientBuffer *tbuff, void *src, u
|
|||||||
if (tbuff->first_submitted && tbuff->first_submitted->fence_target <= queue_fence_value)
|
if (tbuff->first_submitted && tbuff->first_submitted->fence_target <= queue_fence_value)
|
||||||
{
|
{
|
||||||
upload = tbuff->first_submitted;
|
upload = tbuff->first_submitted;
|
||||||
QueuePop(tbuff->first_submitted, tbuff->last_submitted);
|
SllQueuePop(tbuff->first_submitted, tbuff->last_submitted);
|
||||||
}
|
}
|
||||||
if (!upload)
|
if (!upload)
|
||||||
{
|
{
|
||||||
@ -170,7 +170,7 @@ GPU_Resource *GPU_UploadTransientBuffer(GPU_TransientBuffer *tbuff, void *src, u
|
|||||||
if (upload)
|
if (upload)
|
||||||
{
|
{
|
||||||
g->first_free_submitted_transient_buffer = upload->next;
|
g->first_free_submitted_transient_buffer = upload->next;
|
||||||
StackPop(g->first_free_submitted_transient_buffer);
|
SllStackPop(g->first_free_submitted_transient_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Unlock(&lock);
|
Unlock(&lock);
|
||||||
@ -223,7 +223,7 @@ void GPU_ResetTransientBuffer(GPU_TransientBuffer *tbuff, i64 queue_fence_target
|
|||||||
if (uploaded)
|
if (uploaded)
|
||||||
{
|
{
|
||||||
uploaded->fence_target = queue_fence_target;
|
uploaded->fence_target = queue_fence_target;
|
||||||
QueuePush(tbuff->first_submitted, tbuff->last_submitted, uploaded);
|
SllQueuePush(tbuff->first_submitted, tbuff->last_submitted, uploaded);
|
||||||
tbuff->uploaded = 0;
|
tbuff->uploaded = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ GPU_D12_Command *GPU_D12_PushCmd(GPU_D12_CommandList *cl)
|
|||||||
cmd = PushStructNoZero(perm, GPU_D12_Command);
|
cmd = PushStructNoZero(perm, GPU_D12_Command);
|
||||||
}
|
}
|
||||||
ZeroStruct(cmd);
|
ZeroStruct(cmd);
|
||||||
QueuePush(cl->first, cl->last, cmd);
|
SllQueuePush(cl->first, cl->last, cmd);
|
||||||
++cl->count;
|
++cl->count;
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
@ -528,7 +528,7 @@ GPU_D12_Pipeline *GPU_D12_PipelineFromDesc(GPU_D12_PipelineDesc desc)
|
|||||||
pipeline->hash = hash;
|
pipeline->hash = hash;
|
||||||
is_pipeline_new = 1;
|
is_pipeline_new = 1;
|
||||||
PushAlign(perm, CachelineSize);
|
PushAlign(perm, CachelineSize);
|
||||||
StackPushN(bin->first, pipeline, next_in_bin);
|
SllStackPushN(bin->first, pipeline, next_in_bin);
|
||||||
}
|
}
|
||||||
Unlock(&lock);
|
Unlock(&lock);
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ GPU_D12_RawCommandList *GPU_D12_BeginRawCommandList(GPU_QueueKind queue_kind)
|
|||||||
cl = queue->first_submitted_cl;
|
cl = queue->first_submitted_cl;
|
||||||
if (cl && cl->submit_fence_target <= completed)
|
if (cl && cl->submit_fence_target <= completed)
|
||||||
{
|
{
|
||||||
QueuePop(queue->first_submitted_cl, queue->last_submitted_cl);
|
SllQueuePop(queue->first_submitted_cl, queue->last_submitted_cl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -703,7 +703,7 @@ u64 GPU_D12_EndRawCommandList(GPU_D12_RawCommandList *cl)
|
|||||||
ID3D12CommandQueue_ExecuteCommandLists(queue->d3d_queue, 1, (ID3D12CommandList **)&cl->cl);
|
ID3D12CommandQueue_ExecuteCommandLists(queue->d3d_queue, 1, (ID3D12CommandList **)&cl->cl);
|
||||||
ID3D12CommandQueue_Signal(queue->d3d_queue, queue->submit_fence, target);
|
ID3D12CommandQueue_Signal(queue->d3d_queue, queue->submit_fence, target);
|
||||||
/* Append */
|
/* Append */
|
||||||
QueuePush(queue->first_submitted_cl, queue->last_submitted_cl, cl);
|
SllQueuePush(queue->first_submitted_cl, queue->last_submitted_cl, cl);
|
||||||
}
|
}
|
||||||
Unlock(&lock);
|
Unlock(&lock);
|
||||||
}
|
}
|
||||||
@ -831,8 +831,8 @@ GPU_Resource *GPU_AcquireResource(GPU_ResourceDesc desc)
|
|||||||
list->first = r->next_free;
|
list->first = r->next_free;
|
||||||
if (!list->first)
|
if (!list->first)
|
||||||
{
|
{
|
||||||
DllRemove(bin->first, bin->last, list);
|
DllQueueRemove(bin->first, bin->last, list);
|
||||||
StackPush(bin->first_free, list);
|
SllStackPush(bin->first_free, list);
|
||||||
list->prev = 0;
|
list->prev = 0;
|
||||||
}
|
}
|
||||||
r->next_free = 0;
|
r->next_free = 0;
|
||||||
@ -1097,9 +1097,9 @@ void GPU_ReleaseResource(GPU_Resource *gpu_resource, GPU_ReleaseFlag flags)
|
|||||||
PushAlign(perm, CachelineSize);
|
PushAlign(perm, CachelineSize);
|
||||||
}
|
}
|
||||||
list->hash = reuse_hash;
|
list->hash = reuse_hash;
|
||||||
DllPushBack(bin->first, bin->last, list);
|
DllQueuePush(bin->first, bin->last, list);
|
||||||
}
|
}
|
||||||
StackPushN(list->first, r, next_free);
|
SllStackPushN(list->first, r, next_free);
|
||||||
}
|
}
|
||||||
Unlock(&lock);
|
Unlock(&lock);
|
||||||
}
|
}
|
||||||
@ -1180,7 +1180,7 @@ GPU_CommandList *GPU_BeginCommandList(GPU_QueueKind queue_kind)
|
|||||||
GPU_D12_CommandList *cl = f->first_free_command_list;
|
GPU_D12_CommandList *cl = f->first_free_command_list;
|
||||||
if (cl)
|
if (cl)
|
||||||
{
|
{
|
||||||
StackPop(f->first_free_command_list);
|
SllStackPop(f->first_free_command_list);
|
||||||
ZeroStruct(cl);
|
ZeroStruct(cl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1319,7 +1319,7 @@ i64 GPU_EndCommandList(GPU_CommandList *gpu_cl)
|
|||||||
TmpBarrier *b = PushStruct(scratch.arena, TmpBarrier);
|
TmpBarrier *b = PushStruct(scratch.arena, TmpBarrier);
|
||||||
resource->barrier_gen = barrier_gen;
|
resource->barrier_gen = barrier_gen;
|
||||||
b->r = resource;
|
b->r = resource;
|
||||||
QueuePush(first_barrier, last_barrier, b);
|
SllQueuePush(first_barrier, last_barrier, b);
|
||||||
++max_barriers_count;
|
++max_barriers_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1658,7 +1658,7 @@ i64 GPU_EndCommandList(GPU_CommandList *gpu_cl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Free command list */
|
/* Free command list */
|
||||||
StackPush(f->first_free_command_list, cl);
|
SllStackPush(f->first_free_command_list, cl);
|
||||||
|
|
||||||
EndScratch(scratch);
|
EndScratch(scratch);
|
||||||
return fence_target;
|
return fence_target;
|
||||||
|
|||||||
@ -490,7 +490,7 @@ JobDef(Step, sig, id)
|
|||||||
ShaderEntry *e = PushStruct(arena, ShaderEntry);
|
ShaderEntry *e = PushStruct(arena, ShaderEntry);
|
||||||
e->kind = shader_kind;
|
e->kind = shader_kind;
|
||||||
e->name = shader_name;
|
e->name = shader_name;
|
||||||
QueuePush(first_shader_entry, last_shader_entry, e);
|
SllQueuePush(first_shader_entry, last_shader_entry, e);
|
||||||
++shader_entries_count;
|
++shader_entries_count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -636,7 +636,7 @@ JobDef(Step, sig, id)
|
|||||||
EmbeddedDir *ed = PushStruct(arena, EmbeddedDir);
|
EmbeddedDir *ed = PushStruct(arena, EmbeddedDir);
|
||||||
ed->store_name = store_name;
|
ed->store_name = store_name;
|
||||||
ed->dir_name = full;
|
ed->dir_name = full;
|
||||||
QueuePush(first_dir_embed, last_dir_embed, ed);
|
SllQueuePush(first_dir_embed, last_dir_embed, ed);
|
||||||
++dir_embeds_count;
|
++dir_embeds_count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -725,7 +725,7 @@ JobDef(Step, sig, id)
|
|||||||
EntryNode *en = PushStruct(arena, EntryNode);
|
EntryNode *en = PushStruct(arena, EntryNode);
|
||||||
en->entry_name = entry_name;
|
en->entry_name = entry_name;
|
||||||
en->file_name = file_name;
|
en->file_name = file_name;
|
||||||
QueuePush(first_entry, last_entry, en);
|
SllQueuePush(first_entry, last_entry, en);
|
||||||
++entries_count;
|
++entries_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ M_Error *M_PushError(Arena *arena, M_ErrorList *l, M_Token *token, String msg)
|
|||||||
M_Error *e = PushStruct(arena, M_Error);
|
M_Error *e = PushStruct(arena, M_Error);
|
||||||
e->msg = msg;
|
e->msg = msg;
|
||||||
e->token = token ? token : &M_NilToken;
|
e->token = token ? token : &M_NilToken;
|
||||||
QueuePush(l->first, l->last, e);
|
SllQueuePush(l->first, l->last, e);
|
||||||
++l->count;
|
++l->count;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ M_TokenFile *M_PushTokenFile(Arena *arena, M_TokenFileList *l, String name, Stri
|
|||||||
tf->name = name;
|
tf->name = name;
|
||||||
tf->data = data;
|
tf->data = data;
|
||||||
M_PushToken(arena, tf, Lit(""), M_TokenKind_Eol);
|
M_PushToken(arena, tf, Lit(""), M_TokenKind_Eol);
|
||||||
QueuePushNZ(&M_NilTokenFile, l->first, l->last, tf, next);
|
SllQueuePushNZ(&M_NilTokenFile, l->first, l->last, tf, next);
|
||||||
++l->count;
|
++l->count;
|
||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ M_Token *M_PushToken(Arena *arena, M_TokenFile *file, String s, M_TokenKind kind
|
|||||||
{
|
{
|
||||||
t->file = file;
|
t->file = file;
|
||||||
}
|
}
|
||||||
QueuePushNZ(&M_NilToken, file->first_token, file->last_token, t, next);
|
SllQueuePushNZ(&M_NilToken, file->first_token, file->last_token, t, next);
|
||||||
++file->tokens_count;
|
++file->tokens_count;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ M_Layer *M_PushLayer(Arena *arena, M_LayerList *list, M_TokenFile *file)
|
|||||||
*layer = M_NilLayer;
|
*layer = M_NilLayer;
|
||||||
layer->valid = 1;
|
layer->valid = 1;
|
||||||
layer->file = file;
|
layer->file = file;
|
||||||
QueuePushNZ(&M_NilLayer, list->first, list->last, layer, next);
|
SllQueuePushNZ(&M_NilLayer, list->first, list->last, layer, next);
|
||||||
++list->count;
|
++list->count;
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ M_Entry *M_PushEntry(Arena *arena, M_Layer *l, M_EntryKind kind, M_Token *entry_
|
|||||||
e->arg_tokens[i] = args[i];
|
e->arg_tokens[i] = args[i];
|
||||||
}
|
}
|
||||||
e->args_count = args_count;
|
e->args_count = args_count;
|
||||||
QueuePushNZ(&M_NilEntry, l->first, l->last, e, next);
|
SllQueuePushNZ(&M_NilEntry, l->first, l->last, e, next);
|
||||||
++l->count;
|
++l->count;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@ -425,7 +425,7 @@ M_Layer M_GetFlattenedEntries(Arena *arena, M_LayerList unflattened, StringList
|
|||||||
{
|
{
|
||||||
StackNode *n = PushStruct(scratch.arena, StackNode);
|
StackNode *n = PushStruct(scratch.arena, StackNode);
|
||||||
n->state = state;
|
n->state = state;
|
||||||
StackPush(stack, n);
|
SllStackPush(stack, n);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -438,7 +438,7 @@ M_Layer M_GetFlattenedEntries(Arena *arena, M_LayerList unflattened, StringList
|
|||||||
while (stack)
|
while (stack)
|
||||||
{
|
{
|
||||||
StackNode *stack_node = stack;
|
StackNode *stack_node = stack;
|
||||||
StackPop(stack);
|
SllStackPop(stack);
|
||||||
IterState *state = stack_node->state;
|
IterState *state = stack_node->state;
|
||||||
M_Layer *layer = state->layer;
|
M_Layer *layer = state->layer;
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ M_Layer M_GetFlattenedEntries(Arena *arena, M_LayerList unflattened, StringList
|
|||||||
{
|
{
|
||||||
StackNode *n = PushStruct(scratch.arena, StackNode);
|
StackNode *n = PushStruct(scratch.arena, StackNode);
|
||||||
n->state = impl_layer_state;
|
n->state = impl_layer_state;
|
||||||
StackPush(stack, n);
|
SllStackPush(stack, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -502,7 +502,7 @@ M_Layer M_GetFlattenedEntries(Arena *arena, M_LayerList unflattened, StringList
|
|||||||
/* Push node exit to stack */
|
/* Push node exit to stack */
|
||||||
{
|
{
|
||||||
stack_node->exit = 1;
|
stack_node->exit = 1;
|
||||||
StackPush(stack, stack_node);
|
SllStackPush(stack, stack_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Push upstream dep enters to stack */
|
/* Push upstream dep enters to stack */
|
||||||
@ -523,7 +523,7 @@ M_Layer M_GetFlattenedEntries(Arena *arena, M_LayerList unflattened, StringList
|
|||||||
{
|
{
|
||||||
StackNode *n = PushStruct(scratch.arena, StackNode);
|
StackNode *n = PushStruct(scratch.arena, StackNode);
|
||||||
n->state = dep_layer_state;
|
n->state = dep_layer_state;
|
||||||
StackPush(stack, n);
|
SllStackPush(stack, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -154,7 +154,7 @@ JobDef(PP_VisWorker, sig, job_id)
|
|||||||
shortcut->hotkey_hash = hotkey_hash;
|
shortcut->hotkey_hash = hotkey_hash;
|
||||||
shortcut->hotkey = hotkey;
|
shortcut->hotkey = hotkey;
|
||||||
shortcut->cmd_name = desc.name;
|
shortcut->cmd_name = desc.name;
|
||||||
DllPushBackNP(bin->first, bin->last, shortcut, next_in_bin, prev_in_bin);
|
DllQueuePushNP(bin->first, bin->last, shortcut, next_in_bin, prev_in_bin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ JobDef(PP_VisWorker, sig, job_id)
|
|||||||
{
|
{
|
||||||
PP_VisCmdNode *cmd_node = PushStruct(frame_arena, PP_VisCmdNode);
|
PP_VisCmdNode *cmd_node = PushStruct(frame_arena, PP_VisCmdNode);
|
||||||
cmd_node->cmd.name = shortcut->cmd_name;
|
cmd_node->cmd.name = shortcut->cmd_name;
|
||||||
QueuePush(first_cmd_node, last_cmd_node, cmd_node);
|
SllQueuePush(first_cmd_node, last_cmd_node, cmd_node);
|
||||||
++cmds_count;
|
++cmds_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ JobDef(PP_VisWorker, sig, job_id)
|
|||||||
{
|
{
|
||||||
PP_VisCmdNode *cmd_node = PushStruct(frame_arena, PP_VisCmdNode);
|
PP_VisCmdNode *cmd_node = PushStruct(frame_arena, PP_VisCmdNode);
|
||||||
cmd_node->cmd.name = desc.name;
|
cmd_node->cmd.name = desc.name;
|
||||||
QueuePush(first_cmd_node, last_cmd_node, cmd_node);
|
SllQueuePush(first_cmd_node, last_cmd_node, cmd_node);
|
||||||
++cmds_count;
|
++cmds_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ JobDef(PP_VisWorker, sig, job_id)
|
|||||||
{
|
{
|
||||||
PP_EntListNode *n = PushStruct(frame_arena, PP_EntListNode);
|
PP_EntListNode *n = PushStruct(frame_arena, PP_EntListNode);
|
||||||
++spawn_ents.count;
|
++spawn_ents.count;
|
||||||
QueuePush(spawn_ents.first, spawn_ents.last, n);
|
SllQueuePush(spawn_ents.first, spawn_ents.last, n);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ JobDef(PP_VisWorker, sig, job_id)
|
|||||||
PP_SimCmdNode *cmd_node = PushStruct(v2s->arena, PP_SimCmdNode);
|
PP_SimCmdNode *cmd_node = PushStruct(v2s->arena, PP_SimCmdNode);
|
||||||
cmd_node->cmd.kind = PP_SimCmdKind_Ent;
|
cmd_node->cmd.kind = PP_SimCmdKind_Ent;
|
||||||
cmd_node->cmd.ent = ent_node->ent;
|
cmd_node->cmd.ent = ent_node->ent;
|
||||||
QueuePush(v2s->first_cmd_node, v2s->last_cmd_node, cmd_node);
|
SllQueuePush(v2s->first_cmd_node, v2s->last_cmd_node, cmd_node);
|
||||||
++v2s->cmds_count;
|
++v2s->cmds_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ PP_CommandsWidgetItemReport PP_PushCommandsWidgetItem(PP_CommandsWidget *widget,
|
|||||||
PP_CommandsWidgetItem *item = PushStruct(frame_arena, PP_CommandsWidgetItem);
|
PP_CommandsWidgetItem *item = PushStruct(frame_arena, PP_CommandsWidgetItem);
|
||||||
item->key = key;
|
item->key = key;
|
||||||
item->desc = desc;
|
item->desc = desc;
|
||||||
QueuePush(widget->build.first_item, widget->build.last_item, item);
|
SllQueuePush(widget->build.first_item, widget->build.last_item, item);
|
||||||
++widget->build.num_items;
|
++widget->build.num_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,7 @@ JobDef(SPR_LoadSheet, sig, _)
|
|||||||
/* Insert span into bin */
|
/* Insert span into bin */
|
||||||
{
|
{
|
||||||
SPR_SpanBin *bin = &sheet->span_bins[dst->hash % sheet->span_bins_count];
|
SPR_SpanBin *bin = &sheet->span_bins[dst->hash % sheet->span_bins_count];
|
||||||
QueuePushN(bin->first, bin->last, dst, next_in_bin);
|
SllQueuePushN(bin->first, bin->last, dst, next_in_bin);
|
||||||
}
|
}
|
||||||
++span_index;
|
++span_index;
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ JobDef(SPR_LoadSheet, sig, _)
|
|||||||
/* Insert group into bin */
|
/* Insert group into bin */
|
||||||
{
|
{
|
||||||
SPR_SliceGroupBin *bin = &sheet->slice_group_bins[dst_group->hash % sheet->slice_group_bins_count];
|
SPR_SliceGroupBin *bin = &sheet->slice_group_bins[dst_group->hash % sheet->slice_group_bins_count];
|
||||||
QueuePushN(bin->first, bin->last, dst_group, next_in_bin);
|
SllQueuePushN(bin->first, bin->last, dst_group, next_in_bin);
|
||||||
}
|
}
|
||||||
++group_index;
|
++group_index;
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ SPR_Entry *SPR_FetchEntry(ResourceKey resource, JobPoolId pool, SPR_FetchFlag fl
|
|||||||
Arena *perm = PermArena();
|
Arena *perm = PermArena();
|
||||||
entry = PushStruct(perm, SPR_Entry);
|
entry = PushStruct(perm, SPR_Entry);
|
||||||
entry->resource = resource;
|
entry->resource = resource;
|
||||||
QueuePushN(bin->first, bin->last, entry, next_in_bin);
|
SllQueuePushN(bin->first, bin->last, entry, next_in_bin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Unlock(&lock);
|
Unlock(&lock);
|
||||||
|
|||||||
@ -397,7 +397,7 @@ UI_Key UI_BuildBoxEx(UI_Key key)
|
|||||||
n->cmd.floating_pos = UI_UseTop(FloatingPos);
|
n->cmd.floating_pos = UI_UseTop(FloatingPos);
|
||||||
}
|
}
|
||||||
++g->bframe.cmds_count;
|
++g->bframe.cmds_count;
|
||||||
QueuePush(g->bframe.first_cmd_node, g->bframe.last_cmd_node, n);
|
SllQueuePush(g->bframe.first_cmd_node, g->bframe.last_cmd_node, n);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,7 +752,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
/* Remove box from old parent */
|
/* Remove box from old parent */
|
||||||
if (box->parent)
|
if (box->parent)
|
||||||
{
|
{
|
||||||
DllRemove(box->parent->first, box->parent->last, box);
|
DllQueueRemove(box->parent->first, box->parent->last, box);
|
||||||
--box->parent->count;
|
--box->parent->count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -761,14 +761,14 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
box = g->first_free_box;
|
box = g->first_free_box;
|
||||||
if (box)
|
if (box)
|
||||||
{
|
{
|
||||||
StackPop(g->first_free_box);
|
SllStackPop(g->first_free_box);
|
||||||
ZeroStruct(box);
|
ZeroStruct(box);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
box = PushStruct(g->box_arena, UI_Box);
|
box = PushStruct(g->box_arena, UI_Box);
|
||||||
}
|
}
|
||||||
DllPushBackNP(bin->first, bin->last, box, next_in_bin, prev_in_bin);
|
DllQueuePushNP(bin->first, bin->last, box, next_in_bin, prev_in_bin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++g->boxes_count;
|
++g->boxes_count;
|
||||||
@ -791,7 +791,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
/* Insert box into parent */
|
/* Insert box into parent */
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
DllPushBack(parent->first, parent->last, box);
|
DllQueuePush(parent->first, parent->last, box);
|
||||||
box->parent = parent;
|
box->parent = parent;
|
||||||
++parent->count;
|
++parent->count;
|
||||||
}
|
}
|
||||||
@ -844,7 +844,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
{
|
{
|
||||||
BoxNode *n = PushStruct(scratch.arena, BoxNode);
|
BoxNode *n = PushStruct(scratch.arena, BoxNode);
|
||||||
n->box = g->eframe.root_box;
|
n->box = g->eframe.root_box;
|
||||||
StackPush(first_dfs, n);
|
SllStackPush(first_dfs, n);
|
||||||
}
|
}
|
||||||
while (first_dfs)
|
while (first_dfs)
|
||||||
{
|
{
|
||||||
@ -859,7 +859,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
{
|
{
|
||||||
BoxNode *child_n = PushStruct(scratch.arena, BoxNode);
|
BoxNode *child_n = PushStruct(scratch.arena, BoxNode);
|
||||||
child_n->box = child;
|
child_n->box = child;
|
||||||
StackPush(first_dfs, child_n);
|
SllStackPush(first_dfs, child_n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Push non-floating children to dfs stack */
|
/* Push non-floating children to dfs stack */
|
||||||
@ -869,7 +869,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
{
|
{
|
||||||
BoxNode *child_n = PushStruct(scratch.arena, BoxNode);
|
BoxNode *child_n = PushStruct(scratch.arena, BoxNode);
|
||||||
child_n->box = child;
|
child_n->box = child;
|
||||||
StackPush(first_dfs, child_n);
|
SllStackPush(first_dfs, child_n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
box->pre_index = pre_index++;
|
box->pre_index = pre_index++;
|
||||||
@ -878,7 +878,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StackPop(first_dfs);
|
SllStackPop(first_dfs);
|
||||||
box->post_index = post_index++;
|
box->post_index = post_index++;
|
||||||
boxes_post[box->post_index] = box;
|
boxes_post[box->post_index] = box;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -392,7 +392,7 @@ void WND_PushCmd_(WND_Frame frame, WND_Cmd desc)
|
|||||||
WND_W32_Window *window = WND_W32_WindowFromHandle(frame.window_handle);
|
WND_W32_Window *window = WND_W32_WindowFromHandle(frame.window_handle);
|
||||||
WND_W32_CmdNode *n = PushStruct(window->frame_arena, WND_W32_CmdNode);
|
WND_W32_CmdNode *n = PushStruct(window->frame_arena, WND_W32_CmdNode);
|
||||||
n->cmd = desc;
|
n->cmd = desc;
|
||||||
QueuePush(window->first_cmd, window->last_cmd, n);
|
SllQueuePush(window->first_cmd, window->last_cmd, n);
|
||||||
if (desc.kind == WND_CmdKind_Restore)
|
if (desc.kind == WND_CmdKind_Restore)
|
||||||
{
|
{
|
||||||
n->cmd.restore = PushString(window->frame_arena, desc.restore);
|
n->cmd.restore = PushString(window->frame_arena, desc.restore);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user