Skip to content

Commit 422414e

Browse files
committed
Task: make the struct more compact, clean-up
1 parent 4342d72 commit 422414e

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

  • src/engine/renderer-vulkan/Thread

src/engine/renderer-vulkan/Thread/Task.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,36 +60,37 @@ constexpr bool IsPointer = IsPointer_<T>::out; */
6060
struct Task {
6161
using TaskFunction = void( * )( void* );
6262

63-
TaskFunction Execute;
64-
void* data;
63+
TaskFunction Execute;
64+
void* data;
6565

6666
FenceMain complete;
6767

68-
uint8 flags = 0;
69-
bool active = false;
68+
uint8 flags = 0;
69+
bool active = false;
7070

71-
uint32 eventMask = 0;
71+
static constexpr uint32 UNALLOCATED = UINT16_MAX;
72+
uint16 bufferID = UNALLOCATED; // Task RingBuffer id
7273

73-
uint64 gen = 0;
74-
uint64 time = 0;
74+
uint32 eventMask = 0;
75+
uint32 gen = 0;
7576

76-
std::atomic<uint32> dependencyCounter = 1;
77-
std::atomic<uint32> forwardTaskCounter = 0;
78-
uint32 forwardTaskCounterFast = 0;
77+
std::atomic<uint8> dependencyCounter = 1;
78+
std::atomic<uint8> forwardTaskCounter = 0;
79+
std::atomic<uint8> threadCount = 0;
80+
uint8 id = 0; // 4 bits - task memory/dependency tracking in TaskList
7981

80-
uint8 id = 0; // 4 bits - task memory/dependency tracking in TaskList
82+
AccessLock forwardTaskLock;
83+
uint32 forwardTaskCounterFast = 0;
8184

82-
static constexpr uint32 UNALLOCATED = UINT16_MAX;
83-
uint16 bufferID = UNALLOCATED; // Task RingBuffer id
84-
uint64 threadMask = 0;
85-
std::atomic<uint32> threadCount = 0;
85+
uint64 time = 0;
86+
uint64 threadMask = 0;
8687

87-
AccessLock forwardTaskLock;
88+
uint16 dataSize = 0;
8889

89-
uint16 dataSize = 0;
90+
static constexpr uint32 MAX_FORWARD_TASKS = 14;
91+
uint16 forwardTasks[MAX_FORWARD_TASKS] { 0 };
9092

91-
static constexpr uint32 MAX_FORWARD_TASKS = 14;
92-
uint16 forwardTasks[MAX_FORWARD_TASKS] { 0 };
93+
byte reserved[18];
9394

9495
Task();
9596

0 commit comments

Comments
 (0)