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:
2026-07-12 11:52:53 +02:00
parent c684a15fb9
commit 30eccf749d
155 changed files with 3333 additions and 6171 deletions

View File

@@ -13,20 +13,17 @@
using Microsoft::WRL::ComPtr;
namespace coop::mock
{
namespace
{
namespace coop::mock {
namespace {
std::uint32_t pack(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a = 255)
{
// R8G8B8A8_UNORM byte order: R in the low byte.
return static_cast<std::uint32_t>(r) | (static_cast<std::uint32_t>(g) << 8) |
(static_cast<std::uint32_t>(b) << 16) | (static_cast<std::uint32_t>(a) << 24);
return static_cast<std::uint32_t>(r) | (static_cast<std::uint32_t>(g) << 8) | (static_cast<std::uint32_t>(b) << 16)
| (static_cast<std::uint32_t>(a) << 24);
}
class Dx10Backend : public RenderBackend
{
public:
class Dx10Backend : public RenderBackend {
public:
bool init(HWND hwnd, std::uint32_t width, std::uint32_t height) override
{
width_ = width;
@@ -46,10 +43,8 @@ public:
desc.Windowed = TRUE;
desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // blt model: GetBuffer(0) is the back buffer
if (FAILED(D3D10CreateDeviceAndSwapChain(nullptr, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0,
D3D10_SDK_VERSION, &desc, swap_.GetAddressOf(),
device_.GetAddressOf())))
{
if (FAILED(D3D10CreateDeviceAndSwapChain(nullptr, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, D3D10_SDK_VERSION,
&desc, swap_.GetAddressOf(), device_.GetAddressOf()))) {
return false;
}
@@ -75,18 +70,14 @@ public:
const std::uint32_t code = pack(p.code_r, p.code_g, p.code_b);
const std::uint32_t bx = p.bar_x; // moving vertical bar
for (std::uint32_t y = 0; y < height_; ++y)
{
for (std::uint32_t y = 0; y < height_; ++y) {
std::uint32_t* row = px_.data() + static_cast<std::size_t>(y) * width_;
for (std::uint32_t x = 0; x < width_; ++x)
{
for (std::uint32_t x = 0; x < width_; ++x) {
std::uint32_t c = bg;
if (x >= bx && x < bx + kBarWidth)
{
if (x >= bx && x < bx + kBarWidth) {
c = whitepx;
}
if (x < kFrameBlock && y < kFrameBlock)
{
if (x < kFrameBlock && y < kFrameBlock) {
c = code; // top-left frame-counter block
}
row[x] = c;
@@ -95,19 +86,15 @@ public:
device_->UpdateSubresource(scratch_.Get(), 0, nullptr, px_.data(), static_cast<UINT>(width_ * 4), 0);
ComPtr<ID3D10Texture2D> back;
if (SUCCEEDED(swap_->GetBuffer(0, IID_PPV_ARGS(back.GetAddressOf()))))
{
if (SUCCEEDED(swap_->GetBuffer(0, IID_PPV_ARGS(back.GetAddressOf())))) {
device_->CopyResource(back.Get(), scratch_.Get());
}
swap_->Present(0, 0); // uncapped (BLT model): the mock does nothing -> it must be fast
}
[[nodiscard]] const char* name() const override
{
return "dx10";
}
[[nodiscard]] const char* name() const override { return "dx10"; }
private:
private:
std::uint32_t width_ = 0;
std::uint32_t height_ = 0;
std::vector<std::uint32_t> px_;