Files
CoopAllTheThings/tools/mock_game/render_backend.cpp
BlackMark 49daa1d81f M2(Vulkan): Vulkan mock-game backend + volk/Vulkan-Headers submodules
Add render_vk.cpp (selectable as `vk`): brings up a real Vulkan
instance/device/swap chain via volk (which dlopens vulkan-1.dll -- the
loader-bypass case the capture hook must handle) and clears the swap-chain image
to the frame-counter colour each frame with vkCmdClearColorImage (no pipeline,
no shaders, no SPIR-V) and presents. The whole image encodes the frame number,
so it animates and stale frames are detectable.

Adds the official Khronos Vulkan-Headers + zeux/volk submodules and a
coop_require_submodule() CMake helper that fails with a clear "git submodule
update --init --recursive" message rather than auto-cloning. volk is pinned to
the project's dynamic CRT (no LNK4098).

mock_game_test gets a vk liveness check (its present pointer is cached at init,
so late injection can't hook it -- the capture path needs the early-load path,
to come). 16/16 ctest, skips cleanly without a Vulkan driver.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 12:12:55 +02:00

40 lines
647 B
C++

#include "render_backend.hpp"
namespace coop::mock
{
std::unique_ptr<RenderBackend> RenderBackend::create(const std::string& name)
{
if (name == "dx11")
{
return create_dx11_backend();
}
if (name == "dx12")
{
return create_dx12_backend();
}
if (name == "dx10")
{
return create_dx10_backend();
}
if (name == "dx9ex")
{
return create_dx9_backend(/*ex=*/true);
}
if (name == "dx9")
{
return create_dx9_backend(/*ex=*/false);
}
if (name == "gl" || name == "opengl")
{
return create_gl_backend();
}
if (name == "vk" || name == "vulkan")
{
return create_vk_backend();
}
return nullptr;
}
} // namespace coop::mock