Apply clang-format across the whole tree
Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs, Allman functions) over every source file so the tree is formatter-clean. Whitespace only -- no behavior change; full x64 + x86 suites pass. Also set SortIncludes: false in .clang-format. Windows include order is load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h / dinput.h; winsock2.h must precede windows.h), and the default alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build break. Leaving order alone keeps the manual, correct grouping.
This commit is contained in:
@@ -12,21 +12,17 @@
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
namespace coop::mock
|
||||
{
|
||||
namespace
|
||||
{
|
||||
class GlBackend : public RenderBackend
|
||||
{
|
||||
public:
|
||||
namespace coop::mock {
|
||||
namespace {
|
||||
class GlBackend : public RenderBackend {
|
||||
public:
|
||||
bool init(HWND hwnd, std::uint32_t width, std::uint32_t height) override
|
||||
{
|
||||
width_ = width;
|
||||
height_ = height;
|
||||
hwnd_ = hwnd;
|
||||
hdc_ = GetDC(hwnd);
|
||||
if (hdc_ == nullptr)
|
||||
{
|
||||
if (hdc_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
PIXELFORMATDESCRIPTOR pfd = {};
|
||||
@@ -38,20 +34,17 @@ public:
|
||||
pfd.cAlphaBits = 8;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
const int pf = ChoosePixelFormat(hdc_, &pfd);
|
||||
if (pf == 0 || !SetPixelFormat(hdc_, pf, &pfd))
|
||||
{
|
||||
if (pf == 0 || !SetPixelFormat(hdc_, pf, &pfd)) {
|
||||
return false;
|
||||
}
|
||||
hglrc_ = wglCreateContext(hdc_); // legacy context is enough for GL 1.1 clears
|
||||
if (hglrc_ == nullptr || !wglMakeCurrent(hdc_, hglrc_))
|
||||
{
|
||||
if (hglrc_ == nullptr || !wglMakeCurrent(hdc_, hglrc_)) {
|
||||
return false;
|
||||
}
|
||||
// Uncapped: the mock is a perf fixture and must run as fast as it can (disable vsync), so a
|
||||
// capture-induced slowdown is visible. Runtime extension lookup -- no loader/submodule needed.
|
||||
using PFN_wglSwapIntervalEXT = BOOL(WINAPI*)(int);
|
||||
if (auto swap_interval = reinterpret_cast<PFN_wglSwapIntervalEXT>(wglGetProcAddress("wglSwapIntervalEXT")))
|
||||
{
|
||||
if (auto swap_interval = reinterpret_cast<PFN_wglSwapIntervalEXT>(wglGetProcAddress("wglSwapIntervalEXT"))) {
|
||||
swap_interval(0);
|
||||
}
|
||||
return true;
|
||||
@@ -87,25 +80,20 @@ public:
|
||||
SwapBuffers(hdc_); // the capture hook intercepts this
|
||||
}
|
||||
|
||||
[[nodiscard]] const char* name() const override
|
||||
{
|
||||
return "gl";
|
||||
}
|
||||
[[nodiscard]] const char* name() const override { return "gl"; }
|
||||
|
||||
~GlBackend() override
|
||||
{
|
||||
wglMakeCurrent(nullptr, nullptr);
|
||||
if (hglrc_ != nullptr)
|
||||
{
|
||||
if (hglrc_ != nullptr) {
|
||||
wglDeleteContext(hglrc_);
|
||||
}
|
||||
if (hdc_ != nullptr && hwnd_ != nullptr)
|
||||
{
|
||||
if (hdc_ != nullptr && hwnd_ != nullptr) {
|
||||
ReleaseDC(hwnd_, hdc_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
std::uint32_t width_ = 0;
|
||||
std::uint32_t height_ = 0;
|
||||
HWND hwnd_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user