From 4312ecd1726a059c41c763f4f8386eae791cb470 Mon Sep 17 00:00:00 2001 From: Patedam Date: Sun, 22 Feb 2026 22:22:42 -0500 Subject: [PATCH] Fix crash on linux with proton --- Juliet/src/Core/HAL/OS/Win32/Win32OS.cpp | 18 ++++++++++++++---- .../src/Graphics/D3D12/D3D12GraphicsDevice.cpp | 6 ------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Juliet/src/Core/HAL/OS/Win32/Win32OS.cpp b/Juliet/src/Core/HAL/OS/Win32/Win32OS.cpp index 64caf9d..d20547c 100644 --- a/Juliet/src/Core/HAL/OS/Win32/Win32OS.cpp +++ b/Juliet/src/Core/HAL/OS/Win32/Win32OS.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include namespace Juliet { @@ -25,8 +27,12 @@ namespace Juliet Assert(size <= static_cast(MaxValueOf())); - w32_rio_functions.RIODeregisterBuffer( - w32_rio_functions.RIORegisterBuffer(reinterpret_cast(ptr), static_cast(size))); + if (w32_rio_functions.RIORegisterBuffer != nullptr && w32_rio_functions.RIODeregisterBuffer != nullptr) + { + w32_rio_functions.RIODeregisterBuffer( + w32_rio_functions.RIORegisterBuffer(reinterpret_cast(ptr), static_cast(size))); + } + return result; } @@ -81,8 +87,12 @@ namespace Juliet GUID guid = WSAID_MULTIPLE_RIO; DWORD rio_byte = 0; SOCKET Sock = socket(AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); - WSAIoctl(Sock, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER, &guid, sizeof(guid), - (void**)&w32_rio_functions, sizeof(w32_rio_functions), &rio_byte, nullptr, nullptr); + int result = WSAIoctl(Sock, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER, &guid, sizeof(guid), + (void**)&w32_rio_functions, sizeof(w32_rio_functions), &rio_byte, nullptr, nullptr); + if (result != 0) + { + LogError(LogCategory::Core, "Couldnt get w32 RIO Functions. Error code %d", result); + } closesocket(Sock); } diff --git a/Juliet/src/Graphics/D3D12/D3D12GraphicsDevice.cpp b/Juliet/src/Graphics/D3D12/D3D12GraphicsDevice.cpp index d9d17eb..17698a8 100644 --- a/Juliet/src/Graphics/D3D12/D3D12GraphicsDevice.cpp +++ b/Juliet/src/Graphics/D3D12/D3D12GraphicsDevice.cpp @@ -23,12 +23,6 @@ #define D3D12_CREATEDEVICE_FUNC "D3D12CreateDevice" #define D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE_FUNC "D3D12SerializeVersionedRootSignature" -extern "C" { -// Used to enable the "Agility SDK" components -__declspec(dllexport) extern const unsigned int D3D12SDKVersion = 615; -__declspec(dllexport) extern const char* D3D12SDKPath = ".\\D3D12\\"; -} - // TODO : Use LoadLibrary and not link to the lib. Allows failing earlier if Dx12 is not installed for some reason // + Will load the dll when needed // This will prevent us from using IID_ variables as they are defined in dxguid.lib