1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 21:43:06 +01:00

Introduce rendering engine flag for parallel drawing

This commit is contained in:
ζeh Matt
2021-10-06 17:15:40 +03:00
parent 782220b42b
commit 6ad4150085
3 changed files with 12 additions and 1 deletions

View File

@@ -32,6 +32,11 @@ enum DRAWING_ENGINE_FLAGS
* Whether or not the engine will only draw changed blocks of the screen each frame.
*/
DEF_DIRTY_OPTIMISATIONS = 1 << 0,
/**
* The drawing engine is capable of processing the drawing in parallel.
*/
DEF_PARALLEL_DRAWING = 1 << 1,
};
struct rct_drawpixelinfo;

View File

@@ -284,7 +284,7 @@ rct_drawpixelinfo* X8DrawingEngine::GetDrawingPixelInfo()
DRAWING_ENGINE_FLAGS X8DrawingEngine::GetFlags()
{
return DEF_DIRTY_OPTIMISATIONS;
return static_cast<DRAWING_ENGINE_FLAGS>(DEF_DIRTY_OPTIMISATIONS | DEF_PARALLEL_DRAWING);
}
void X8DrawingEngine::InvalidateImage([[maybe_unused]] uint32_t image)

View File

@@ -996,6 +996,12 @@ void viewport_paint(
_paintJobs.reset();
}
bool useParallelDrawing = false;
if (useMultithreading && (dpi->DrawingEngine->GetFlags() & DEF_PARALLEL_DRAWING))
{
useParallelDrawing = true;
}
// Create space to record sessions and keep track which index is being drawn
size_t index = 0;
if (recorded_sessions != nullptr)