From cded7e8d6cb9fa2f1077ead4ead20faf8c3a53dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 10 Jan 2026 09:39:37 -0800 Subject: [PATCH] Fixed amalgamated build. (#3546) --- src/bgfx.cpp | 8 +++++-- src/renderer_webgpu.cpp | 48 +++++++++++++++++++---------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index c41662417..4f7056530 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -2734,8 +2734,12 @@ namespace bgfx void* findModule(const char* _name) { #if BX_PLATFORM_WINDOWS - // NOTE: there was some reason to do it this way instead of simply calling GetModuleHandleA, - // but not sure what it was. + if (NULL == _name + || '\0' == *_name) + { + return GetModuleHandleA(NULL); + } + HANDLE process = GetCurrentProcess(); DWORD size; BOOL result = EnumProcessModules(process diff --git a/src/renderer_webgpu.cpp b/src/renderer_webgpu.cpp index dc4123e75..fb48f86b9 100644 --- a/src/renderer_webgpu.cpp +++ b/src/renderer_webgpu.cpp @@ -373,24 +373,24 @@ namespace bgfx { namespace wgpu { #define LANGUAGE_FEATURE(_name) WGPUWGSLLanguageFeatureName_##_name, #_name - { LANGUAGE_FEATURE(ReadonlyAndReadwriteStorageTextures), true, false }, - { LANGUAGE_FEATURE(Packed4x8IntegerDotProduct), true, false }, - { LANGUAGE_FEATURE(UnrestrictedPointerParameters), true, false }, - { LANGUAGE_FEATURE(PointerCompositeAccess), true, false }, - { LANGUAGE_FEATURE(UniformBufferStandardLayout), true, false }, - { LANGUAGE_FEATURE(SubgroupId), true, false }, - { LANGUAGE_FEATURE(ChromiumTestingUnimplemented), true, false }, - { LANGUAGE_FEATURE(ChromiumTestingUnsafeExperimental), true, false }, - { LANGUAGE_FEATURE(ChromiumTestingExperimental), true, false }, + { LANGUAGE_FEATURE(ReadonlyAndReadwriteStorageTextures), true, false }, + { LANGUAGE_FEATURE(Packed4x8IntegerDotProduct), true, false }, + { LANGUAGE_FEATURE(UnrestrictedPointerParameters), true, false }, + { LANGUAGE_FEATURE(PointerCompositeAccess), true, false }, + { LANGUAGE_FEATURE(UniformBufferStandardLayout), true, false }, + { LANGUAGE_FEATURE(SubgroupId), true, false }, + { LANGUAGE_FEATURE(ChromiumTestingUnimplemented), true, false }, + { LANGUAGE_FEATURE(ChromiumTestingUnsafeExperimental), true, false }, + { LANGUAGE_FEATURE(ChromiumTestingExperimental), true, false }, { LANGUAGE_FEATURE(ChromiumTestingShippedWithKillswitch), true, false }, - { LANGUAGE_FEATURE(ChromiumTestingShipped), true, false }, - { LANGUAGE_FEATURE(SizedBindingArray), true, false }, - { LANGUAGE_FEATURE(TexelBuffers), true, false }, - { LANGUAGE_FEATURE(ChromiumPrint), true, false }, - { LANGUAGE_FEATURE(FragmentDepth), true, false }, - { LANGUAGE_FEATURE(ImmediateAddressSpace), true, false }, - { LANGUAGE_FEATURE(SubgroupUniformity), true, false }, - { LANGUAGE_FEATURE(TextureAndSamplerLet), true, false }, + { LANGUAGE_FEATURE(ChromiumTestingShipped), true, false }, + { LANGUAGE_FEATURE(SizedBindingArray), true, false }, + { LANGUAGE_FEATURE(TexelBuffers), true, false }, + { LANGUAGE_FEATURE(ChromiumPrint), true, false }, + { LANGUAGE_FEATURE(FragmentDepth), true, false }, + { LANGUAGE_FEATURE(ImmediateAddressSpace), true, false }, + { LANGUAGE_FEATURE(SubgroupUniformity), true, false }, + { LANGUAGE_FEATURE(TextureAndSamplerLet), true, false }, #undef LANGUAGE_FEATURE }; @@ -4602,10 +4602,6 @@ m_resolution.formatColor = TextureFormat::BGRA8; } #endif // BX_PLATFORM_OSX || BX_PLATFORM_IOS || BX_PLATFORM_TVOS || BX_PLATFORM_VISIONOS -#if BX_PLATFORM_WINDOWS -extern "C" void* __stdcall GetModuleHandleA(const char* _moduleName); -#endif // BX_PLATFORM_WINDOWS - bool SwapChainWGPU::createSurface(void* _nwh) { m_nwh = _nwh; @@ -4620,7 +4616,7 @@ extern "C" void* __stdcall GetModuleHandleA(const char* _moduleName); .next = NULL, .sType = WGPUSType_SurfaceSourceWindowsHWND, }, - .hinstance = GetModuleHandleA(NULL), + .hinstance = findModule(""), .hwnd = m_nwh, }; @@ -4630,7 +4626,7 @@ extern "C" void* __stdcall GetModuleHandleA(const char* _moduleName); .label = toWGPUStringView("SwapChainWGPU"), }; #elif BX_PLATFORM_LINUX - WGPUSurfaceSourceXlibWindow sufraceSourceXlib = + WGPUSurfaceSourceXlibWindow surfaceSourceXlib = { .chain = { @@ -4641,7 +4637,7 @@ extern "C" void* __stdcall GetModuleHandleA(const char* _moduleName); .window = uint64_t(m_nwh), }; - WGPUSurfaceSourceWaylandSurface sufraceSourceWayland = + WGPUSurfaceSourceWaylandSurface surfaceSourceWayland = { .chain = { @@ -4655,8 +4651,8 @@ extern "C" void* __stdcall GetModuleHandleA(const char* _moduleName); surfaceDesc = { .nextInChain = g_platformData.type == bgfx::NativeWindowHandleType::Wayland - ? &sufraceSourceWayland.chain - : &sufraceSourceXlib.chain + ? &surfaceSourceWayland.chain + : &surfaceSourceXlib.chain , .label = toWGPUStringView("SwapChainWGPU"), };