You're breathtaking!
This commit is contained in:
40
Source/Engine/Graphics/Async/DefaultGPUTasksExecutor.cpp
Normal file
40
Source/Engine/Graphics/Async/DefaultGPUTasksExecutor.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2012-2020 Wojciech Figat. All rights reserved.
|
||||
|
||||
#include "DefaultGPUTasksExecutor.h"
|
||||
#include "GPUTasksContext.h"
|
||||
#include "GPUTask.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
|
||||
DefaultGPUTasksExecutor::DefaultGPUTasksExecutor()
|
||||
: _context(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
String DefaultGPUTasksExecutor::ToString() const
|
||||
{
|
||||
return TEXT("Default GPU Async Executor");
|
||||
}
|
||||
|
||||
void DefaultGPUTasksExecutor::FrameBegin()
|
||||
{
|
||||
// Ensure to have valid async context
|
||||
if (_context == nullptr)
|
||||
_context = createContext();
|
||||
|
||||
_context->OnFrameBegin();
|
||||
}
|
||||
|
||||
void DefaultGPUTasksExecutor::FrameEnd()
|
||||
{
|
||||
ASSERT(_context != nullptr);
|
||||
|
||||
// Default implementation performs async operations on end of the frame which is synchronized with a rendering thread
|
||||
GPUTask* buffer[32];
|
||||
const int32 count = GPUDevice::Instance->TasksManager.RequestWork(buffer, 32);
|
||||
for (int32 i = 0; i < count; i++)
|
||||
{
|
||||
_context->Run(buffer[i]);
|
||||
}
|
||||
|
||||
_context->OnFrameEnd();
|
||||
}
|
||||
Reference in New Issue
Block a user