dxgidebug.odin 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. package directx_dxgi
  2. import win32 "core:sys/windows"
  3. import "core:c"
  4. DEBUG_RLO_FLAGS :: enum u32 { // TODO: convert to bit_set
  5. SUMMARY = 0x1,
  6. DETAIL = 0x2,
  7. IGNORE_INTERNAL = 0x4,
  8. ALL = 0x7,
  9. }
  10. UINT :: win32.UINT
  11. INT :: win32.INT
  12. UINT64 :: win32.UINT64
  13. LPCSTR :: win32.LPCSTR
  14. DEBUG_ID :: win32.GUID
  15. INFO_QUEUE_MESSAGE_ID :: i32
  16. DEBUG_ALL := DEBUG_ID{0xe48ae283, 0xda80, 0x490b, {0x87, 0xe6, 0x43, 0xe9, 0xa9, 0xcf, 0xda, 0x8}}
  17. DEBUG_DX := DEBUG_ID{0x35cdd7fc, 0x13b2, 0x421d, {0xa5, 0xd7, 0x7e, 0x44, 0x51, 0x28, 0x7d, 0x64}}
  18. DEBUG_DXGI := DEBUG_ID{0x25cddaa4, 0xb1c6, 0x47e1, {0xac, 0x3e, 0x98, 0x87, 0x5b, 0x5a, 0x2e, 0x2a}}
  19. DEBUG_APP := DEBUG_ID{0x6cd6e01, 0x4219, 0x4ebd, {0x87, 0x9, 0x27, 0xed, 0x23, 0x36, 0xc, 0x62}}
  20. INFO_QUEUE_MESSAGE_CATEGORY :: enum u32 {
  21. UNKNOWN = 0,
  22. MISCELLANEOUS = UNKNOWN + 1,
  23. INITIALIZATION = MISCELLANEOUS + 1,
  24. CLEANUP = INITIALIZATION + 1,
  25. COMPILATION = CLEANUP + 1,
  26. STATE_CREATION = COMPILATION + 1,
  27. STATE_SETTING = STATE_CREATION + 1,
  28. STATE_GETTING = STATE_SETTING + 1,
  29. RESOURCE_MANIPULATION = STATE_GETTING + 1,
  30. EXECUTION = RESOURCE_MANIPULATION + 1,
  31. SHADER = EXECUTION + 1,
  32. }
  33. INFO_QUEUE_MESSAGE_SEVERITY :: enum u32 {
  34. CORRUPTION = 0,
  35. ERROR = CORRUPTION + 1,
  36. WARNING = ERROR + 1,
  37. INFO = WARNING + 1,
  38. MESSAGE = INFO + 1,
  39. }
  40. INFO_QUEUE_MESSAGE :: struct {
  41. Producer: DEBUG_ID,
  42. Category: INFO_QUEUE_MESSAGE_CATEGORY,
  43. Severity: INFO_QUEUE_MESSAGE_SEVERITY,
  44. ID: INFO_QUEUE_MESSAGE_ID,
  45. pDescription: [^]c.char,
  46. DescriptionByteLength: SIZE_T,
  47. }
  48. INFO_QUEUE_FILTER_DESC :: struct {
  49. NumCategories: UINT,
  50. pCategoryList: [^]INFO_QUEUE_MESSAGE_CATEGORY,
  51. NumSeverities: UINT,
  52. pSeverityList: [^]INFO_QUEUE_MESSAGE_SEVERITY,
  53. NumIDs: UINT,
  54. pIDList: [^]INFO_QUEUE_MESSAGE_ID,
  55. }
  56. INFO_QUEUE_FILTER :: struct {
  57. AllowList: INFO_QUEUE_FILTER_DESC,
  58. DenyList: INFO_QUEUE_FILTER_DESC,
  59. }
  60. INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT :: 1024
  61. IInfoQueue_UUID_STRING :: "D67441C7-672A-476f-9E82-CD55B44949CE"
  62. IInfoQueue_UUID := &IID{0xD67441C7, 0x672A, 0x476f, {0x9E, 0x82, 0xCD, 0x55, 0xB4, 0x49, 0x49, 0xCE}}
  63. IInfoQueue :: struct #raw_union {
  64. #subtype iunknown: IUnknown,
  65. using idxgiinfoqueue_vtable: ^IInfoQueue_VTable,
  66. }
  67. IInfoQueue_VTable :: struct {
  68. using iunknown_vtable: IUnknown_VTable,
  69. SetMessageCountLimit: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, MessageCountLimit: UINT64) -> HRESULT,
  70. ClearStoredMessages: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID),
  71. GetMessage: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, MessageIndex: UINT64, pMessage: ^INFO_QUEUE_MESSAGE, pMessageByteLength: ^SIZE_T) -> HRESULT,
  72. GetNumStoredMessagesAllowedByRetrievalFilters: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT64,
  73. GetNumStoredMessages: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT64,
  74. GetNumMessagesDiscardedByMessageCountLimit: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT64,
  75. GetMessageCountLimit: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT64,
  76. GetNumMessagesAllowedByStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT64,
  77. GetNumMessagesDeniedByStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT64,
  78. AddStorageFilterEntries: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, pFilter: INFO_QUEUE_FILTER) -> HRESULT,
  79. GetStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, pFilter: ^INFO_QUEUE_FILTER, pFilterByteLength: ^SIZE_T) -> HRESULT,
  80. ClearStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID),
  81. PushEmptyStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> HRESULT,
  82. PushDenyAllStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> HRESULT,
  83. PushCopyOfStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> HRESULT,
  84. PushStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
  85. PopStorageFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID),
  86. GetStorageFilterStackSize: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT,
  87. AddRetrievalFilterEntries: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
  88. GetRetrievalFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, pFilter: ^INFO_QUEUE_FILTER, pFilterByteLength: ^SIZE_T) -> HRESULT,
  89. ClearRetrievalFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID),
  90. PushEmptyRetrievalFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> HRESULT,
  91. PushDenyAllRetrievalFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> HRESULT,
  92. PushCopyOfRetrievalFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> HRESULT,
  93. PushRetrievalFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, pFilter: ^INFO_QUEUE_FILTER) -> HRESULT,
  94. PopRetrievalFilter: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID),
  95. GetRetrievalFilterStackSize: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> UINT,
  96. AddMessage: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, Category: INFO_QUEUE_MESSAGE_CATEGORY, Severity: INFO_QUEUE_MESSAGE_SEVERITY, ID: INFO_QUEUE_MESSAGE_ID, pDescription: LPCSTR) -> HRESULT,
  97. AddApplicationMessage: proc "system" (this: ^IInfoQueue, Severity: INFO_QUEUE_MESSAGE_SEVERITY, pDescription: LPCSTR) -> HRESULT,
  98. SetBreakOnCategory: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, Category: INFO_QUEUE_MESSAGE_CATEGORY, bEnable: BOOL) -> HRESULT,
  99. SetBreakOnSeverity: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, Severity: INFO_QUEUE_MESSAGE_SEVERITY, bEnable: BOOL) -> HRESULT,
  100. SetBreakOnID: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, ID: INFO_QUEUE_MESSAGE_ID, bEnable: BOOL) -> HRESULT,
  101. GetBreakOnCategory: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, Category: INFO_QUEUE_MESSAGE_CATEGORY) -> BOOL,
  102. GetBreakOnSeverity: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, Severity: INFO_QUEUE_MESSAGE_SEVERITY) -> BOOL,
  103. GetBreakOnID: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, ID: INFO_QUEUE_MESSAGE_ID) -> BOOL,
  104. SetMuteDebugOutput: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID, bMute: BOOL),
  105. GetMuteDebugOutput: proc "system" (this: ^IInfoQueue, Producer: DEBUG_ID) -> BOOL,
  106. }
  107. IDebug_UUID_STRING :: "119E7452-DE9E-40fe-8806-88F90C12B441"
  108. IDebug_UUID := &IID{0x119E7452, 0xDE9E, 0x40fe, {0x88, 0x06, 0x88, 0xF9, 0x0C, 0x12, 0xB4, 0x41}}
  109. IDebug :: struct #raw_union {
  110. #subtype iunknown: IUnknown,
  111. using idxgidebug_vtable: ^IDebug_VTable,
  112. }
  113. IDebug_VTable :: struct {
  114. using iunknown_vtable: IUnknown_VTable,
  115. ReportLiveObjects: proc "system" (this: ^IDebug, apiid: GUID, flags: DEBUG_RLO_FLAGS),
  116. }
  117. IDebug1_UUID_STRING :: "c5a05f0c-16f2-4adf-9f4d-a8c4d58ac550"
  118. IDebug1_UUID := &IID{0xc5a05f0c, 0x16f2, 0x4adf, {0x9f, 0x4d, 0xa8, 0xc4, 0xd5, 0x8a, 0xc5, 0x50}}
  119. IDebug1 :: struct #raw_union {
  120. #subtype idxgidebug: IDebug,
  121. using idxgidebug1_vtable: ^IDebug1_VTable,
  122. }
  123. IDebug1_VTable :: struct {
  124. using idxgidebug_vtable: IDebug_VTable,
  125. EnableLeakTrackingForThread: proc "system" (this: ^IDebug1),
  126. DisableLeakTrackingForThread: proc "system" (this: ^IDebug1),
  127. IsLeakTrackingEnabledForThread: proc "system" (this: ^IDebug1) -> BOOL,
  128. }