17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 15:39:20 +02:00
Files
maszyna/betterRenderer/eu07_source/register.cpp
maj00r 61b3ec6f3f parse windows.h before any import reaches betterRenderer
Six module interfaces carry windows.h in their fragment, and a fragment's
include guard does not cross the boundary, so a unit that imported first
and included the SDK afterwards parsed it twice: clang reports it as
conflicting redeclarations of BroadcastSystemMessageEx and mismatched
uuids all through the SDK. Same shape as the basic_filebuf failure, one
level further out - the header arrives through d3d12.h, not directly.

Thirty units get a guarded windows.h ahead of everything; on Linux it is
a no-op. Vendored single-header libraries are left alone, and the block
goes after a BOM rather than before it.
2026-09-10 15:40:52 +02:00

48 lines
1.5 KiB
C++

#ifdef _WIN32
#include <windows.h> // before any import: its guard must be set here
#endif
#include <memory>
#include "nvrenderer/nvrenderer.h"
#include <array>
#include <chrono>
#include <cstddef>
#include <deque>
#include <limits>
#include <mutex>
#include <ostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
import eu07.utilities.logs;
namespace {
std::unique_ptr<gfx_renderer> create_nvrenderer_for_d3d12() {
return std::make_unique<NvRenderer>(NvRenderer::Api::D3D12);
}
std::unique_ptr<gfx_renderer> create_nvrenderer_for_vulkan() {
return std::make_unique<NvRenderer>(NvRenderer::Api::Vulkan);
}
std::unique_ptr<gfx_renderer> create_nvrenderer_default() {
#if LIBMANUL_WITH_D3D12
return std::make_unique<NvRenderer>(NvRenderer::Api::D3D12);
#elif LIBMANUL_WITH_VULKAN
return std::make_unique<NvRenderer>(NvRenderer::Api::Vulkan);
#endif
ErrorLog("Failed to initialize any NVRHI Renderer");
return nullptr;
}
} // namespace
bool register_manul_d3d12 =
LIBMANUL_WITH_D3D12 &&
gfx_renderer_factory::get_instance()->register_backend(
"experimental_d3d12", &create_nvrenderer_for_d3d12);
bool register_manul_vulkan =
LIBMANUL_WITH_VULKAN &&
gfx_renderer_factory::get_instance()->register_backend(
"experimental_vk", &create_nvrenderer_for_vulkan);
bool register_manul = gfx_renderer_factory::get_instance()->register_backend(
"experimental", &create_nvrenderer_default);