From 24c3ec235ac4eb44d4fdfa643195f70dd992f390 Mon Sep 17 00:00:00 2001 From: ftphikari Date: Wed, 12 Jul 2023 00:56:01 +0300 Subject: [PATCH 1/8] [vendor:directx/d3d_compiler] Added default include file handler --- vendor/directx/d3d_compiler/d3d_compiler.odin | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vendor/directx/d3d_compiler/d3d_compiler.odin b/vendor/directx/d3d_compiler/d3d_compiler.odin index e4a7d8df4..e2469c569 100644 --- a/vendor/directx/d3d_compiler/d3d_compiler.odin +++ b/vendor/directx/d3d_compiler/d3d_compiler.odin @@ -149,6 +149,9 @@ ID3DInclude_VTable :: struct { Close: proc "stdcall" (this: ^ID3DInclude, pData: rawptr) -> HRESULT, } +// Default file includer +D3DCOMPILE_STANDARD_FILE_INCLUDE :: cast(^ID3DInclude)uintptr(1) + ID3D11Module :: struct #raw_union { #subtype iunknown: IUnknown, From b6baee5f776790c3335babb99fc47b8a94ba24b1 Mon Sep 17 00:00:00 2001 From: ftphikari Date: Thu, 13 Jul 2023 02:11:46 +0300 Subject: [PATCH 2/8] [vendor:directx/dxgi] Added `GetDebugInterface` --- vendor/directx/dxgi/dxgidebug.odin | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vendor/directx/dxgi/dxgidebug.odin b/vendor/directx/dxgi/dxgidebug.odin index 1dea396a7..636fd76d5 100644 --- a/vendor/directx/dxgi/dxgidebug.odin +++ b/vendor/directx/dxgi/dxgidebug.odin @@ -139,3 +139,21 @@ IDebug1_VTable :: struct { DisableLeakTrackingForThread: proc "stdcall" (this: ^IDebug1), IsLeakTrackingEnabledForThread: proc "stdcall" (this: ^IDebug1) -> BOOL, } + + +GetDebugInterface: proc "stdcall" (riid: ^IID, ppDebug: ^rawptr) -> HRESULT +// Call this to start using GetDebugInterface +debug_interface_init :: proc() -> bool { + debug_lib := win32.LoadLibraryW(win32.L("dxgidebug.dll")) + if debug_lib == nil { + return false + } + + ptr := win32.GetProcAddress(debug_lib, "DXGIGetDebugInterface") + if ptr == nil { + return false + } + + GetDebugInterface = auto_cast(ptr) + return true +} From 7990566f6b35f27e45de34f466efe5662f968ddb Mon Sep 17 00:00:00 2001 From: ftphikari Date: Thu, 13 Jul 2023 17:16:32 +0300 Subject: [PATCH 3/8] Code review fixes --- vendor/directx/d3d_compiler/d3d_compiler.odin | 2 +- vendor/directx/dxgi/dxgidebug.odin | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vendor/directx/d3d_compiler/d3d_compiler.odin b/vendor/directx/d3d_compiler/d3d_compiler.odin index e2469c569..90af520c2 100644 --- a/vendor/directx/d3d_compiler/d3d_compiler.odin +++ b/vendor/directx/d3d_compiler/d3d_compiler.odin @@ -150,7 +150,7 @@ ID3DInclude_VTable :: struct { } // Default file includer -D3DCOMPILE_STANDARD_FILE_INCLUDE :: cast(^ID3DInclude)uintptr(1) +D3DCOMPILE_STANDARD_FILE_INCLUDE :: (^ID3DInclude)(uintptr(1)) ID3D11Module :: struct #raw_union { diff --git a/vendor/directx/dxgi/dxgidebug.odin b/vendor/directx/dxgi/dxgidebug.odin index 636fd76d5..3e7619d50 100644 --- a/vendor/directx/dxgi/dxgidebug.odin +++ b/vendor/directx/dxgi/dxgidebug.odin @@ -141,7 +141,10 @@ IDebug1_VTable :: struct { } -GetDebugInterface: proc "stdcall" (riid: ^IID, ppDebug: ^rawptr) -> HRESULT +GET_DEBUG_INTERFACE_PROC :: #type proc "stdcall" (riid: ^IID, ppDebug: ^rawptr) -> HRESULT + +GetDebugInterface: GET_DEBUG_INTERFACE_PROC + // Call this to start using GetDebugInterface debug_interface_init :: proc() -> bool { debug_lib := win32.LoadLibraryW(win32.L("dxgidebug.dll")) @@ -154,6 +157,6 @@ debug_interface_init :: proc() -> bool { return false } - GetDebugInterface = auto_cast(ptr) + GetDebugInterface = cast(GET_DEBUG_INTERFACE_PROC)ptr return true } From ab7652010b42a0064911a9e86b855d091f9dd451 Mon Sep 17 00:00:00 2001 From: ftphikari Date: Thu, 13 Jul 2023 17:41:21 +0300 Subject: [PATCH 4/8] [vendor:directx/dxgi] Rename `debug_interface_init` to `InitDebugInterface` --- vendor/directx/dxgi/dxgidebug.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/directx/dxgi/dxgidebug.odin b/vendor/directx/dxgi/dxgidebug.odin index 3e7619d50..12ce12050 100644 --- a/vendor/directx/dxgi/dxgidebug.odin +++ b/vendor/directx/dxgi/dxgidebug.odin @@ -145,8 +145,8 @@ GET_DEBUG_INTERFACE_PROC :: #type proc "stdcall" (riid: ^IID, ppDebug: ^rawptr) GetDebugInterface: GET_DEBUG_INTERFACE_PROC -// Call this to start using GetDebugInterface -debug_interface_init :: proc() -> bool { +// Helper function to initialize GetDebugInterface +InitDebugInterface :: proc() -> bool { debug_lib := win32.LoadLibraryW(win32.L("dxgidebug.dll")) if debug_lib == nil { return false From 7ca0b256eb69fa9d2c618f2799b8f84e3c121471 Mon Sep 17 00:00:00 2001 From: ftphikari Date: Fri, 14 Jul 2023 23:02:56 +0300 Subject: [PATCH 5/8] [core:sys/windows] Added missing `MONITORINFOEXW` type --- core/sys/windows/types.odin | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin index 11b87e0dc..8971f2875 100644 --- a/core/sys/windows/types.odin +++ b/core/sys/windows/types.odin @@ -1709,6 +1709,12 @@ MONITORINFO :: struct { } LPMONITORINFO :: ^MONITORINFO +CCHDEVICENAME :: 32 +MONITORINFOEXW :: struct { + using _: MONITORINFO, + szDevice: [CCHDEVICENAME]WCHAR, +} + // SetWindowsHook() codes WH_MIN :: -1 WH_MSGFILTER :: -1 From 6ac2c5c6dc6ed95a30bac8f95a6018041958aaea Mon Sep 17 00:00:00 2001 From: hikari Date: Mon, 17 Jul 2023 02:40:49 +0300 Subject: [PATCH 6/8] [core:sys/windows] Added a couple of procedures --- core/sys/windows/user32.odin | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin index 29fa4da17..ee536e0a8 100644 --- a/core/sys/windows/user32.odin +++ b/core/sys/windows/user32.odin @@ -228,6 +228,9 @@ foreign user32 { SetWindowRgn :: proc(hWnd: HWND, hRgn: HRGN, bRedraw: BOOL) -> int --- CreateRectRgnIndirect :: proc(lprect: ^RECT) -> HRGN --- GetSystemMetricsForDpi :: proc(nIndex: int, dpi: UINT) -> int --- + + GetSystemMenu :: proc(hWnd: HWND, bRevert: BOOL) -> HMENU --- + EnableMenuItem :: proc(hMenu: HMENU, uIDEnableItem: UINT, uEnable: UINT) -> BOOL --- } CreateWindowW :: #force_inline proc "stdcall" ( From 20dc8b222d6c87e3dce1ed7f4f663671f96b9d88 Mon Sep 17 00:00:00 2001 From: hikari Date: Tue, 18 Jul 2023 02:35:05 +0300 Subject: [PATCH 7/8] [vendor:directx/dxgi] Removed `GetDebugInterface` Since Windows 8.1 `DXGIGetDebugInterface1` is present, which eliminates the need for `GetDebugInterface`. Odin does not support Windows versions that Microsoft doesn't support, so anything Windows 7 and earlier is basically useless anyway. --- vendor/directx/dxgi/dxgidebug.odin | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/vendor/directx/dxgi/dxgidebug.odin b/vendor/directx/dxgi/dxgidebug.odin index 12ce12050..1dea396a7 100644 --- a/vendor/directx/dxgi/dxgidebug.odin +++ b/vendor/directx/dxgi/dxgidebug.odin @@ -139,24 +139,3 @@ IDebug1_VTable :: struct { DisableLeakTrackingForThread: proc "stdcall" (this: ^IDebug1), IsLeakTrackingEnabledForThread: proc "stdcall" (this: ^IDebug1) -> BOOL, } - - -GET_DEBUG_INTERFACE_PROC :: #type proc "stdcall" (riid: ^IID, ppDebug: ^rawptr) -> HRESULT - -GetDebugInterface: GET_DEBUG_INTERFACE_PROC - -// Helper function to initialize GetDebugInterface -InitDebugInterface :: proc() -> bool { - debug_lib := win32.LoadLibraryW(win32.L("dxgidebug.dll")) - if debug_lib == nil { - return false - } - - ptr := win32.GetProcAddress(debug_lib, "DXGIGetDebugInterface") - if ptr == nil { - return false - } - - GetDebugInterface = cast(GET_DEBUG_INTERFACE_PROC)ptr - return true -} From d2375a79f29d8377c813484bce3127ae9c205974 Mon Sep 17 00:00:00 2001 From: hikari Date: Tue, 25 Jul 2023 14:42:08 +0300 Subject: [PATCH 8/8] [vendor:directx/d3d11] Added missing UUIDs for shader reflection --- vendor/directx/d3d11/d3d11.odin | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vendor/directx/d3d11/d3d11.odin b/vendor/directx/d3d11/d3d11.odin index fd2824d23..ea1e7f5f8 100644 --- a/vendor/directx/d3d11/d3d11.odin +++ b/vendor/directx/d3d11/d3d11.odin @@ -3551,6 +3551,8 @@ PARAMETER_DESC :: struct { FirstOutComponent: u32, } +ID3D11ShaderReflectionType_UUID_STRING :: "6E6FFA6A-9BAE-4613-A51E-91652D508C21" +ID3D11ShaderReflectionType_UUID := &IID{0x6E6FFA6A, 0x9BAE, 0x4613, {0xA5, 0x1E, 0x91, 0x65, 0x2D, 0x50, 0x8C, 0x21}} IShaderReflectionType :: struct { using vtable: ^IShaderReflectionType_VTable, } @@ -3568,6 +3570,8 @@ IShaderReflectionType_VTable :: struct { ImplementsInterface: proc "stdcall" (this: ^IShaderReflectionType, pBase: ^IShaderReflectionType) -> HRESULT, } +ID3D11ShaderReflectionVariable_UUID_STRING :: "51F23923-F3E5-4BD1-91CB-606177D8DB4C" +ID3D11ShaderReflectionVariable_UUID := &IID{0x51F23923, 0xF3E5, 0x4BD1, {0x91, 0xCB, 0x60, 0x61, 0x77, 0xD8, 0xDB, 0x4C}} IShaderReflectionVariable :: struct { using vtable: ^IShaderReflectionVariable_VTable, } @@ -3578,6 +3582,8 @@ IShaderReflectionVariable_VTable :: struct { GetInterfaceSlot: proc "stdcall" (this: ^IShaderReflectionVariable, uArrayIndex: u32) -> u32, } +ID3D11ShaderReflectionConstantBuffer_UUID_STRING :: "EB62D63D-93DD-4318-8AE8-C6F83AD371B8" +ID3D11ShaderReflectionConstantBuffer_UUID := &IID{0xEB62D63D, 0x93DD, 0x4318, {0x8A, 0xE8, 0xC6, 0xF8, 0x3A, 0xD3, 0x71, 0xB8}} IShaderReflectionConstantBuffer :: struct { using vtable: ^IShaderReflectionConstantBuffer_VTable, } @@ -3588,6 +3594,8 @@ IShaderReflectionConstantBuffer_VTable :: struct { } +ID3D11ShaderReflection_UUID_STRING :: "8D536CA1-0CCA-4956-A837-786963755584" +ID3D11ShaderReflection_UUID := &IID{0x8D536CA1, 0x0CCA, 0x4956, {0xA8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84}} IShaderReflection :: struct #raw_union { #subtype iunknown: IUnknown, using id3d11shaderreflection_vtable: ^IShaderReflection_VTable, @@ -3616,6 +3624,8 @@ IShaderReflection_VTable :: struct { } +ID3D11LibraryReflection_UUID_STRING :: "54384F1B-5B3E-4BB7-AE01-60BA3097CBB6" +ID3D11LibraryReflection_UUID := &IID{0x54384F1B, 0x5B3E, 0x4BB7, {0xAE, 0x1, 0x60, 0xBA, 0x30, 0x97, 0xCD, 0xB6}} ILibraryReflection :: struct #raw_union { #subtype iunknown: IUnknown, using id3d11libraryreflection_vtable: ^ILibraryReflection_VTable, @@ -3626,6 +3636,8 @@ ILibraryReflection_VTable :: struct { GetFunctionByIndex: proc "stdcall" (this: ^ILibraryReflection, FunctionIndex: i32) -> ^IFunctionReflection, } +ID3D11FunctionReflection_UUID_STRING :: "207BCECB-D683-4A06-A8A3-9B149B9F73A4" +ID3D11FunctionReflection_UUID := &IID{0x207BCECB, 0xD683, 0x4A06, {0xA8, 0xA3, 0x9B, 0x14, 0x9B, 0x9F, 0x73, 0xA4}} IFunctionReflection :: struct { using vtable: ^IFunctionReflection_VTable, } @@ -3639,6 +3651,8 @@ IFunctionReflection_VTable :: struct { GetFunctionParameter: proc "stdcall" (this: ^IFunctionReflection, ParameterIndex: i32) -> ^IFunctionParameterReflection, } +ID3D11FunctionParameterReflection_UUID_STRING :: "42757488-334F-47FE-982E-1A65D08CC462" +ID3D11FunctionParameterReflection_UUID := &IID{0x42757488, 0x334f, 0x47FE, {0x98, 0x2E, 0x1A, 0x65, 0xD0, 0x8C, 0xC4, 0x62}} IFunctionParameterReflection :: struct { using vtable: ^IFunctionParameterReflection_VTable, }