Browse Source

Merge pull request #3786 from fabiansperber/fix-d3d11-infoqueue

Fix d3d11 IInfoQueue_VTable & Add LoadLibraryExW
Jeroen van Rijn 1 year ago
parent
commit
21806e5fa5
3 changed files with 40 additions and 21 deletions
  1. 1 0
      core/sys/windows/kernel32.odin
  2. 16 0
      core/sys/windows/types.odin
  3. 23 21
      vendor/directx/d3d11/d3d11.odin

+ 1 - 0
core/sys/windows/kernel32.odin

@@ -413,6 +413,7 @@ foreign kernel32 {
 	LoadLibraryW :: proc(c_str: LPCWSTR) -> HMODULE ---
 	FreeLibrary :: proc(h: HMODULE) -> BOOL ---
 	GetProcAddress :: proc(h: HMODULE, c_str: LPCSTR) -> rawptr ---
+	LoadLibraryExW :: proc(c_str: LPCWSTR, file: HANDLE, flags: LoadLibraryEx_Flags) -> HMODULE ---
 
 
 	GetFullPathNameW  :: proc(filename: LPCWSTR, buffer_length: DWORD, buffer: LPCWSTR, file_part: ^LPCWSTR) -> DWORD ---

+ 16 - 0
core/sys/windows/types.odin

@@ -2674,6 +2674,22 @@ OSVERSIONINFOEXW :: struct {
 	wReserved:           UCHAR,
 }
 
+LoadLibraryEx_Flag :: enum DWORD {
+	LOAD_LIBRARY_AS_DATAFILE            = 1,  // 1 <<  1: 0x0002,
+	LOAD_WITH_ALTERED_SEARCH_PATH       = 3,  // 1 <<  3: 0x0008,
+	LOAD_IGNORE_CODE_AUTHZ_LEVEL        = 4,  // 1 <<  4: 0x0010,
+	LOAD_LIBRARY_AS_IMAGE_RESOURCE      = 5,  // 1 <<  5: 0x0020,
+	LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE  = 6,  // 1 <<  6: 0x0040,
+	LOAD_LIBRARY_REQUIRE_SIGNED_TARGET  = 7,  // 1 <<  7: 0x0080,
+	LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR    = 8,  // 1 <<  8: 0x0100,
+	LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 9,  // 1 <<  9: 0x0200,
+	LOAD_LIBRARY_SEARCH_USER_DIRS       = 10, // 1 << 10: 0x0400,
+	LOAD_LIBRARY_SEARCH_SYSTEM32        = 11, // 1 << 11: 0x0800,
+	LOAD_LIBRARY_SEARCH_DEFAULT_DIRS    = 12, // 1 << 12: 0x1000,
+	LOAD_LIBRARY_SAFE_CURRENT_DIRS      = 13, // 1 << 13: 0x2000,
+}
+LoadLibraryEx_Flags :: distinct bit_set[LoadLibraryEx_Flag]
+
 // https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-quota_limits
 // Used in LogonUserExW
 PQUOTA_LIMITS :: struct {

+ 23 - 21
vendor/directx/d3d11/d3d11.odin

@@ -3775,39 +3775,41 @@ MESSAGE :: struct {
 
 IInfoQueue_VTable :: struct {
 	using iunkown_vtable: IUnknown_VTable,
-	AddApplicationMessage:                        proc "system" (this: ^IInfoQueue, Severity: MESSAGE_SEVERITY, pDescription: cstring) -> HRESULT,
-	AddMessage:                                   proc "system" (this: ^IInfoQueue, Category: MESSAGE_CATEGORY, Severity: MESSAGE_SEVERITY, ID: MESSAGE_ID, pDescription: cstring) -> HRESULT,
-	AddRetrievalFilterEntries:                    proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
-	AddStorageFilterEntries:                      proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
-	ClearRetrievalFilter:                         proc "system" (this: ^IInfoQueue),
-	ClearStorageFilter:                           proc "system" (this: ^IInfoQueue),
+	SetMessageCountLimit:                         proc "system" (this: ^IInfoQueue, MessageCountLimit: u64) -> HRESULT,
 	ClearStoredMessages:                          proc "system" (this: ^IInfoQueue),
-	GetBreakOnCategory:                           proc "system" (this: ^IInfoQueue, Category: MESSAGE_CATEGORY) -> BOOL,
-	GetBreakOnID:                                 proc "system" (this: ^IInfoQueue, ID: MESSAGE_ID) -> BOOL,
-	GetBreakOnSeverity:                           proc "system" (this: ^IInfoQueue, Severity: MESSAGE_SEVERITY) -> BOOL,
 	GetMessage:                                   proc "system" (this: ^IInfoQueue, MessageIndex: u64, pMessage: ^MESSAGE, pMessageByteLength: ^SIZE_T) -> HRESULT,
-	GetMessageCountLimit:                         proc "system" (this: ^IInfoQueue) -> u64,
-	GetMuteDebugOutput:                           proc "system" (this: ^IInfoQueue) -> BOOL,
 	GetNumMessagesAllowedByStorageFilter:         proc "system" (this: ^IInfoQueue) -> u64,
 	GetNumMessagesDeniedByStorageFilter:          proc "system" (this: ^IInfoQueue) -> u64,
-	GetNumMessagesDiscardedByMessageCountLimit:   proc "system" (this: ^IInfoQueue) -> u64,
 	GetNumStoredMessages:                         proc "system" (this: ^IInfoQueue) -> u64,
 	GetNumStoredMessagesAllowedByRetrievalFilter: proc "system" (this: ^IInfoQueue) -> u64,
-	GetRetrievalFilter:                           proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER, pFilterByteLength: ^SIZE_T) -> HRESULT,
-	GetRetrievalFilterStackSize:                  proc "system" (this: ^IInfoQueue) -> u64,
+	GetNumMessagesDiscardedByMessageCountLimit:   proc "system" (this: ^IInfoQueue) -> u64,
+	GetMessageCountLimit:                         proc "system" (this: ^IInfoQueue) -> u64,
+	AddStorageFilterEntries:                      proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
 	GetStorageFilter:                             proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER, pFilterByteLength: ^SIZE_T) -> HRESULT,
-	GetStorageFilterStackSize:                    proc "system" (this: ^IInfoQueue) -> u64,
-	PopRetrievalFilter:                           proc "system" (this: ^IInfoQueue),
-	PopStorageFilter:                             proc "system" (this: ^IInfoQueue),
-	PushCopyOfRetrievalFilter:                    proc "system" (this: ^IInfoQueue) -> HRESULT,
+	ClearStorageFilter:                           proc "system" (this: ^IInfoQueue),
+	PushEmptyStorageFilter:                       proc "system" (this: ^IInfoQueue) -> HRESULT,
 	PushCopyOfStorageFilter:                      proc "system" (this: ^IInfoQueue) -> HRESULT,
+	PushStorageFilter:                            proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
+	PopStorageFilter:                             proc "system" (this: ^IInfoQueue),
+	GetStorageFilterStackSize:                    proc "system" (this: ^IInfoQueue) -> u64,
+	AddRetrievalFilterEntries:                    proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
+	GetRetrievalFilter:                           proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER, pFilterByteLength: ^SIZE_T) -> HRESULT,
+	ClearRetrievalFilter:                         proc "system" (this: ^IInfoQueue),
 	PushEmptyRetrievalFilter:                     proc "system" (this: ^IInfoQueue) -> HRESULT,
-	PushEmptyStorageFilter:                       proc "system" (this: ^IInfoQueue) -> HRESULT,
+	PushCopyOfRetrievalFilter:                    proc "system" (this: ^IInfoQueue) -> HRESULT,
+	PushRetrievalFilter:                          proc "system" (this: ^IInfoQueue, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
+	PopRetrievalFilter:                           proc "system" (this: ^IInfoQueue),
+	GetRetrievalFilterStackSize:                  proc "system" (this: ^IInfoQueue) -> u64,
+	AddMessage:                                   proc "system" (this: ^IInfoQueue, Category: MESSAGE_CATEGORY, Severity: MESSAGE_SEVERITY, ID: MESSAGE_ID, pDescription: cstring) -> HRESULT,
+	AddApplicationMessage:                        proc "system" (this: ^IInfoQueue, Severity: MESSAGE_SEVERITY, pDescription: cstring) -> HRESULT,
 	SetBreakOnCategory:                           proc "system" (this: ^IInfoQueue, Category: MESSAGE_CATEGORY, bEnable: BOOL) -> HRESULT,
-	SetBreakOnID:                                 proc "system" (this: ^IInfoQueue, ID: MESSAGE_ID, bEnable: BOOL) -> HRESULT,
 	SetBreakOnSeverity:                           proc "system" (this: ^IInfoQueue, Severity: MESSAGE_SEVERITY, bEnable: BOOL) -> HRESULT,
-	SetMessageCountLimit:                         proc "system" (this: ^IInfoQueue, MessageCountLimit: u64) -> HRESULT,
+	SetBreakOnID:                                 proc "system" (this: ^IInfoQueue, ID: MESSAGE_ID, bEnable: BOOL) -> HRESULT,
+	GetBreakOnCategory:                           proc "system" (this: ^IInfoQueue, Category: MESSAGE_CATEGORY) -> BOOL,
+	GetBreakOnSeverity:                           proc "system" (this: ^IInfoQueue, Severity: MESSAGE_SEVERITY) -> BOOL,
+	GetBreakOnID:                                 proc "system" (this: ^IInfoQueue, ID: MESSAGE_ID) -> BOOL,
 	SetMuteDebugOutput:                           proc "system" (this: ^IInfoQueue, bMute: BOOL),
+	GetMuteDebugOutput:                           proc "system" (this: ^IInfoQueue) -> BOOL,
 }
 
 MESSAGE_ID :: enum u32 {