softgpu: Use persistent bin task state.

It's constant, so it's better to avoid the copying and allocation.  A
small win, but removes new from the profile.
This commit is contained in:
Unknown W. Brackets committed 2022-01-20 16:58:43 -08:00
1 parent 3e4d768e7a
commit 55c11425e4
4 files changed
+31 -5

No files matched your search

+14 -3
View File
@@ -105,6 +105,10 @@ public:
notify_->Drain();
}
void Release() override {
// Don't delete, this is statically allocated.
}
private:
void ProcessItems() {
while (!items_.Empty()) {
@@ -131,8 +135,11 @@ BinManager::BinManager() {
s = false;
int maxInitTasks = std::min(g_threadManager.GetNumLooperThreads(), MAX_POSSIBLE_TASKS);
for (int i = 0; i < maxInitTasks; ++i)
for (int i = 0; i < maxInitTasks; ++i) {
taskQueues_[i].Setup();
for (DrawBinItemsTask *&task : taskLists_[i].tasks)
task = new DrawBinItemsTask(waitable_, taskQueues_[i], taskStatus_[i], states_);
}
states_.Setup();
cluts_.Setup();
queue_.Setup();
@@ -140,6 +147,11 @@ BinManager::BinManager() {
BinManager::~BinManager() {
delete waitable_;
for (int i = 0; i < MAX_POSSIBLE_TASKS; ++i) {
for (DrawBinItemsTask *task : taskLists_[i].tasks)
delete task;
}
}
void BinManager::UpdateState() {
@@ -335,8 +347,7 @@ void BinManager::Drain() {
waitable_->Fill();
taskStatus_[i] = true;
DrawBinItemsTask *task = new DrawBinItemsTask(waitable_, taskQueues_[i], taskStatus_[i], states_);
g_threadManager.EnqueueTaskOnThread(i, task, true);
g_threadManager.EnqueueTaskOnThread(i, taskLists_[i].Next(), true);
enqueues_++;
}