common engine: manage engine initializing context.

Change-Id: Ida3997fd7cc9ee0916d48290168cdb884e946833
This commit is contained in:
Hermet Park 2020-06-15 20:55:55 +09:00
parent 7435b5b414
commit fb208defed

View file

@ -24,6 +24,8 @@
/************************************************************************/ /************************************************************************/
/* Internal Class Implementation */ /* Internal Class Implementation */
/************************************************************************/ /************************************************************************/
static bool initialized = false;
/************************************************************************/ /************************************************************************/
@ -32,11 +34,13 @@
Result Engine::init() noexcept Result Engine::init() noexcept
{ {
//TODO: Initialize Raster engines by configuration. if (initialized) return Result::InsufficientCondition;
int ret = 0; //TODO: Initialize Raster engines by configuration.
ret |= SwRenderer::init(); SwRenderer::init();
ret |= GlRenderer::init(); GlRenderer::init();
initialized = true;
return Result::Success; return Result::Success;
} }
@ -44,9 +48,13 @@ Result Engine::init() noexcept
Result Engine::term() noexcept Result Engine::term() noexcept
{ {
int ret = 0; if (!initialized) return Result::InsufficientCondition;
ret |= SwRenderer::term();
ret |= GlRenderer::term(); //TODO: Terminate only allowed engines.
SwRenderer::term();
GlRenderer::term();
initialized = false;
return Result::Success; return Result::Success;
} }