diff --git a/sources/Core/Exception.cpp b/sources/Core/Exception.cpp index 234a915919..f58d6489aa 100644 --- a/sources/Core/Exception.cpp +++ b/sources/Core/Exception.cpp @@ -43,7 +43,7 @@ LLGL_EXPORT void Trap(const char* origin, const char* format, ...) LLGL_STRING_PRINTF(report, format); - #ifdef LLGL_ENABLE_EXCEPTIONS + #if LLGL_ENABLE_EXCEPTIONS /* Throw exception with report and optional origin */ throw std::runtime_error(report); @@ -167,13 +167,13 @@ LLGL_EXPORT void TrapReport(const char* origin, const Report& report) LLGL_EXPORT std::nullptr_t ReportException(Report* report, const char* format, ...) { - #ifdef LLGL_ENABLE_EXCEPTIONS + #if LLGL_ENABLE_EXCEPTIONS std::string errorStr; LLGL_STRING_PRINTF(errorStr, format); throw std::runtime_error(errorStr); - #else + #else // LLGL_ENABLE_EXCEPTIONS if (report != nullptr) { @@ -184,7 +184,7 @@ LLGL_EXPORT std::nullptr_t ReportException(Report* report, const char* format, . return nullptr; - #endif + #endif // /LLGL_ENABLE_EXCEPTIONS } diff --git a/sources/Renderer/CheckedCast.h b/sources/Renderer/CheckedCast.h index f01f357c34..ac07ecf905 100644 --- a/sources/Renderer/CheckedCast.h +++ b/sources/Renderer/CheckedCast.h @@ -46,7 +46,7 @@ inline TDst& ObjectCast(TSrc& obj) return dynamic_cast(obj); - #endif + #endif // /LLGL_ENABLE_EXCEPTIONS } template diff --git a/sources/Renderer/RenderSystem.cpp b/sources/Renderer/RenderSystem.cpp index dffe21c433..3fe086c459 100644 --- a/sources/Renderer/RenderSystem.cpp +++ b/sources/Renderer/RenderSystem.cpp @@ -21,6 +21,7 @@ #include "BuildID.h" #include +#include "RenderSystemRegistry.h" #include #include @@ -55,7 +56,6 @@ struct RenderSystem::Pimpl Report report; }; -static std::unordered_map> g_renderSystemModules; RenderSystem::RenderSystem() : pimpl_ { new Pimpl{} } @@ -67,131 +67,15 @@ RenderSystem::~RenderSystem() delete pimpl_; } -#ifdef LLGL_BUILD_STATIC_LIB - -std::vector RenderSystem::FindModules() -{ - return StaticModule::GetStaticModules(); -} - -#else // LLGL_BUILD_STATIC_LIB - std::vector RenderSystem::FindModules() { - /* Iterate over all known modules and return those that are available on the current platform */ - constexpr const char* knownModules[] = - { - "Null", - - #if defined(LLGL_OS_IOS) || defined(LLGL_OS_ANDROID) - "OpenGLES3", - #else - "OpenGL", - #endif - - #if defined(LLGL_OS_MACOS) || defined(LLGL_OS_IOS) - "Metal", - #else - "Vulkan", - #endif - - #if defined(LLGL_OS_WIN32) || defined(LLGL_OS_UWP) - "Direct3D11", - "Direct3D12", - #endif - }; - - std::vector modules; - - for (const char* m : knownModules) - { - std::string moduleFilename = Module::GetModuleFilename(m); - if (Module::IsAvailable(moduleFilename.c_str())) - modules.push_back(m); - } - - return modules; -} - -static bool LoadRenderSystemBuildID( - Module& module, - const std::string& moduleFilename, - Report* report) -{ - /* Load "LLGL_RenderSystem_BuildID" procedure */ - LLGL_PROC_INTERFACE(int, PFN_RENDERSYSTEM_BUILDID, (void)); - - auto RenderSystem_BuildID = reinterpret_cast(module.LoadProcedure("LLGL_RenderSystem_BuildID")); - if (!RenderSystem_BuildID) - { - ReportException(report, "failed to load procedure from module: %s", moduleFilename.c_str()); - return false; - } - - return (RenderSystem_BuildID() == LLGL_BUILD_ID); -} - -static int LoadRenderSystemRendererID(Module& module, const RenderSystemDescriptor& renderSystemDesc) -{ - /* Load "LLGL_RenderSystem_RendererID" procedure */ - LLGL_PROC_INTERFACE(int, PFN_RENDERSYSTEM_RENDERERID, (const void*)); - - auto RenderSystem_RendererID = reinterpret_cast(module.LoadProcedure("LLGL_RenderSystem_RendererID")); - if (RenderSystem_RendererID) - return RenderSystem_RendererID(&renderSystemDesc); - - return RendererID::Undefined; -} - -static const char* LoadRenderSystemName(Module& module, const RenderSystemDescriptor& renderSystemDesc) -{ - /* Load "LLGL_RenderSystem_Name" procedure */ - LLGL_PROC_INTERFACE(const char*, PFN_RENDERSYSTEM_NAME, (const void*)); - - if (auto RenderSystem_Name = reinterpret_cast(module.LoadProcedure("LLGL_RenderSystem_Name"))) - return RenderSystem_Name(&renderSystemDesc); - else - return ""; -} - -static RenderSystem* LoadRenderSystem( - Module& module, - const char* moduleFilename, - const RenderSystemDescriptor& renderSystemDesc, - Report* outReport) -{ - /* Load "LLGL_RenderSystem_Alloc" procedure */ - LLGL_PROC_INTERFACE(void*, PFN_RENDERSYSTEM_ALLOC, (const void*, int)); - - auto RenderSystem_Alloc = reinterpret_cast(module.LoadProcedure("LLGL_RenderSystem_Alloc")); - if (!RenderSystem_Alloc) - return ReportException(outReport, "failed to load 'LLGL_RenderSystem_Alloc' procedure from module: %s", moduleFilename); - - /* Allocate render system */ - auto renderSystem = reinterpret_cast(RenderSystem_Alloc(&renderSystemDesc, static_cast(sizeof(RenderSystemDescriptor)))); - if (!renderSystem) - return ReportException(outReport, "failed to allocate render system from module: %s", moduleFilename); - - /* Check if errors where reported and the render system is unusable */ - if (const Report* report = renderSystem->GetReport()) - { - if (outReport != nullptr) - *outReport = *report; - if (report->HasErrors()) - return nullptr; - } - - return renderSystem; -} - -static RenderSystemDeleter::RenderSystemDeleterFuncPtr LoadRenderSystemDeleter(Module& module) -{ - /* Load "LLGL_RenderSystem_Free" procedure */ - return reinterpret_cast(module.LoadProcedure("LLGL_RenderSystem_Free")); + #if LLGL_BUILD_STATIC_LIB + return StaticModules::GetStaticModules(); + #else + return RenderSystemModule::FindModules(); + #endif } -#endif // /LLGL_BUILD_STATIC_LIB - RenderSystemPtr RenderSystem::Load(const RenderSystemDescriptor& renderSystemDesc, Report* report) { /* Initialize mobile specific states */ @@ -204,7 +88,7 @@ RenderSystemPtr RenderSystem::Load(const RenderSystemDescriptor& renderSystemDes #ifdef LLGL_BUILD_STATIC_LIB /* Allocate render system */ - RenderSystemPtr renderSystem{ StaticModule::AllocRenderSystem(renderSystemDesc) }; + RenderSystemPtr renderSystem{ StaticModules::AllocRenderSystem(renderSystemDesc) }; if (renderSystemDesc.debugger != nullptr) { @@ -221,8 +105,8 @@ RenderSystemPtr RenderSystem::Load(const RenderSystemDescriptor& renderSystemDes #endif // /LLGL_ENABLE_DEBUG_LAYER } - renderSystem->pimpl_->name = StaticModule::GetRendererName(renderSystemDesc.moduleName); - renderSystem->pimpl_->rendererID = StaticModule::GetRendererID(renderSystemDesc.moduleName); + renderSystem->pimpl_->name = StaticModules::GetRendererName(renderSystemDesc.moduleName); + renderSystem->pimpl_->rendererID = StaticModules::GetRendererID(renderSystemDesc.moduleName); /* Return new render system and unique pointer */ return renderSystem; @@ -230,47 +114,29 @@ RenderSystemPtr RenderSystem::Load(const RenderSystemDescriptor& renderSystemDes #else // LLGL_BUILD_STATIC_LIB /* Load render system module */ - const std::string moduleFilename = Module::GetModuleFilename(renderSystemDesc.moduleName.c_str()); - std::unique_ptr module; - - #ifdef LLGL_ENABLE_EXCEPTIONS - - Report moduleReport; - module = Module::Load(moduleFilename.c_str(), &moduleReport); - if (!module) - TrapReport(__FUNCTION__, moduleReport); - - #else - - module = Module::Load(moduleFilename.c_str(), report); - if (!module) + RenderSystemModule* module = RenderSystemRegistry::Get().LoadModule(renderSystemDesc.moduleName.c_str(), report); + if (module == nullptr) return nullptr; - #endif - /* Verify build ID from render system module to detect a module, that has compiled with a different compiler (type, version, debug/release mode etc.) */ - if (!LoadRenderSystemBuildID(*module, moduleFilename, report)) + if (module->BuildID() != LLGL_BUILD_ID) return ReportException(report, "build ID mismatch in render system module"); - #ifdef LLGL_ENABLE_EXCEPTIONS + #if LLGL_ENABLE_EXCEPTIONS try #endif { /* Allocate render system */ - RenderSystemPtr renderSystem - { - LoadRenderSystem(*module, moduleFilename.c_str(), renderSystemDesc, report), - RenderSystemDeleter{ LoadRenderSystemDeleter(*module) } - }; + RenderSystemPtr renderSystem = module->AllocRenderSystem(renderSystemDesc, report); if (renderSystem) { if (renderSystemDesc.debugger != nullptr) { - #ifdef LLGL_ENABLE_DEBUG_LAYER + #if LLGL_ENABLE_DEBUG_LAYER /* Create debug layer render system */ renderSystem = RenderSystemPtr{ new DbgRenderSystem{ std::move(renderSystem), renderSystemDesc.debugger } }; @@ -283,16 +149,16 @@ RenderSystemPtr RenderSystem::Load(const RenderSystemDescriptor& renderSystemDes #endif // /LLGL_ENABLE_DEBUG_LAYER } - renderSystem->pimpl_->name = LoadRenderSystemName(*module,renderSystemDesc); - renderSystem->pimpl_->rendererID = LoadRenderSystemRendererID(*module,renderSystemDesc); + renderSystem->pimpl_->name = module->RendererName(); + renderSystem->pimpl_->rendererID = module->RendererID(); - /* Store new module inside internal map */ - g_renderSystemModules[renderSystem.get()] = std::move(module); + /* Link render system to module */ + RenderSystemRegistry::Get().RegisterRenderSystem(renderSystem.get(), module); } return renderSystem; } - #ifdef LLGL_ENABLE_EXCEPTIONS + #if LLGL_ENABLE_EXCEPTIONS catch (const std::exception& e) { /* Throw with new exception, otherwise the exception's v-table will be corrupted since it's part of the module */ @@ -305,12 +171,11 @@ RenderSystemPtr RenderSystem::Load(const RenderSystemDescriptor& renderSystemDes void RenderSystem::Unload(RenderSystemPtr&& renderSystem) { - auto it = g_renderSystemModules.find(renderSystem.get()); - if (it != g_renderSystemModules.end()) + if (RenderSystem* renderSystemRef = renderSystem.get()) { /* Delete render system first, then release module */ renderSystem.reset(); - g_renderSystemModules.erase(it); + RenderSystemRegistry::Get().UnregisterRenderSystem(renderSystemRef); } } diff --git a/sources/Renderer/RenderSystemModule.cpp b/sources/Renderer/RenderSystemModule.cpp new file mode 100644 index 0000000000..e71df517ac --- /dev/null +++ b/sources/Renderer/RenderSystemModule.cpp @@ -0,0 +1,157 @@ +/* + * RenderSystemModule.cpp + * + * Copyright (c) 2015 Lukas Hermanns. All rights reserved. + * Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). + */ + +#include "RenderSystemModule.h" +#include "../Core/CoreUtils.h" +#include "../Core/Exception.h" +#include "../Core/Assertion.h" +#include + + +namespace LLGL +{ + + +RenderSystemModule::RenderSystemModule( + const char* name, + std::string&& filename, + std::unique_ptr&& module) +: + name_ { name }, + filename_ { std::move(filename) }, + module_ { std::move(module) } +{ + /* Load all procedures from module */ + buildIdProc_ = reinterpret_cast< PFN_RENDERSYSTEM_BUILDID >(module_->LoadProcedure("LLGL_RenderSystem_BuildID" )); + rendererIdProc_ = reinterpret_cast< PFN_RENDERSYSTEM_RENDERERID >(module_->LoadProcedure("LLGL_RenderSystem_RendererID")); + nameProc_ = reinterpret_cast< PFN_RENDERSYSTEM_NAME >(module_->LoadProcedure("LLGL_RenderSystem_Name" )); + allocProc_ = reinterpret_cast< PFN_RENDERSYSTEM_ALLOC >(module_->LoadProcedure("LLGL_RenderSystem_Alloc" )); + freeProc_ = reinterpret_cast< PFN_RENDERSYSTEM_FREE >(module_->LoadProcedure("LLGL_RenderSystem_Free" )); +} + +std::vector RenderSystemModule::FindModules() +{ + /* Iterate over all known modules and return those that are available on the current platform */ + constexpr const char* knownModules[] = + { + "Null", + + #if defined(LLGL_OS_IOS) || defined(LLGL_OS_ANDROID) + "OpenGLES3", + #else + "OpenGL", + #endif + + #if defined(LLGL_OS_MACOS) || defined(LLGL_OS_IOS) + "Metal", + #else + "Vulkan", + #endif + + #if defined(LLGL_OS_WIN32) || defined(LLGL_OS_UWP) + "Direct3D11", + "Direct3D12", + #endif + }; + + std::vector moduleNames; + + for (const char* name : knownModules) + { + std::string moduleFilename = Module::GetModuleFilename(name); + if (Module::IsAvailable(moduleFilename.c_str())) + moduleNames.push_back(name); + } + + return moduleNames; +} + +RenderSystemModulePtr RenderSystemModule::Load(const char* name, Report* outReport) +{ + /* Load render system module */ + std::string moduleFilename = Module::GetModuleFilename(name); + std::unique_ptr module; + + #if LLGL_ENABLE_EXCEPTIONS + + Report moduleReport; + module = Module::Load(moduleFilename.c_str(), &moduleReport); + if (!module) + TrapReport(__FUNCTION__, moduleReport); + + #else // LLGL_ENABLE_EXCEPTIONS + + module = Module::Load(moduleFilename.c_str(), outReport); + if (!module) + return nullptr; + + #endif // /LLGL_ENABLE_EXCEPTIONS + + /* Allocate new module wrapper */ + return RenderSystemModulePtr{ new RenderSystemModule{ name, std::move(moduleFilename), std::move(module) } }; +} + +int RenderSystemModule::BuildID() +{ + return (buildIdProc_ != nullptr ? buildIdProc_() : 0); +} + +int RenderSystemModule::RendererID() +{ + return (rendererIdProc_ != nullptr ? rendererIdProc_() : RendererID::Undefined); +} + +const char* RenderSystemModule::RendererName() +{ + if (nameProc_ != nullptr) + { + if (const char* name = nameProc_()) + return name; + } + return ""; // fallback to empty string +} + +RenderSystemPtr RenderSystemModule::AllocRenderSystem(const RenderSystemDescriptor& renderSystemDesc, Report* outReport) +{ + /* Allocate render system */ + if (!allocProc_) + return ReportException(outReport, "failed to load 'LLGL_RenderSystem_Alloc' procedure from module: %s", filename_.c_str()); + + auto* renderSystem = reinterpret_cast(allocProc_(&renderSystemDesc, static_cast(sizeof(renderSystemDesc)))); + if (!renderSystem) + return ReportException(outReport, "failed to allocate render system from module: %s", filename_.c_str()); + + /* Check if errors where reported and the render system is unusable */ + if (const Report* report = renderSystem->GetReport()) + { + if (outReport != nullptr) + *outReport = *report; + if (report->HasErrors()) + return nullptr; + } + + /* Wrap raw-pointer into managed pointer using optional custom deleter */ + return RenderSystemPtr{ renderSystem, reinterpret_cast(freeProc_) }; +} + +void RenderSystemModule::AddRef() +{ + ++useCount_; +} + +unsigned RenderSystemModule::Release() +{ + LLGL_ASSERT(useCount_ > 0); + return --useCount_; +} + + +} // /namespace LLGL + + + +// ================================================================================ diff --git a/sources/Renderer/RenderSystemModule.h b/sources/Renderer/RenderSystemModule.h new file mode 100644 index 0000000000..ffdf5166d8 --- /dev/null +++ b/sources/Renderer/RenderSystemModule.h @@ -0,0 +1,120 @@ +/* + * RenderSystemModule.h + * + * Copyright (c) 2015 Lukas Hermanns. All rights reserved. + * Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). + */ + +#ifndef LLGL_RENDER_SYSTEM_MODULE_H +#define LLGL_RENDER_SYSTEM_MODULE_H + + +#include "../Platform/Module.h" +#include +#include +#include +#include + + +namespace LLGL +{ + + +class Report; +class RenderSystemModule; + +using RenderSystemModulePtr = std::unique_ptr; + +// Wrapper for the RenderSystem module object and interface procedures. +class RenderSystemModule +{ + + public: + + RenderSystemModule(const RenderSystemModule&) = delete; + RenderSystemModule& operator = (const RenderSystemModule&) = delete; + + public: + + // Returns a name list of available render system modules. + static std::vector FindModules(); + + // Loads the specified render system module. Returns null on failure. + static RenderSystemModulePtr Load(const char* name, Report* outReport = nullptr); + + // Returns true if this module is valid and initialized. + inline bool IsValid() const + { + return (module_.get() != nullptr); + } + + // Returns the module name, e.g. "Direct3D12". + inline const std::string& GetName() const + { + return name_; + } + + // Returns the module filename, e.g. "LLGL_Direct3D12D.dll". + inline const std::string& GetFilename() const + { + return filename_; + } + + // Returns the build ID of the render system or 0 if the procedure could not be loaded. + int BuildID(); + + // Returns the renderer ID (LLGL::RendererID) or 0 if the procedure could not be loaded. + int RendererID(); + + // Returns the renderer name or an empty string if the procedure could not be loaded. + const char* RendererName(); + + // Allocates a new RenderSystem interface from this module and returns its managed pointer. + RenderSystemPtr AllocRenderSystem(const RenderSystemDescriptor& renderSystemDesc, Report* outReport = nullptr); + + // Increments the use counter. The initial use counter is 0. + void AddRef(); + + // Decrements and returns the new use counter. + unsigned Release(); + + private: + + LLGL_PROC_INTERFACE(int, PFN_RENDERSYSTEM_BUILDID, (void)); + LLGL_PROC_INTERFACE(int, PFN_RENDERSYSTEM_RENDERERID, (void)); + LLGL_PROC_INTERFACE(const char*, PFN_RENDERSYSTEM_NAME, (void)); + LLGL_PROC_INTERFACE(void*, PFN_RENDERSYSTEM_ALLOC, (const void*, int)); + LLGL_PROC_INTERFACE(void, PFN_RENDERSYSTEM_FREE, (void*)); + + private: + + RenderSystemModule( + const char* name, + std::string&& filename, + std::unique_ptr&& module + ); + + private: + + std::string name_; + std::string filename_; + std::unique_ptr module_; + unsigned useCount_ = 0; + + PFN_RENDERSYSTEM_BUILDID buildIdProc_ = nullptr; + PFN_RENDERSYSTEM_RENDERERID rendererIdProc_ = nullptr; + PFN_RENDERSYSTEM_NAME nameProc_ = nullptr; + PFN_RENDERSYSTEM_ALLOC allocProc_ = nullptr; + PFN_RENDERSYSTEM_FREE freeProc_ = nullptr; + +}; + + +} // /namespace LLGL + + +#endif + + + +// ================================================================================ diff --git a/sources/Renderer/RenderSystemRegistry.cpp b/sources/Renderer/RenderSystemRegistry.cpp new file mode 100644 index 0000000000..67886ed8ba --- /dev/null +++ b/sources/Renderer/RenderSystemRegistry.cpp @@ -0,0 +1,94 @@ +/* + * RenderSystemRegistry.cpp + * + * Copyright (c) 2015 Lukas Hermanns. All rights reserved. + * Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). + */ + +#include "RenderSystemRegistry.h" +#include "../Core/CoreUtils.h" + + +namespace LLGL +{ + + + RenderSystemRegistry& RenderSystemRegistry::Get() +{ + static RenderSystemRegistry instance; + return instance; +} + +RenderSystemModule* RenderSystemRegistry::LoadModule(const char* name, Report* outReport) +{ + /* Check if module has already been loaded */ + for (const RenderSystemModulePtr& module : modules_) + { + if (module->GetName() == name) + return module.get(); + } + + /* Load new render system module */ + if (RenderSystemModulePtr module = RenderSystemModule::Load(name, outReport)) + { + modules_.push_back(std::move(module)); + return modules_.back().get(); + } + return nullptr; +} + +bool RenderSystemRegistry::RegisterRenderSystem(RenderSystem* renderSystem, RenderSystemModule* module) +{ + for (const RenderSystemModulePtr& moduleEntry : modules_) + { + if (moduleEntry.get() == module) + { + /* Increment module use count and register render system */ + module->AddRef(); + renderSystemEntries_.push_back(RenderSystemEntry{ renderSystem, module }); + return true; + } + } + return false; +} + +bool RenderSystemRegistry::UnregisterRenderSystem(RenderSystem* renderSystem) +{ + /* + Search through two lists linearly as these lists are usually very small (only 1 element most of the time). + Worst case has still O(2n) complexity only. + */ + for (auto it = renderSystemEntries_.begin(); it != renderSystemEntries_.end(); ++it) + { + if (it->renderSystem == renderSystem) + { + ReleaseModule(it->renderSystemModule); + renderSystemEntries_.erase(it); + return true; + } + } + return false; +} + +void RenderSystemRegistry::ReleaseModule(RenderSystemModule* module) +{ + /* Decrement module use count and delete entry if no longer used */ + if (module->Release() == 0) + { + for (auto it = modules_.begin(); it != modules_.end(); ++it) + { + if (it->get() == module) + { + modules_.erase(it); + break; + } + } + } +} + + +} // /namespace LLGL + + + +// ================================================================================ diff --git a/sources/Renderer/RenderSystemRegistry.h b/sources/Renderer/RenderSystemRegistry.h new file mode 100644 index 0000000000..7aa2a3b1ab --- /dev/null +++ b/sources/Renderer/RenderSystemRegistry.h @@ -0,0 +1,72 @@ +/* + * RenderSystemRegistry.h + * + * Copyright (c) 2015 Lukas Hermanns. All rights reserved. + * Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). + */ + +#ifndef LLGL_RENDER_SYSTEM_MODULE_REGISTRY_H +#define LLGL_RENDER_SYSTEM_MODULE_REGISTRY_H + + +#include "RenderSystemModule.h" +#include +#include + + +namespace LLGL +{ + + +class Report; +class RenderSystem; + +// Wrapper for the RenderSystem module object and interface procedures. +class RenderSystemRegistry +{ + + public: + + RenderSystemRegistry(const RenderSystemRegistry&) = delete; + RenderSystemRegistry& operator = (const RenderSystemRegistry&) = delete; + + public: + + static RenderSystemRegistry& Get(); + + // Loads a render system module, e.g. "Direct3D11" or returns null if + RenderSystemModule* LoadModule(const char* name, Report* outReport = nullptr); + + bool RegisterRenderSystem(RenderSystem* renderSystem, RenderSystemModule* module); + bool UnregisterRenderSystem(RenderSystem* renderSystem); + + private: + + struct RenderSystemEntry + { + RenderSystem* renderSystem = nullptr; + RenderSystemModule* renderSystemModule = nullptr; + }; + + private: + + RenderSystemRegistry() = default; + + void ReleaseModule(RenderSystemModule* module); + + private: + + std::vector modules_; + SmallVector renderSystemEntries_; + +}; + + +} // /namespace LLGL + + +#endif + + + +// ================================================================================ diff --git a/sources/Renderer/StaticModuleInterface.cpp b/sources/Renderer/StaticModuleInterface.cpp index ce5e46296a..584f49d128 100644 --- a/sources/Renderer/StaticModuleInterface.cpp +++ b/sources/Renderer/StaticModuleInterface.cpp @@ -60,7 +60,7 @@ LLGL_DECLARE_STATIC_MODULE_INTERFACE(Direct3D12); #endif -namespace StaticModule +namespace StaticModules { @@ -225,7 +225,7 @@ RenderSystem* AllocRenderSystem(const RenderSystemDescriptor& renderSystemDesc) } -} // /namespace StaticModule +} // /namespace StaticModules } // /namespace LLGL diff --git a/sources/Renderer/StaticModuleInterface.h b/sources/Renderer/StaticModuleInterface.h index 8c89523920..2db14fe0fe 100644 --- a/sources/Renderer/StaticModuleInterface.h +++ b/sources/Renderer/StaticModuleInterface.h @@ -8,7 +8,7 @@ #ifndef LLGL_STATIC_MODULE_INTERFACE_H #define LLGL_STATIC_MODULE_INTERFACE_H -#ifdef LLGL_BUILD_STATIC_LIB +#if LLGL_BUILD_STATIC_LIB #include @@ -20,7 +20,7 @@ namespace LLGL class RenderSystem; -namespace StaticModule +namespace StaticModules { @@ -37,7 +37,7 @@ int GetRendererID(const std::string& moduleName); RenderSystem* AllocRenderSystem(const RenderSystemDescriptor& renderSystemDesc); -} // /namespace StaticModule +} // /namespace StaticModules } // /namespace LLGL