Chore: run clang-format

```bash
find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i
```
This commit is contained in:
李通洲
2026-03-29 09:28:49 +08:00
parent cdd4cee968
commit e0eba8ce21
690 changed files with 28093 additions and 30062 deletions
+25 -30
View File
@@ -1,5 +1,4 @@
extern "C"
{
extern "C" {
#include "gpu.h"
#include "common/library.h"
#include "common/debug.h"
@@ -7,16 +6,16 @@ extern "C"
#if __has_include(<directx/dxcore.h>) && __has_include(<dxguids/dxguids.h>)
#include <directx/dxcore.h>
#include <dxguids/dxguids.h>
#include "common/windows/util.hpp"
# include <directx/dxcore.h>
# include <dxguids/dxguids.h>
# include "common/windows/util.hpp"
static IDXCoreAdapterFactory* loadDxCoreFactory()
{
static IDXCoreAdapterFactory* loadDxCoreFactory() {
static bool initialized = false;
static IDXCoreAdapterFactory* factory = nullptr;
if (initialized)
if (initialized) {
return factory; // Already loaded
}
initialized = true;
FF_LIBRARY_LOAD(dxcore, NULL, "dxcore" FF_LIBRARY_EXTENSION, 1)
@@ -24,16 +23,17 @@ static IDXCoreAdapterFactory* loadDxCoreFactory()
// DXCoreCreateAdapterFactory is a reloaded function, so we can't use FF_LIBRARY_LOAD_SYMBOL_MESSAGE here
typedef HRESULT (*DXCoreCreateAdapterFactory_t)(REFIID riid, void** ppvFactory);
#ifndef FF_DISABLE_DLOPEN
auto ffDXCoreCreateAdapterFactory = (DXCoreCreateAdapterFactory_t) dlsym(dxcore, "DXCoreCreateAdapterFactory");
if (ffDXCoreCreateAdapterFactory == nullptr) return NULL;
#else
auto ffDXCoreCreateAdapterFactory = (DXCoreCreateAdapterFactory_t) DXCoreCreateAdapterFactory;
#endif
# ifndef FF_DISABLE_DLOPEN
auto ffDXCoreCreateAdapterFactory = (DXCoreCreateAdapterFactory_t) dlsym(dxcore, "DXCoreCreateAdapterFactory");
if (ffDXCoreCreateAdapterFactory == nullptr) {
return NULL;
}
# else
auto ffDXCoreCreateAdapterFactory = (DXCoreCreateAdapterFactory_t) DXCoreCreateAdapterFactory;
# endif
HRESULT hr = ffDXCoreCreateAdapterFactory(IID_PPV_ARGS(&factory));
if (FAILED(hr))
{
if (FAILED(hr)) {
FF_DEBUG("DXCoreCreateAdapterFactory failed with HRESULT: 0x%08lX (%s)", hr, ffDebugHResult(hr));
return NULL;
}
@@ -42,27 +42,24 @@ static IDXCoreAdapterFactory* loadDxCoreFactory()
return factory;
}
extern "C"
const char* ffGPUDetectTypeWithDXCore(LUID adapterLuid, FFGPUResult* gpu)
{
extern "C" const char* ffGPUDetectTypeWithDXCore(LUID adapterLuid, FFGPUResult* gpu) {
auto* factory = loadDxCoreFactory();
if (!factory)
if (!factory) {
return "Failed to load DXCore library or create adapter factory";
}
IDXCoreAdapter *adapter = nullptr;
IDXCoreAdapter* adapter = nullptr;
HRESULT hr = factory->GetAdapterByLuid(adapterLuid, IID_PPV_ARGS(&adapter));
if (FAILED(hr))
{
if (FAILED(hr)) {
FF_DEBUG("GetAdapterByLuid failed with HRESULT: 0x%08lX (%s)", hr, ffDebugHResult(hr));
return "Failed to get adapter by LUID";
}
on_scope_exit releaseAdapter {[adapter] { adapter->Release(); }};
on_scope_exit releaseAdapter{[adapter] { adapter->Release(); }};
bool isIntegrated = false;
hr = adapter->GetProperty(DXCoreAdapterProperty::IsIntegrated, sizeof(isIntegrated), &isIntegrated);
if (FAILED(hr))
{
if (FAILED(hr)) {
FF_DEBUG("GetProperty(IsIntegrated) failed with HRESULT: 0x%08lX (%s)", hr, ffDebugHResult(hr));
return "Failed to get adapter properties";
}
@@ -75,11 +72,9 @@ const char* ffGPUDetectTypeWithDXCore(LUID adapterLuid, FFGPUResult* gpu)
#else
#warning "DXCore headers not available, GPU type detection may be less accurate"
# warning "DXCore headers not available, GPU type detection may be less accurate"
extern "C"
const char* ffGPUDetectTypeWithDXCore(LUID adapterLuid, FFGPUResult* gpu)
{
extern "C" const char* ffGPUDetectTypeWithDXCore(LUID adapterLuid, FFGPUResult* gpu) {
FF_UNUSED(adapterLuid, gpu);
FF_DEBUG("DXCore not available, skipping GPU type detection with DXCore");
return "DXCore not available";