From 187a475b844c5b46f2ad1f2e8a66780c91a4e929 Mon Sep 17 00:00:00 2001 From: RLGingerBiscuit Date: Fri, 25 Aug 2023 17:33:41 +0100 Subject: json.marshal: Don't output spaces if pretty=false --- core/encoding/json/marshal.odin | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin index 77a5bf8df..43f464bdb 100644 --- a/core/encoding/json/marshal.odin +++ b/core/encoding/json/marshal.odin @@ -404,7 +404,7 @@ opt_write_key :: proc(w: io.Writer, opt: ^Marshal_Options, name: string) -> (err switch opt.spec { case .JSON, .JSON5: io.write_quoted_string(w, name) or_return - io.write_string(w, ": ") or_return + io.write_string(w, ": " if opt.pretty else ":") or_return case .MJSON: if opt.mjson_keys_use_quotes { @@ -412,11 +412,11 @@ opt_write_key :: proc(w: io.Writer, opt: ^Marshal_Options, name: string) -> (err } else { io.write_string(w, name) or_return } - + if opt.mjson_keys_use_equal_sign { - io.write_string(w, " = ") or_return + io.write_string(w, " = " if opt.pretty else "=") or_return } else { - io.write_string(w, ": ") or_return + io.write_string(w, ": " if opt.pretty else ":") or_return } } @@ -446,7 +446,7 @@ opt_write_iteration :: proc(w: io.Writer, opt: ^Marshal_Options, iteration: int) switch opt.spec { case .JSON, .JSON5: if iteration > 0 { - io.write_string(w, ", ") or_return + io.write_byte(w, ',') or_return if opt.pretty { io.write_byte(w, '\n') or_return @@ -462,7 +462,7 @@ opt_write_iteration :: proc(w: io.Writer, opt: ^Marshal_Options, iteration: int) io.write_byte(w, '\n') or_return } else { // comma separation necessary for non pretty output! - io.write_string(w, ", ") or_return + io.write_byte(w, ',') or_return } } -- cgit v1.2.3 From d0ef6d2a9b7a160531579c7460a417b790c90bcc Mon Sep 17 00:00:00 2001 From: AbdelHameed-Hamed Date: Thu, 31 Aug 2023 11:50:29 +0200 Subject: Add unix bindings for DXC. --- vendor/directx/dxc/dxcapi.odin | 603 ------------------------------- vendor/directx/dxc/dxcapi_unix.odin | 626 +++++++++++++++++++++++++++++++++ vendor/directx/dxc/dxcapi_windows.odin | 604 +++++++++++++++++++++++++++++++ 3 files changed, 1230 insertions(+), 603 deletions(-) delete mode 100644 vendor/directx/dxc/dxcapi.odin create mode 100644 vendor/directx/dxc/dxcapi_unix.odin create mode 100644 vendor/directx/dxc/dxcapi_windows.odin diff --git a/vendor/directx/dxc/dxcapi.odin b/vendor/directx/dxc/dxcapi.odin deleted file mode 100644 index aa0bb8443..000000000 --- a/vendor/directx/dxc/dxcapi.odin +++ /dev/null @@ -1,603 +0,0 @@ -package directx_dxc -import win32 "core:sys/windows" -import dxgi "vendor:directx/dxgi" -foreign import "dxcompiler.lib" - -BOOL :: dxgi.BOOL -SIZE_T :: dxgi.SIZE_T -ULONG :: dxgi.ULONG -CLSID :: dxgi.GUID -IID :: dxgi.IID -HRESULT :: dxgi.HRESULT -IUnknown :: dxgi.IUnknown -IUnknown_VTable :: dxgi.IUnknown_VTable -wstring :: win32.wstring -FILETIME :: win32.FILETIME -BSTR :: wstring - -@(default_calling_convention="c", link_prefix="Dxc") -foreign dxcompiler { - CreateInstance :: proc (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- - CreateInstance2 :: proc (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- -} - -pCreateInstanceProc :: #type proc "c" (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT -pCreateInstance2Proc :: #type proc "c" (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT - -CreateInstance_ProcName :: "DxcCreateInstance" -CreateInstance2_ProcName :: "DxcCreateInstance2" - -IMalloc :: struct #raw_union { - #subtype iunknown: IUnknown, - using imalloc_vtable: ^IMalloc_VTable, -} -IMalloc_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Alloc: proc "stdcall" (this: ^IMalloc, cb: SIZE_T) -> rawptr, - Realloc: proc "stdcall" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr, - Free: proc "stdcall" (this: ^IMalloc, pv: rawptr), - GetSize: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> SIZE_T, - DidAlloc: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> i32, - HeapMinimize: proc "stdcall" (this: ^IMalloc), -} - -ISequentialStream :: struct #raw_union { - #subtype iunknown: IUnknown, - using isequentialstream_vtable: ^ISequentialStream_VTable, -} -ISequentialStream_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Read: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT, - Write: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT, -} - -STATSTG :: struct { - pwcsName: wstring, - type: u32, - cbSize: u64, - mtime: FILETIME, - ctime: FILETIME, - atime: FILETIME, - grfMode: u32, - grfLocksSupported: u32, - clsid: CLSID, - grfStateBits: u32, - reserved: u32, -} - -IStream :: struct #raw_union { - #subtype isequentialstream: ISequentialStream, - using istream_vtable: ^IStream_VTable, -} -IStream_VTable :: struct { - using isequentialstream_vtable: ISequentialStream_VTable, - Seek: proc "stdcall" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT, - SetSize: proc "stdcall" (this: ^IStream, libNewSize: u64) -> HRESULT, - CopyTo: proc "stdcall" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT, - Commit: proc "stdcall" (this: ^IStream, grfCommitFlags: u32) -> HRESULT, - Revert: proc "stdcall" (this: ^IStream) -> HRESULT, - LockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, - UnlockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, - Stat: proc "stdcall" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT, - Clone: proc "stdcall" (this: ^IStream, ppstm: ^^IStream) -> HRESULT, -} - -IBlob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102" -IBlob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}} -IBlob :: struct #raw_union { - #subtype iunknown: IUnknown, - using id3d10blob_vtable: ^IBlob_VTable, -} -IBlob_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetBufferPointer: proc "stdcall" (this: ^IBlob) -> rawptr, - GetBufferSize: proc "stdcall" (this: ^IBlob) -> SIZE_T, -} - -IBlobEncoding_UUID_STRRING :: "7241D424-2646-4191-97C0-98E96E42FC68" -IBlobEncoding_UUID := &IID{0x7241D424, 0x2646, 0x4191, {0x97, 0xC0, 0x98, 0xE9, 0x6E, 0x42, 0xFC, 0x68}} -IBlobEncoding :: struct #raw_union { - #subtype idxcblob: IBlob, - using idxcblobencoding_vtable: ^IBlobEncoding_VTable, -} -IBlobEncoding_VTable :: struct { - using idxcblob_vtable: IBlob_VTable, - GetEncoding: proc "stdcall" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT, -} - -IBlobUtf16_UUID_STRING :: "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84" -IBlobUtf16_UUID := &IID{0xA3F84EAB, 0x0FAA, 0x497E, {0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84}} -IBlobUtf16 :: struct #raw_union { - #subtype idxcblobencoding: IBlobEncoding, - using idxcblobutf16_vtable : ^IBlobUtf16_VTable, -} -IBlobUtf16_VTable :: struct { - using idxcblobencoding_vtable: IBlobEncoding_VTable, - GetStringPointer: proc "stdcall" (this: ^IBlobUtf16) -> wstring, - GetStringLength: proc "stdcall" (this: ^IBlobUtf16) -> SIZE_T, -} - -IBlobUtf8_UUID_STRING :: "3DA636C9-BA71-4024-A301-30CBF125305B" -IBlobUtf8_UUID := &IID{0x3DA636C9, 0xBA71, 0x4024, {0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B}} -IBlobUtf8 :: struct #raw_union { - #subtype idxcblobencoding: IBlobEncoding, - using idxcblobutf8_vtable : ^IBlobUtf8_VTable, -} -IBlobUtf8_VTable :: struct { - using idxcblobencoding_vtable: IBlobEncoding_VTable, - GetStringPointer: proc "stdcall" (this: ^IBlobUtf8) -> cstring, - GetStringLength: proc "stdcall" (this: ^IBlobUtf8) -> SIZE_T, -} - -IIncludeHandler_UUID_STRING :: "7F61FC7D-950D-467F-B3E3-3C02FB49187C" -IIncludeHandler_UUID := &IID{0x7F61FC7D, 0x950D, 0x467F, {0xB3, 0xE3, 0x3C, 0x02, 0xFB, 0x49, 0x18, 0x7C}} -IIncludeHandler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcincludehandler_vtable: ^IIncludeHandler_VTable, -} -IIncludeHandler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - LoadSource: proc "stdcall" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT, -} - -Define :: struct { - Name: wstring, - Value: wstring, -} - -ICompilerArgs_UUID_STRING :: "73EFFE2A-70DC-45F8-9690-EFF64C02429D" -ICompilerArgs_UUID := &IID{0x73EFFE2A, 0x70DC, 0x45F8, {0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D}} -ICompilerArgs :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompilerargs_vtable: ^ICompilerArgs_VTable, -} -ICompilerArgs_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetArguments: proc "stdcall" (this: ^ICompilerArgs) -> [^]wstring, - GetCount: proc "stdcall" (this: ^ICompilerArgs) -> u32, - AddArguments: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT, - AddArgumentsUTF8: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT, - AddDefines: proc "stdcall" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT, -} - -ILibrary_UUID_STRING :: "E5204DC7-D18C-4C3C-BDFB-851673980FE7" -ILibrary_UUID := &IID{0xE5204DC7, 0xD18C, 0x4C3C, {0xBD, 0xFB, 0x85, 0x16, 0x73, 0x98, 0x0F, 0xE7}} -ILibrary :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxclibrary_vtable: ^ILibrary_VTable, -} -ILibrary_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - SetMalloc: proc "stdcall" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT, - CreateBlobFromBlob: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, - CreateBlobFromFile: proc "stdcall" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingFromPinned: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingOnHeapCopy: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingOnMalloc: proc "stdcall" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateIncludeHandler: proc "stdcall" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT, - CreateStreamFromBlobReadOnly: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, - GetBlobAsUtf8: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - GetBlobAsUtf16: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, -} - -IOperationResult_UUID_STRING :: "CEDB484A-D4E9-445A-B991-CA21CA157DC2" -IOperationResult_UUID := &IID{0xCEDB484A, 0xD4E9, 0x445A, {0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2}} -IOperationResult :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoperationresult_vtable: ^IOperationResult_VTable, -} -IOperationResult_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetStatus: proc "stdcall" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT, - GetResult: proc "stdcall" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT, - GetErrorBuffer: proc "stdcall" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT, -} - -ICompiler_UUID_STRING :: "8C210BF3-011F-4422-8D70-6F9ACB8DB617" -ICompiler_UUID := &IID{0x8C210BF3, 0x011F, 0x4422, {0x8D, 0x70, 0x6F, 0x9A, 0xCB, 0x8D, 0xB6, 0x17}} -ICompiler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompiler_vtable: ^ICompiler_VTable, -} -ICompiler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Compile: proc "stdcall" ( - this: ^ICompiler, - pSource: ^Buffer, - pSourceName: wstring, - pEntryPoint: wstring, - pTargetProfile: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult) -> HRESULT, - Preprocess: proc "stdcall" ( - this: ^ICompiler, - pSource: ^Buffer, - pSourceName: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult) -> HRESULT, - Disassemble: proc "stdcall" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT, -} - -ICompiler2_UUID_STRING :: "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37" -ICompiler2_UUID := &IID{0xA005A9D9, 0xB8BB, 0x4594, {0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37}} -ICompiler2 :: struct #raw_union { - #subtype icompiler: ICompiler, - using idxccompiler2_vtable: ^ICompiler2_VTable, -} -ICompiler2_VTable :: struct { - using idxccompiler_vtable: ^ICompiler_VTable, - CompileWithDebug: proc "stdcall" ( - this: ^ICompiler2, - pSource: ^Buffer, - pSourceName: wstring, - pEntryPoint: wstring, - pTargetProfile: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult, - ppDebugBlobName: ^wstring, - ppDebugBlob: ^^IBlob) -> HRESULT, -} - -ILinker_UUID_STRING :: "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6" -ILinker_UUID := &IID{0xF1B5BE2A, 0x62DD, 0x4327, {0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6}} -ILinker :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxclinker_vtable: ^ILinker_VTable, -} -ILinker_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - RegisterLibrary: proc "stdcall" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT, - Link: proc "stdcall" ( - this: ^ILinker, - pEntryName: wstring, - pTargetProfile: wstring, - pLibNames: [^]wstring, - libCount: u32, - pArguments: [^]wstring, - argCount: u32, - ppResult: ^^IOperationResult) -> HRESULT, -} - -Buffer :: struct { - Ptr: rawptr, - Size: SIZE_T, - Encoding: u32, -} - -IUtils_UUID_STRING :: "4605C4CB-2019-492A-ADA4-65F20BB7D67F" -IUtils_UUID := &IID{0x4605C4CB, 0x2019, 0x492A, {0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F}} -IUtils :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcutils_vtable: ^IUtils_VTable, -} -IUtils_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - CreateBlobFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, - CreateBlobFromPinned: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - MoveToBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - LoadFile: proc "stdcall" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateReadOnlyStreamFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, - CreateDefaultIncludeHandler: proc "stdcall" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT, - GetBlobAsUtf8: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT, - GetBlobAsUtf16: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT, - GetDxilContainerPart: proc "stdcall" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT, - CreateReflection: proc "stdcall" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT, - BuildArguments: proc "stdcall" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT, - GetPDBContents: proc "stdcall" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT, -} - -DXC_OUT_KIND :: enum u32 { - NONE = 0, - OBJECT = 1, - ERRORS = 2, - PDB = 3, - SHADER_HASH = 4, - DISASSEMBLY = 5, - HLSL = 6, - TEXT = 7, - REFLECTION = 8, - ROOT_SIGNATURE = 9, - EXTRA_OUTPUTS = 10, - FORCE_DWORD = 0xFFFFFFFF, -} - -IResult_UUID_STRING :: "58346CDA-DDE7-4497-9461-6F87AF5E0659" -IResult_UUID := &IID{0x58346CDA, 0xDDE7, 0x4497, {0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59}} -IResult :: struct #raw_union { - #subtype idxcoperationresult: IOperationResult, - using idxcresult_vtable: ^IResult_VTable, -} -IResult_VTable :: struct { - using idxcoperationresult_vtable: IOperationResult_VTable, - HasOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL, - GetOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT, - GetNumOutputs: proc "stdcall" (this: ^IResult) -> u32, - GetOutputByIndex: proc "stdcall" (this: ^IResult, Index: u32) -> DXC_OUT_KIND, - PrimaryOutput: proc "stdcall" (this: ^IResult) -> DXC_OUT_KIND, -} - -IExtraOutputs_UUID_STRING :: "319B37A2-A5C2-494A-A5DE-4801B2FAF989" -IExtraOutputs_UUID := &IID{0x319B37A2, 0xA5C2, 0x494A, {0xA5, 0xDE, 0x48, 0x01, 0xB2, 0xFA, 0xF9, 0x89}} -IExtraOutputs :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcextraoutputs_vtable: ^IExtraOutputs_VTable, -} -IExtraOutputs_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetOutputCount: proc "stdcall" (this: ^IExtraOutputs) -> u32, - GetOutput: proc "stdcall" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT, -} - -ICompiler3_UUID_STRING :: "228B4687-5A6A-4730-900C-9702B2203F54" -ICompiler3_UUID := &IID{0x228B4687, 0x5A6A, 0x4730, {0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54}} -ICompiler3 :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompiler3_vtable: ^ICompiler3_VTable, -} -ICompiler3_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Compile: proc "stdcall" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT, - Disassemble: proc "stdcall" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT, -} - -IValidator_UUID_STRING :: "A6E82BD2-1FD7-4826-9811-2857E797F49A" -IValidator_UUID := &IID{0xA6E82BD2, 0x1FD7, 0x4826, {0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A}} -IValidator :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcvalidator_vtable: ^IValidator_VTable, -} -IValidator_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Validate: proc "stdcall" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT, -} - -IValidator2_UUID_STRING :: "458E1FD1-B1B2-4750-A6E1-9C10F03BED92" -IValidator2_UUID := &IID{0x458E1FD1, 0xB1B2, 0x4750, {0xA6, 0xE1, 0x9C, 0x10, 0xF0, 0x3B, 0xED, 0x92}} -IValidator2 :: struct #raw_union { - #subtype idxcvalidator: IValidator, - using idxcvalidator2_vtable: ^IValidator2_VTable, -} -IValidator2_VTable :: struct { - using idxcvalidator_vtable: IValidator_VTable, - ValidateWithDebug: proc "stdcall" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT, -} - -IContainerBuilder_UUID_STRING :: "334B1F50-2292-4B35-99A1-25588D8C17FE" -IContainerBuilder_UUID := &IID{0x334B1F50, 0x2292, 0x4B35, {0x99, 0xA1, 0x25, 0x58, 0x8D, 0x8C, 0x17, 0xFE}} -IContainerBuilder :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccontainerbuilder_vtable: ^IContainerBuilder_VTable, -} -IContainerBuilder_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "stdcall" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT, - AddPart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT, - RemovePart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT, - SerializeContainer: proc "stdcall" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT, -} - -IAssembler_UUID_STRING :: "091F7A26-1C1F-4948-904B-E6E3A8A771D5" -IAssembler_UUID := &IID{0x091F7A26, 0x1C1F, 0x4948, {0x90, 0x4B, 0xE6, 0xE3, 0xA8, 0xA7, 0x71, 0xD5}} -IAssembler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcassembler_vtable: ^IAssembler_VTable, -} -IAssembler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - AssembleToContainer: proc "stdcall" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT, -} - -IContainerReflection_UUID_STRING :: "D2C21B26-8350-4BDC-976A-331CE6F4C54C" -IContainerReflection_UUID := &IID{0xD2C21B26, 0x8350, 0x4BDC, {0x97, 0x6A, 0x33, 0x1C, 0xE6, 0xF4, 0xC5, 0x4C}} -IContainerReflection :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccontainerreflection_vtable: ^IContainerReflection_VTable, -} -IContainerReflection_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "stdcall" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT, - GetPartCount: proc "stdcall" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT, - GetPartKind: proc "stdcall" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT, - GetPartContent: proc "stdcall" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT, - FindFirstPartKind: proc "stdcall" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT, - GetPartReflection: proc "stdcall" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT, -} - -IOptimizerPass_UUID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" -IOptimizerPass_UUID := &IID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} -IOptimizerPass :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoptimizerpass_vtable: ^IOptimizerPass_VTable, -} -IOptimizerPass_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetOptionName: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, - GetDescription: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, - GetOptionArgCount: proc "stdcall" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT, - GetOptionArgName: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, - GetOptionArgDescription: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, -} - -IOptimizer_UUID_STRING :: "25740E2E-9CBA-401B-9119-4FB42F39F270" -IOptimizer_UUID := &IID{0x25740E2E, 0x9CBA, 0x401B, {0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70}} -IOptimizer :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoptimizer_vtable: ^IOptimizer_VTable, -} -IOptimizer_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetAvailablePassCount: proc "stdcall" (this: ^IOptimizer, pCount: ^u32) -> HRESULT, - GetAvailablePass: proc "stdcall" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT, - RunOptimizer: proc "stdcall" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT, -} - -VersionInfoFlags :: enum u32 { - None = 0, - Debug = 1, - Internal = 2, -} - -IVersionInfo_UUID_STRING :: "B04F5B50-2059-4F12-A8FF-A1E0CDE1CC7E" -IVersionInfo_UUID := &IID{0xB04F5B50, 0x2059, 0x4F12, {0xA8, 0xFF, 0xA1, 0xE0, 0xCD, 0xE1, 0xCC, 0x7E}} -IVersionInfo :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcversioninfo_vtable: ^IVersionInfo_VTable, -} -IVersionInfo_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetVersion: proc "stdcall" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT, - GetFlags: proc "stdcall" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT, -} - -IVersionInfo2_UUID_STRING :: "FB6904C4-42F0-4B62-9C46-983AF7DA7C83" -IVersionInfo2_UUID := &IID{0xFB6904C4, 0x42F0, 0x4B62, {0x9C, 0x46, 0x98, 0x3A, 0xF7, 0xDA, 0x7C, 0x83}} -IVersionInfo2 :: struct #raw_union { - #subtype idxcversioninfo: IVersionInfo, - using idxcversioninfo2_vtable: ^IVersionInfo2_VTable, -} -IVersionInfo2_VTable :: struct { - using idxcversioninfo_vtable: IVersionInfo_VTable, - GetCommitInfo: proc "stdcall" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT, -} - -IVersionInfo3_UUID_STRING :: "5E13E843-9D25-473C-9AD2-03B2D0B44B1E" -IVersionInfo3_UUID := &IID{0x5E13E843, 0x9D25, 0x473C, {0x9A, 0xD2, 0x03, 0xB2, 0xD0, 0xB4, 0x4B, 0x1E}} -IVersionInfo3 :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcversioninfo3_vtable: ^IVersionInfo3_VTable, -} -IVersionInfo3_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetCustomVersionString: proc "stdcall" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT, -} - -ArgPair :: struct { - pName: wstring, - pValue: wstring, -} - -IPdbUtils_UUID_STRING :: "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D" -IPdbUtils_UUID := &IID{0xE6C9647E, 0x9D6A, 0x4C3B, {0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D}} -IPdbUtils :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcpdbutils_vtable: ^IPdbUtils_VTable, -} -IPdbUtils_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "stdcall" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT, - GetSourceCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetSource: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT, - GetSourceName: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetFlagCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetFlag: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetArgCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetArg: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetArgPairCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetArgPair: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT, - GetDefineCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetDefine: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetTargetProfile: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetEntryPoint: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetMainFileName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetHash: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT, - GetName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - IsFullPDB: proc "stdcall" (this: ^IPdbUtils) -> BOOL, - GetFullPDB: proc "stdcall" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT, - GetVersionInfo: proc "stdcall" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT, - SetCompiler: proc "stdcall" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT, - CompileForFullPDB: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT, - OverrideArgs: proc "stdcall" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT, - OverrideRootSignature: proc "stdcall" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT, -} - - -Compiler_CLSID_STRING :: "73E22D93-E6CE-47F3-B5BF-F0664F39C1B0" -Compiler_CLSID := &CLSID{0x73E22D93, 0xE6CE, 0x47F3, {0xB5, 0xBF, 0xF0, 0x66, 0x4F, 0x39, 0xC1, 0xB0}} - -Linker_CLSID_STRING :: "EF6A8087-B0EA-4D56-9E45-D07E1A8B7806" -Linker_CLSID := &CLSID{0xEF6A8087, 0xB0EA, 0x4D56, {0x9E, 0x45, 0xD0, 0x7E, 0x1A, 0x8B, 0x78, 0x6}} - -DiaDataSource_CLSID_STRING :: "CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F" -DiaDataSource_CLSID := &CLSID{0xCD1F6B73, 0x2AB0, 0x484D, {0x8E, 0xDC, 0xEB, 0xE7, 0xA4, 0x3C, 0xA0, 0x9F}} - -CompilerArgs_CLSID_STRING :: "3E56AE82-224D-470F-A1A1-FE3016EE9F9D" -CompilerArgs_CLSID := &CLSID{0x3E56AE82, 0x224D, 0x470F, {0xA1, 0xA1, 0xFE, 0x30, 0x16, 0xEE, 0x9F, 0x9D}} - -Library_CLSID_STRING :: "6245D6AF-66E0-48FD-80B4-4D271796748C" -Library_CLSID := &CLSID{0x6245D6AF, 0x66E0, 0x48FD, {0x80, 0xB4, 0x4D, 0x27, 0x17, 0x96, 0x74, 0x8C}} - -Utils_CLSID_STRING :: Library_CLSID_STRING -Utils_CLSID := Library_CLSID - -Validator_CLSID_STRING :: "8CA3E215-F728-4CF3-8CDD-88AF917587A1" -Validator_CLSID := &CLSID{0x8CA3E215, 0xF728, 0x4CF3, {0x8C, 0xDD, 0x88, 0xAF, 0x91, 0x75, 0x87, 0xA1}} - -Assembler_CLSID_STRING :: "D728DB68-F903-4F80-94CD-DCCF76EC7151" -Assembler_CLSID := &CLSID{0xD728DB68, 0xF903, 0x4F80, {0x94, 0xCD, 0xDC, 0xCF, 0x76, 0xEC, 0x71, 0x51}} - -ContainerReflection_CLSID_STRING :: "b9f54489-55b8-400c-ba3a-1675e4728b91" -ContainerReflection_CLSID := &CLSID{0xB9F54489, 0x55B8, 0x400C, {0xBA, 0x3A, 0x16, 0x75, 0xE4, 0x72, 0x8B, 0x91}} - -Optimizer_CLSID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" -Optimizer_CLSID := &CLSID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} - -ContainerBuilder_CLSID_STRING :: "94134294-411f-4574-b4d0-8741e25240d2" -ContainerBuilder_CLSID := &CLSID{0x94134294, 0x411F, 0x4574, {0xB4, 0xD0, 0x87, 0x41, 0xE2, 0x52, 0x40, 0xD2}} - -PdbUtils_CLSID_STRING :: "54621dfb-f2ce-457e-ae8c-ec355faeec7c" -PdbUtils_CLSID := &CLSID{0x54621DFB, 0xF2CE, 0x457E, {0xAE, 0x8C, 0xEC, 0x35, 0x5F, 0xAE, 0xEC, 0x7C}} - -CP_UTF8 :: 65001 -CP_UTF16 :: 1200 -CP_ACP :: 0 - -make_fourcc :: proc "contextless" (ch0, ch1, ch2, ch3: u32) -> u32 { - return ch0 | (ch1 << 8) | (ch2 << 16) | (ch3 << 24) -} - -PART_PDB :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('B')<<24) -PART_PDB_NAME :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('N')<<24) -PART_PRIVATE_DATA :: u32('P') | (u32('R')<<8) | (u32('I')<<16) | (u32('V')<<24) -PART_ROOT_SIGNATURE :: u32('R') | (u32('T')<<8) | (u32('S')<<16) | (u32('0')<<24) -PART_DXIL :: u32('D') | (u32('X')<<8) | (u32('I')<<16) | (u32('L')<<24) -PART_REFLECTION_DATA :: u32('S') | (u32('T')<<8) | (u32('A')<<16) | (u32('T')<<24) -PART_SHADER_HASH :: u32('H') | (u32('A')<<8) | (u32('S')<<16) | (u32('H')<<24) -PART_INPUT_SIGNATURE :: u32('I') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) -PART_OUTPUT_SIGNATURE :: u32('O') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) -PART_PATCH_CONSTANT_SIGNATURE :: u32('P') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) - -ARG_DEBUG :: "-Zi" -ARG_SKIP_VALIDATION :: "-Vd" -ARG_SKIP_OPTIMIZATIONS :: "-Od" -ARG_PACK_MATRIX_ROW_MAJOR :: "-Zpr" -ARG_PACK_MATRIX_COLUMN_MAJOR :: "-Zpc" -ARG_AVOID_FLOW_CONTROL :: "-Gfa" -ARG_PREFER_FLOW_CONTROL :: "-Gfp" -ARG_ENABLE_STRICTNESS :: "-Ges" -ARG_ENABLE_BACKWARDS_COMPATIBILITY :: "-Gec" -ARG_IEEE_STRICTNESS :: "-Gis" -ARG_OPTIMIZATION_LEVEL0 :: "-O0" -ARG_OPTIMIZATION_LEVEL1 :: "-O1" -ARG_OPTIMIZATION_LEVEL2 :: "-O2" -ARG_OPTIMIZATION_LEVEL3 :: "-O3" -ARG_WARNINGS_ARE_ERRORS :: "-WX" -ARG_RESOURCES_MAY_ALIAS :: "-res_may_alias" -ARG_ALL_RESOURCES_BOUND :: "-all_resources_bound" -ARG_DEBUG_NAME_FOR_SOURCE :: "-Zss" -ARG_DEBUG_NAME_FOR_BINARY :: "-Zsb" - -EXTRA_OUTPUT_NAME_STDOUT :: "*stdout*" -EXTRA_OUTPUT_NAME_STDERR :: "*stderr*" diff --git a/vendor/directx/dxc/dxcapi_unix.odin b/vendor/directx/dxc/dxcapi_unix.odin new file mode 100644 index 000000000..d92eaccd7 --- /dev/null +++ b/vendor/directx/dxc/dxcapi_unix.odin @@ -0,0 +1,626 @@ +//+build linux, darwin +package directx_dxc +import "core:c" + +foreign import dxcompiler "system:dxcompiler" + +FILETIME :: struct { + dwLowDateTime: DWORD, + dwHighDateTime: DWORD, +} + +GUID :: struct { + Data1: DWORD, + Data2: WORD, + Data3: WORD, + Data4: [8]BYTE, +} + +BYTE :: distinct u8 +WORD :: u16 +DWORD :: u32 +BOOL :: distinct b32 +SIZE_T :: uint +ULONG :: c.ulong +CLSID :: GUID +IID :: GUID +LONG :: distinct c.long +HRESULT :: distinct LONG +wstring :: [^]c.wchar_t +BSTR :: wstring + +IUnknown :: struct { + using _iunknown_vtable: ^IUnknown_VTable, +} +IUnknown_VTable :: struct { + QueryInterface: proc "c" (this: ^IUnknown, riid: ^IID, ppvObject: ^rawptr) -> HRESULT, + AddRef: proc "c" (this: ^IUnknown) -> ULONG, + Release: proc "c" (this: ^IUnknown) -> ULONG, +} + +@(default_calling_convention="c", link_prefix="Dxc") +foreign dxcompiler { + CreateInstance :: proc (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- + CreateInstance2 :: proc (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- +} + +pCreateInstanceProc :: #type proc "c" (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT +pCreateInstance2Proc :: #type proc "c" (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT + +CreateInstance_ProcName :: "DxcCreateInstance" +CreateInstance2_ProcName :: "DxcCreateInstance2" + +IMalloc :: struct #raw_union { + #subtype iunknown: IUnknown, + using imalloc_vtable: ^IMalloc_VTable, +} +IMalloc_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Alloc: proc "c" (this: ^IMalloc, cb: SIZE_T) -> rawptr, + Realloc: proc "c" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr, + Free: proc "c" (this: ^IMalloc, pv: rawptr), + GetSize: proc "c" (this: ^IMalloc, pv: rawptr) -> SIZE_T, + DidAlloc: proc "c" (this: ^IMalloc, pv: rawptr) -> i32, + HeapMinimize: proc "c" (this: ^IMalloc), +} + +ISequentialStream :: struct #raw_union { + #subtype iunknown: IUnknown, + using isequentialstream_vtable: ^ISequentialStream_VTable, +} +ISequentialStream_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Read: proc "c" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT, + Write: proc "c" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT, +} + +STATSTG :: struct { + pwcsName: wstring, + type: u32, + cbSize: u64, + mtime: FILETIME, + ctime: FILETIME, + atime: FILETIME, + grfMode: u32, + grfLocksSupported: u32, + clsid: CLSID, + grfStateBits: u32, + reserved: u32, +} + +IStream :: struct #raw_union { + #subtype isequentialstream: ISequentialStream, + using istream_vtable: ^IStream_VTable, +} +IStream_VTable :: struct { + using isequentialstream_vtable: ISequentialStream_VTable, + Seek: proc "c" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT, + SetSize: proc "c" (this: ^IStream, libNewSize: u64) -> HRESULT, + CopyTo: proc "c" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT, + Commit: proc "c" (this: ^IStream, grfCommitFlags: u32) -> HRESULT, + Revert: proc "c" (this: ^IStream) -> HRESULT, + LockRegion: proc "c" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, + UnlockRegion: proc "c" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, + Stat: proc "c" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT, + Clone: proc "c" (this: ^IStream, ppstm: ^^IStream) -> HRESULT, +} + +IBlob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102" +IBlob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}} +IBlob :: struct #raw_union { + #subtype iunknown: IUnknown, + using id3d10blob_vtable: ^IBlob_VTable, +} +IBlob_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetBufferPointer: proc "c" (this: ^IBlob) -> rawptr, + GetBufferSize: proc "c" (this: ^IBlob) -> SIZE_T, +} + +IBlobEncoding_UUID_STRRING :: "7241D424-2646-4191-97C0-98E96E42FC68" +IBlobEncoding_UUID := &IID{0x7241D424, 0x2646, 0x4191, {0x97, 0xC0, 0x98, 0xE9, 0x6E, 0x42, 0xFC, 0x68}} +IBlobEncoding :: struct #raw_union { + #subtype idxcblob: IBlob, + using idxcblobencoding_vtable: ^IBlobEncoding_VTable, +} +IBlobEncoding_VTable :: struct { + using idxcblob_vtable: IBlob_VTable, + GetEncoding: proc "c" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT, +} + +IBlobUtf16_UUID_STRING :: "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84" +IBlobUtf16_UUID := &IID{0xA3F84EAB, 0x0FAA, 0x497E, {0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84}} +IBlobUtf16 :: struct #raw_union { + #subtype idxcblobencoding: IBlobEncoding, + using idxcblobutf16_vtable : ^IBlobUtf16_VTable, +} +IBlobUtf16_VTable :: struct { + using idxcblobencoding_vtable: IBlobEncoding_VTable, + GetStringPointer: proc "c" (this: ^IBlobUtf16) -> wstring, + GetStringLength: proc "c" (this: ^IBlobUtf16) -> SIZE_T, +} + +IBlobUtf8_UUID_STRING :: "3DA636C9-BA71-4024-A301-30CBF125305B" +IBlobUtf8_UUID := &IID{0x3DA636C9, 0xBA71, 0x4024, {0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B}} +IBlobUtf8 :: struct #raw_union { + #subtype idxcblobencoding: IBlobEncoding, + using idxcblobutf8_vtable : ^IBlobUtf8_VTable, +} +IBlobUtf8_VTable :: struct { + using idxcblobencoding_vtable: IBlobEncoding_VTable, + GetStringPointer: proc "c" (this: ^IBlobUtf8) -> cstring, + GetStringLength: proc "c" (this: ^IBlobUtf8) -> SIZE_T, +} + +IIncludeHandler_UUID_STRING :: "7F61FC7D-950D-467F-B3E3-3C02FB49187C" +IIncludeHandler_UUID := &IID{0x7F61FC7D, 0x950D, 0x467F, {0xB3, 0xE3, 0x3C, 0x02, 0xFB, 0x49, 0x18, 0x7C}} +IIncludeHandler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcincludehandler_vtable: ^IIncludeHandler_VTable, +} +IIncludeHandler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + LoadSource: proc "c" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT, +} + +Define :: struct { + Name: wstring, + Value: wstring, +} + +ICompilerArgs_UUID_STRING :: "73EFFE2A-70DC-45F8-9690-EFF64C02429D" +ICompilerArgs_UUID := &IID{0x73EFFE2A, 0x70DC, 0x45F8, {0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D}} +ICompilerArgs :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompilerargs_vtable: ^ICompilerArgs_VTable, +} +ICompilerArgs_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetArguments: proc "c" (this: ^ICompilerArgs) -> [^]wstring, + GetCount: proc "c" (this: ^ICompilerArgs) -> u32, + AddArguments: proc "c" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT, + AddArgumentsUTF8: proc "c" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT, + AddDefines: proc "c" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT, +} + +ILibrary_UUID_STRING :: "E5204DC7-D18C-4C3C-BDFB-851673980FE7" +ILibrary_UUID := &IID{0xE5204DC7, 0xD18C, 0x4C3C, {0xBD, 0xFB, 0x85, 0x16, 0x73, 0x98, 0x0F, 0xE7}} +ILibrary :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxclibrary_vtable: ^ILibrary_VTable, +} +ILibrary_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + SetMalloc: proc "c" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT, + CreateBlobFromBlob: proc "c" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, + CreateBlobFromFile: proc "c" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingFromPinned: proc "c" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingOnHeapCopy: proc "c" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingOnMalloc: proc "c" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateIncludeHandler: proc "c" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT, + CreateStreamFromBlobReadOnly: proc "c" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, + GetBlobAsUtf8: proc "c" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + GetBlobAsUtf16: proc "c" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, +} + +IOperationResult_UUID_STRING :: "CEDB484A-D4E9-445A-B991-CA21CA157DC2" +IOperationResult_UUID := &IID{0xCEDB484A, 0xD4E9, 0x445A, {0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2}} +IOperationResult :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoperationresult_vtable: ^IOperationResult_VTable, +} +IOperationResult_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetStatus: proc "c" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT, + GetResult: proc "c" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT, + GetErrorBuffer: proc "c" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT, +} + +ICompiler_UUID_STRING :: "8C210BF3-011F-4422-8D70-6F9ACB8DB617" +ICompiler_UUID := &IID{0x8C210BF3, 0x011F, 0x4422, {0x8D, 0x70, 0x6F, 0x9A, 0xCB, 0x8D, 0xB6, 0x17}} +ICompiler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompiler_vtable: ^ICompiler_VTable, +} +ICompiler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Compile: proc "c" ( + this: ^ICompiler, + pSource: ^Buffer, + pSourceName: wstring, + pEntryPoint: wstring, + pTargetProfile: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult) -> HRESULT, + Preprocess: proc "c" ( + this: ^ICompiler, + pSource: ^Buffer, + pSourceName: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult) -> HRESULT, + Disassemble: proc "c" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT, +} + +ICompiler2_UUID_STRING :: "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37" +ICompiler2_UUID := &IID{0xA005A9D9, 0xB8BB, 0x4594, {0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37}} +ICompiler2 :: struct #raw_union { + #subtype icompiler: ICompiler, + using idxccompiler2_vtable: ^ICompiler2_VTable, +} +ICompiler2_VTable :: struct { + using idxccompiler_vtable: ^ICompiler_VTable, + CompileWithDebug: proc "c" ( + this: ^ICompiler2, + pSource: ^Buffer, + pSourceName: wstring, + pEntryPoint: wstring, + pTargetProfile: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult, + ppDebugBlobName: ^wstring, + ppDebugBlob: ^^IBlob) -> HRESULT, +} + +ILinker_UUID_STRING :: "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6" +ILinker_UUID := &IID{0xF1B5BE2A, 0x62DD, 0x4327, {0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6}} +ILinker :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxclinker_vtable: ^ILinker_VTable, +} +ILinker_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + RegisterLibrary: proc "c" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT, + Link: proc "c" ( + this: ^ILinker, + pEntryName: wstring, + pTargetProfile: wstring, + pLibNames: [^]wstring, + libCount: u32, + pArguments: [^]wstring, + argCount: u32, + ppResult: ^^IOperationResult) -> HRESULT, +} + +Buffer :: struct { + Ptr: rawptr, + Size: SIZE_T, + Encoding: u32, +} + +IUtils_UUID_STRING :: "4605C4CB-2019-492A-ADA4-65F20BB7D67F" +IUtils_UUID := &IID{0x4605C4CB, 0x2019, 0x492A, {0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F}} +IUtils :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcutils_vtable: ^IUtils_VTable, +} +IUtils_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + CreateBlobFromBlob: proc "c" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, + CreateBlobFromPinned: proc "c" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + MoveToBlob: proc "c" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlob: proc "c" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + LoadFile: proc "c" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateReadOnlyStreamFromBlob: proc "c" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, + CreateDefaultIncludeHandler: proc "c" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT, + GetBlobAsUtf8: proc "c" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT, + GetBlobAsUtf16: proc "c" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT, + GetDxilContainerPart: proc "c" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT, + CreateReflection: proc "c" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT, + BuildArguments: proc "c" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT, + GetPDBContents: proc "c" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT, +} + +DXC_OUT_KIND :: enum u32 { + NONE = 0, + OBJECT = 1, + ERRORS = 2, + PDB = 3, + SHADER_HASH = 4, + DISASSEMBLY = 5, + HLSL = 6, + TEXT = 7, + REFLECTION = 8, + ROOT_SIGNATURE = 9, + EXTRA_OUTPUTS = 10, + FORCE_DWORD = 0xFFFFFFFF, +} + +IResult_UUID_STRING :: "58346CDA-DDE7-4497-9461-6F87AF5E0659" +IResult_UUID := &IID{0x58346CDA, 0xDDE7, 0x4497, {0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59}} +IResult :: struct #raw_union { + #subtype idxcoperationresult: IOperationResult, + using idxcresult_vtable: ^IResult_VTable, +} +IResult_VTable :: struct { + using idxcoperationresult_vtable: IOperationResult_VTable, + HasOutput: proc "c" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL, + GetOutput: proc "c" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT, + GetNumOutputs: proc "c" (this: ^IResult) -> u32, + GetOutputByIndex: proc "c" (this: ^IResult, Index: u32) -> DXC_OUT_KIND, + PrimaryOutput: proc "c" (this: ^IResult) -> DXC_OUT_KIND, +} + +IExtraOutputs_UUID_STRING :: "319B37A2-A5C2-494A-A5DE-4801B2FAF989" +IExtraOutputs_UUID := &IID{0x319B37A2, 0xA5C2, 0x494A, {0xA5, 0xDE, 0x48, 0x01, 0xB2, 0xFA, 0xF9, 0x89}} +IExtraOutputs :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcextraoutputs_vtable: ^IExtraOutputs_VTable, +} +IExtraOutputs_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetOutputCount: proc "c" (this: ^IExtraOutputs) -> u32, + GetOutput: proc "c" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT, +} + +ICompiler3_UUID_STRING :: "228B4687-5A6A-4730-900C-9702B2203F54" +ICompiler3_UUID := &IID{0x228B4687, 0x5A6A, 0x4730, {0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54}} +ICompiler3 :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompiler3_vtable: ^ICompiler3_VTable, +} +ICompiler3_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Compile: proc "c" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT, + Disassemble: proc "c" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT, +} + +IValidator_UUID_STRING :: "A6E82BD2-1FD7-4826-9811-2857E797F49A" +IValidator_UUID := &IID{0xA6E82BD2, 0x1FD7, 0x4826, {0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A}} +IValidator :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcvalidator_vtable: ^IValidator_VTable, +} +IValidator_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Validate: proc "c" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT, +} + +IValidator2_UUID_STRING :: "458E1FD1-B1B2-4750-A6E1-9C10F03BED92" +IValidator2_UUID := &IID{0x458E1FD1, 0xB1B2, 0x4750, {0xA6, 0xE1, 0x9C, 0x10, 0xF0, 0x3B, 0xED, 0x92}} +IValidator2 :: struct #raw_union { + #subtype idxcvalidator: IValidator, + using idxcvalidator2_vtable: ^IValidator2_VTable, +} +IValidator2_VTable :: struct { + using idxcvalidator_vtable: IValidator_VTable, + ValidateWithDebug: proc "c" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT, +} + +IContainerBuilder_UUID_STRING :: "334B1F50-2292-4B35-99A1-25588D8C17FE" +IContainerBuilder_UUID := &IID{0x334B1F50, 0x2292, 0x4B35, {0x99, 0xA1, 0x25, 0x58, 0x8D, 0x8C, 0x17, 0xFE}} +IContainerBuilder :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccontainerbuilder_vtable: ^IContainerBuilder_VTable, +} +IContainerBuilder_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "c" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT, + AddPart: proc "c" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT, + RemovePart: proc "c" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT, + SerializeContainer: proc "c" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT, +} + +IAssembler_UUID_STRING :: "091F7A26-1C1F-4948-904B-E6E3A8A771D5" +IAssembler_UUID := &IID{0x091F7A26, 0x1C1F, 0x4948, {0x90, 0x4B, 0xE6, 0xE3, 0xA8, 0xA7, 0x71, 0xD5}} +IAssembler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcassembler_vtable: ^IAssembler_VTable, +} +IAssembler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + AssembleToContainer: proc "c" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT, +} + +IContainerReflection_UUID_STRING :: "D2C21B26-8350-4BDC-976A-331CE6F4C54C" +IContainerReflection_UUID := &IID{0xD2C21B26, 0x8350, 0x4BDC, {0x97, 0x6A, 0x33, 0x1C, 0xE6, 0xF4, 0xC5, 0x4C}} +IContainerReflection :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccontainerreflection_vtable: ^IContainerReflection_VTable, +} +IContainerReflection_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "c" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT, + GetPartCount: proc "c" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT, + GetPartKind: proc "c" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT, + GetPartContent: proc "c" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT, + FindFirstPartKind: proc "c" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT, + GetPartReflection: proc "c" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT, +} + +IOptimizerPass_UUID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" +IOptimizerPass_UUID := &IID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} +IOptimizerPass :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoptimizerpass_vtable: ^IOptimizerPass_VTable, +} +IOptimizerPass_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetOptionName: proc "c" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, + GetDescription: proc "c" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, + GetOptionArgCount: proc "c" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT, + GetOptionArgName: proc "c" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, + GetOptionArgDescription: proc "c" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, +} + +IOptimizer_UUID_STRING :: "25740E2E-9CBA-401B-9119-4FB42F39F270" +IOptimizer_UUID := &IID{0x25740E2E, 0x9CBA, 0x401B, {0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70}} +IOptimizer :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoptimizer_vtable: ^IOptimizer_VTable, +} +IOptimizer_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetAvailablePassCount: proc "c" (this: ^IOptimizer, pCount: ^u32) -> HRESULT, + GetAvailablePass: proc "c" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT, + RunOptimizer: proc "c" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT, +} + +VersionInfoFlags :: enum u32 { + None = 0, + Debug = 1, + Internal = 2, +} + +IVersionInfo_UUID_STRING :: "B04F5B50-2059-4F12-A8FF-A1E0CDE1CC7E" +IVersionInfo_UUID := &IID{0xB04F5B50, 0x2059, 0x4F12, {0xA8, 0xFF, 0xA1, 0xE0, 0xCD, 0xE1, 0xCC, 0x7E}} +IVersionInfo :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcversioninfo_vtable: ^IVersionInfo_VTable, +} +IVersionInfo_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetVersion: proc "c" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT, + GetFlags: proc "c" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT, +} + +IVersionInfo2_UUID_STRING :: "FB6904C4-42F0-4B62-9C46-983AF7DA7C83" +IVersionInfo2_UUID := &IID{0xFB6904C4, 0x42F0, 0x4B62, {0x9C, 0x46, 0x98, 0x3A, 0xF7, 0xDA, 0x7C, 0x83}} +IVersionInfo2 :: struct #raw_union { + #subtype idxcversioninfo: IVersionInfo, + using idxcversioninfo2_vtable: ^IVersionInfo2_VTable, +} +IVersionInfo2_VTable :: struct { + using idxcversioninfo_vtable: IVersionInfo_VTable, + GetCommitInfo: proc "c" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT, +} + +IVersionInfo3_UUID_STRING :: "5E13E843-9D25-473C-9AD2-03B2D0B44B1E" +IVersionInfo3_UUID := &IID{0x5E13E843, 0x9D25, 0x473C, {0x9A, 0xD2, 0x03, 0xB2, 0xD0, 0xB4, 0x4B, 0x1E}} +IVersionInfo3 :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcversioninfo3_vtable: ^IVersionInfo3_VTable, +} +IVersionInfo3_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetCustomVersionString: proc "c" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT, +} + +ArgPair :: struct { + pName: wstring, + pValue: wstring, +} + +IPdbUtils_UUID_STRING :: "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D" +IPdbUtils_UUID := &IID{0xE6C9647E, 0x9D6A, 0x4C3B, {0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D}} +IPdbUtils :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcpdbutils_vtable: ^IPdbUtils_VTable, +} +IPdbUtils_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "c" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT, + GetSourceCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetSource: proc "c" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT, + GetSourceName: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetFlagCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetFlag: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetArgCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetArg: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetArgPairCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetArgPair: proc "c" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT, + GetDefineCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetDefine: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetTargetProfile: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetEntryPoint: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetMainFileName: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetHash: proc "c" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT, + GetName: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + IsFullPDB: proc "c" (this: ^IPdbUtils) -> BOOL, + GetFullPDB: proc "c" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT, + GetVersionInfo: proc "c" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT, + SetCompiler: proc "c" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT, + CompileForFullPDB: proc "c" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT, + OverrideArgs: proc "c" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT, + OverrideRootSignature: proc "c" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT, +} + + +Compiler_CLSID_STRING :: "73E22D93-E6CE-47F3-B5BF-F0664F39C1B0" +Compiler_CLSID := &CLSID{0x73E22D93, 0xE6CE, 0x47F3, {0xB5, 0xBF, 0xF0, 0x66, 0x4F, 0x39, 0xC1, 0xB0}} + +Linker_CLSID_STRING :: "EF6A8087-B0EA-4D56-9E45-D07E1A8B7806" +Linker_CLSID := &CLSID{0xEF6A8087, 0xB0EA, 0x4D56, {0x9E, 0x45, 0xD0, 0x7E, 0x1A, 0x8B, 0x78, 0x6}} + +DiaDataSource_CLSID_STRING :: "CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F" +DiaDataSource_CLSID := &CLSID{0xCD1F6B73, 0x2AB0, 0x484D, {0x8E, 0xDC, 0xEB, 0xE7, 0xA4, 0x3C, 0xA0, 0x9F}} + +CompilerArgs_CLSID_STRING :: "3E56AE82-224D-470F-A1A1-FE3016EE9F9D" +CompilerArgs_CLSID := &CLSID{0x3E56AE82, 0x224D, 0x470F, {0xA1, 0xA1, 0xFE, 0x30, 0x16, 0xEE, 0x9F, 0x9D}} + +Library_CLSID_STRING :: "6245D6AF-66E0-48FD-80B4-4D271796748C" +Library_CLSID := &CLSID{0x6245D6AF, 0x66E0, 0x48FD, {0x80, 0xB4, 0x4D, 0x27, 0x17, 0x96, 0x74, 0x8C}} + +Utils_CLSID_STRING :: Library_CLSID_STRING +Utils_CLSID := Library_CLSID + +Validator_CLSID_STRING :: "8CA3E215-F728-4CF3-8CDD-88AF917587A1" +Validator_CLSID := &CLSID{0x8CA3E215, 0xF728, 0x4CF3, {0x8C, 0xDD, 0x88, 0xAF, 0x91, 0x75, 0x87, 0xA1}} + +Assembler_CLSID_STRING :: "D728DB68-F903-4F80-94CD-DCCF76EC7151" +Assembler_CLSID := &CLSID{0xD728DB68, 0xF903, 0x4F80, {0x94, 0xCD, 0xDC, 0xCF, 0x76, 0xEC, 0x71, 0x51}} + +ContainerReflection_CLSID_STRING :: "b9f54489-55b8-400c-ba3a-1675e4728b91" +ContainerReflection_CLSID := &CLSID{0xB9F54489, 0x55B8, 0x400C, {0xBA, 0x3A, 0x16, 0x75, 0xE4, 0x72, 0x8B, 0x91}} + +Optimizer_CLSID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" +Optimizer_CLSID := &CLSID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} + +ContainerBuilder_CLSID_STRING :: "94134294-411f-4574-b4d0-8741e25240d2" +ContainerBuilder_CLSID := &CLSID{0x94134294, 0x411F, 0x4574, {0xB4, 0xD0, 0x87, 0x41, 0xE2, 0x52, 0x40, 0xD2}} + +PdbUtils_CLSID_STRING :: "54621dfb-f2ce-457e-ae8c-ec355faeec7c" +PdbUtils_CLSID := &CLSID{0x54621DFB, 0xF2CE, 0x457E, {0xAE, 0x8C, 0xEC, 0x35, 0x5F, 0xAE, 0xEC, 0x7C}} + +CP_UTF8 :: 65001 +CP_UTF16 :: 1200 +CP_ACP :: 0 + +make_fourcc :: proc "contextless" (ch0, ch1, ch2, ch3: u32) -> u32 { + return ch0 | (ch1 << 8) | (ch2 << 16) | (ch3 << 24) +} + +PART_PDB :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('B')<<24) +PART_PDB_NAME :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('N')<<24) +PART_PRIVATE_DATA :: u32('P') | (u32('R')<<8) | (u32('I')<<16) | (u32('V')<<24) +PART_ROOT_SIGNATURE :: u32('R') | (u32('T')<<8) | (u32('S')<<16) | (u32('0')<<24) +PART_DXIL :: u32('D') | (u32('X')<<8) | (u32('I')<<16) | (u32('L')<<24) +PART_REFLECTION_DATA :: u32('S') | (u32('T')<<8) | (u32('A')<<16) | (u32('T')<<24) +PART_SHADER_HASH :: u32('H') | (u32('A')<<8) | (u32('S')<<16) | (u32('H')<<24) +PART_INPUT_SIGNATURE :: u32('I') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) +PART_OUTPUT_SIGNATURE :: u32('O') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) +PART_PATCH_CONSTANT_SIGNATURE :: u32('P') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) + +ARG_DEBUG :: "-Zi" +ARG_SKIP_VALIDATION :: "-Vd" +ARG_SKIP_OPTIMIZATIONS :: "-Od" +ARG_PACK_MATRIX_ROW_MAJOR :: "-Zpr" +ARG_PACK_MATRIX_COLUMN_MAJOR :: "-Zpc" +ARG_AVOID_FLOW_CONTROL :: "-Gfa" +ARG_PREFER_FLOW_CONTROL :: "-Gfp" +ARG_ENABLE_STRICTNESS :: "-Ges" +ARG_ENABLE_BACKWARDS_COMPATIBILITY :: "-Gec" +ARG_IEEE_STRICTNESS :: "-Gis" +ARG_OPTIMIZATION_LEVEL0 :: "-O0" +ARG_OPTIMIZATION_LEVEL1 :: "-O1" +ARG_OPTIMIZATION_LEVEL2 :: "-O2" +ARG_OPTIMIZATION_LEVEL3 :: "-O3" +ARG_WARNINGS_ARE_ERRORS :: "-WX" +ARG_RESOURCES_MAY_ALIAS :: "-res_may_alias" +ARG_ALL_RESOURCES_BOUND :: "-all_resources_bound" +ARG_DEBUG_NAME_FOR_SOURCE :: "-Zss" +ARG_DEBUG_NAME_FOR_BINARY :: "-Zsb" + +EXTRA_OUTPUT_NAME_STDOUT :: "*stdout*" +EXTRA_OUTPUT_NAME_STDERR :: "*stderr*" diff --git a/vendor/directx/dxc/dxcapi_windows.odin b/vendor/directx/dxc/dxcapi_windows.odin new file mode 100644 index 000000000..217fd1f21 --- /dev/null +++ b/vendor/directx/dxc/dxcapi_windows.odin @@ -0,0 +1,604 @@ +//+build windows +package directx_dxc +import win32 "core:sys/windows" +import dxgi "vendor:directx/dxgi" +foreign import "dxcompiler.lib" + +BOOL :: dxgi.BOOL +SIZE_T :: dxgi.SIZE_T +ULONG :: dxgi.ULONG +CLSID :: dxgi.GUID +IID :: dxgi.IID +HRESULT :: dxgi.HRESULT +IUnknown :: dxgi.IUnknown +IUnknown_VTable :: dxgi.IUnknown_VTable +wstring :: win32.wstring +FILETIME :: win32.FILETIME +BSTR :: wstring + +@(default_calling_convention="c", link_prefix="Dxc") +foreign dxcompiler { + CreateInstance :: proc (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- + CreateInstance2 :: proc (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- +} + +pCreateInstanceProc :: #type proc "c" (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT +pCreateInstance2Proc :: #type proc "c" (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT + +CreateInstance_ProcName :: "DxcCreateInstance" +CreateInstance2_ProcName :: "DxcCreateInstance2" + +IMalloc :: struct #raw_union { + #subtype iunknown: IUnknown, + using imalloc_vtable: ^IMalloc_VTable, +} +IMalloc_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Alloc: proc "stdcall" (this: ^IMalloc, cb: SIZE_T) -> rawptr, + Realloc: proc "stdcall" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr, + Free: proc "stdcall" (this: ^IMalloc, pv: rawptr), + GetSize: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> SIZE_T, + DidAlloc: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> i32, + HeapMinimize: proc "stdcall" (this: ^IMalloc), +} + +ISequentialStream :: struct #raw_union { + #subtype iunknown: IUnknown, + using isequentialstream_vtable: ^ISequentialStream_VTable, +} +ISequentialStream_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Read: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT, + Write: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT, +} + +STATSTG :: struct { + pwcsName: wstring, + type: u32, + cbSize: u64, + mtime: FILETIME, + ctime: FILETIME, + atime: FILETIME, + grfMode: u32, + grfLocksSupported: u32, + clsid: CLSID, + grfStateBits: u32, + reserved: u32, +} + +IStream :: struct #raw_union { + #subtype isequentialstream: ISequentialStream, + using istream_vtable: ^IStream_VTable, +} +IStream_VTable :: struct { + using isequentialstream_vtable: ISequentialStream_VTable, + Seek: proc "stdcall" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT, + SetSize: proc "stdcall" (this: ^IStream, libNewSize: u64) -> HRESULT, + CopyTo: proc "stdcall" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT, + Commit: proc "stdcall" (this: ^IStream, grfCommitFlags: u32) -> HRESULT, + Revert: proc "stdcall" (this: ^IStream) -> HRESULT, + LockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, + UnlockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, + Stat: proc "stdcall" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT, + Clone: proc "stdcall" (this: ^IStream, ppstm: ^^IStream) -> HRESULT, +} + +IBlob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102" +IBlob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}} +IBlob :: struct #raw_union { + #subtype iunknown: IUnknown, + using id3d10blob_vtable: ^IBlob_VTable, +} +IBlob_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetBufferPointer: proc "stdcall" (this: ^IBlob) -> rawptr, + GetBufferSize: proc "stdcall" (this: ^IBlob) -> SIZE_T, +} + +IBlobEncoding_UUID_STRRING :: "7241D424-2646-4191-97C0-98E96E42FC68" +IBlobEncoding_UUID := &IID{0x7241D424, 0x2646, 0x4191, {0x97, 0xC0, 0x98, 0xE9, 0x6E, 0x42, 0xFC, 0x68}} +IBlobEncoding :: struct #raw_union { + #subtype idxcblob: IBlob, + using idxcblobencoding_vtable: ^IBlobEncoding_VTable, +} +IBlobEncoding_VTable :: struct { + using idxcblob_vtable: IBlob_VTable, + GetEncoding: proc "stdcall" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT, +} + +IBlobUtf16_UUID_STRING :: "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84" +IBlobUtf16_UUID := &IID{0xA3F84EAB, 0x0FAA, 0x497E, {0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84}} +IBlobUtf16 :: struct #raw_union { + #subtype idxcblobencoding: IBlobEncoding, + using idxcblobutf16_vtable : ^IBlobUtf16_VTable, +} +IBlobUtf16_VTable :: struct { + using idxcblobencoding_vtable: IBlobEncoding_VTable, + GetStringPointer: proc "stdcall" (this: ^IBlobUtf16) -> wstring, + GetStringLength: proc "stdcall" (this: ^IBlobUtf16) -> SIZE_T, +} + +IBlobUtf8_UUID_STRING :: "3DA636C9-BA71-4024-A301-30CBF125305B" +IBlobUtf8_UUID := &IID{0x3DA636C9, 0xBA71, 0x4024, {0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B}} +IBlobUtf8 :: struct #raw_union { + #subtype idxcblobencoding: IBlobEncoding, + using idxcblobutf8_vtable : ^IBlobUtf8_VTable, +} +IBlobUtf8_VTable :: struct { + using idxcblobencoding_vtable: IBlobEncoding_VTable, + GetStringPointer: proc "stdcall" (this: ^IBlobUtf8) -> cstring, + GetStringLength: proc "stdcall" (this: ^IBlobUtf8) -> SIZE_T, +} + +IIncludeHandler_UUID_STRING :: "7F61FC7D-950D-467F-B3E3-3C02FB49187C" +IIncludeHandler_UUID := &IID{0x7F61FC7D, 0x950D, 0x467F, {0xB3, 0xE3, 0x3C, 0x02, 0xFB, 0x49, 0x18, 0x7C}} +IIncludeHandler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcincludehandler_vtable: ^IIncludeHandler_VTable, +} +IIncludeHandler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + LoadSource: proc "stdcall" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT, +} + +Define :: struct { + Name: wstring, + Value: wstring, +} + +ICompilerArgs_UUID_STRING :: "73EFFE2A-70DC-45F8-9690-EFF64C02429D" +ICompilerArgs_UUID := &IID{0x73EFFE2A, 0x70DC, 0x45F8, {0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D}} +ICompilerArgs :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompilerargs_vtable: ^ICompilerArgs_VTable, +} +ICompilerArgs_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetArguments: proc "stdcall" (this: ^ICompilerArgs) -> [^]wstring, + GetCount: proc "stdcall" (this: ^ICompilerArgs) -> u32, + AddArguments: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT, + AddArgumentsUTF8: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT, + AddDefines: proc "stdcall" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT, +} + +ILibrary_UUID_STRING :: "E5204DC7-D18C-4C3C-BDFB-851673980FE7" +ILibrary_UUID := &IID{0xE5204DC7, 0xD18C, 0x4C3C, {0xBD, 0xFB, 0x85, 0x16, 0x73, 0x98, 0x0F, 0xE7}} +ILibrary :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxclibrary_vtable: ^ILibrary_VTable, +} +ILibrary_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + SetMalloc: proc "stdcall" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT, + CreateBlobFromBlob: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, + CreateBlobFromFile: proc "stdcall" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingFromPinned: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingOnHeapCopy: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingOnMalloc: proc "stdcall" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateIncludeHandler: proc "stdcall" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT, + CreateStreamFromBlobReadOnly: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, + GetBlobAsUtf8: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + GetBlobAsUtf16: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, +} + +IOperationResult_UUID_STRING :: "CEDB484A-D4E9-445A-B991-CA21CA157DC2" +IOperationResult_UUID := &IID{0xCEDB484A, 0xD4E9, 0x445A, {0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2}} +IOperationResult :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoperationresult_vtable: ^IOperationResult_VTable, +} +IOperationResult_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetStatus: proc "stdcall" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT, + GetResult: proc "stdcall" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT, + GetErrorBuffer: proc "stdcall" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT, +} + +ICompiler_UUID_STRING :: "8C210BF3-011F-4422-8D70-6F9ACB8DB617" +ICompiler_UUID := &IID{0x8C210BF3, 0x011F, 0x4422, {0x8D, 0x70, 0x6F, 0x9A, 0xCB, 0x8D, 0xB6, 0x17}} +ICompiler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompiler_vtable: ^ICompiler_VTable, +} +ICompiler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Compile: proc "stdcall" ( + this: ^ICompiler, + pSource: ^Buffer, + pSourceName: wstring, + pEntryPoint: wstring, + pTargetProfile: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult) -> HRESULT, + Preprocess: proc "stdcall" ( + this: ^ICompiler, + pSource: ^Buffer, + pSourceName: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult) -> HRESULT, + Disassemble: proc "stdcall" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT, +} + +ICompiler2_UUID_STRING :: "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37" +ICompiler2_UUID := &IID{0xA005A9D9, 0xB8BB, 0x4594, {0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37}} +ICompiler2 :: struct #raw_union { + #subtype icompiler: ICompiler, + using idxccompiler2_vtable: ^ICompiler2_VTable, +} +ICompiler2_VTable :: struct { + using idxccompiler_vtable: ^ICompiler_VTable, + CompileWithDebug: proc "stdcall" ( + this: ^ICompiler2, + pSource: ^Buffer, + pSourceName: wstring, + pEntryPoint: wstring, + pTargetProfile: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult, + ppDebugBlobName: ^wstring, + ppDebugBlob: ^^IBlob) -> HRESULT, +} + +ILinker_UUID_STRING :: "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6" +ILinker_UUID := &IID{0xF1B5BE2A, 0x62DD, 0x4327, {0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6}} +ILinker :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxclinker_vtable: ^ILinker_VTable, +} +ILinker_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + RegisterLibrary: proc "stdcall" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT, + Link: proc "stdcall" ( + this: ^ILinker, + pEntryName: wstring, + pTargetProfile: wstring, + pLibNames: [^]wstring, + libCount: u32, + pArguments: [^]wstring, + argCount: u32, + ppResult: ^^IOperationResult) -> HRESULT, +} + +Buffer :: struct { + Ptr: rawptr, + Size: SIZE_T, + Encoding: u32, +} + +IUtils_UUID_STRING :: "4605C4CB-2019-492A-ADA4-65F20BB7D67F" +IUtils_UUID := &IID{0x4605C4CB, 0x2019, 0x492A, {0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F}} +IUtils :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcutils_vtable: ^IUtils_VTable, +} +IUtils_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + CreateBlobFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, + CreateBlobFromPinned: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + MoveToBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + LoadFile: proc "stdcall" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateReadOnlyStreamFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, + CreateDefaultIncludeHandler: proc "stdcall" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT, + GetBlobAsUtf8: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT, + GetBlobAsUtf16: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT, + GetDxilContainerPart: proc "stdcall" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT, + CreateReflection: proc "stdcall" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT, + BuildArguments: proc "stdcall" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT, + GetPDBContents: proc "stdcall" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT, +} + +DXC_OUT_KIND :: enum u32 { + NONE = 0, + OBJECT = 1, + ERRORS = 2, + PDB = 3, + SHADER_HASH = 4, + DISASSEMBLY = 5, + HLSL = 6, + TEXT = 7, + REFLECTION = 8, + ROOT_SIGNATURE = 9, + EXTRA_OUTPUTS = 10, + FORCE_DWORD = 0xFFFFFFFF, +} + +IResult_UUID_STRING :: "58346CDA-DDE7-4497-9461-6F87AF5E0659" +IResult_UUID := &IID{0x58346CDA, 0xDDE7, 0x4497, {0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59}} +IResult :: struct #raw_union { + #subtype idxcoperationresult: IOperationResult, + using idxcresult_vtable: ^IResult_VTable, +} +IResult_VTable :: struct { + using idxcoperationresult_vtable: IOperationResult_VTable, + HasOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL, + GetOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT, + GetNumOutputs: proc "stdcall" (this: ^IResult) -> u32, + GetOutputByIndex: proc "stdcall" (this: ^IResult, Index: u32) -> DXC_OUT_KIND, + PrimaryOutput: proc "stdcall" (this: ^IResult) -> DXC_OUT_KIND, +} + +IExtraOutputs_UUID_STRING :: "319B37A2-A5C2-494A-A5DE-4801B2FAF989" +IExtraOutputs_UUID := &IID{0x319B37A2, 0xA5C2, 0x494A, {0xA5, 0xDE, 0x48, 0x01, 0xB2, 0xFA, 0xF9, 0x89}} +IExtraOutputs :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcextraoutputs_vtable: ^IExtraOutputs_VTable, +} +IExtraOutputs_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetOutputCount: proc "stdcall" (this: ^IExtraOutputs) -> u32, + GetOutput: proc "stdcall" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT, +} + +ICompiler3_UUID_STRING :: "228B4687-5A6A-4730-900C-9702B2203F54" +ICompiler3_UUID := &IID{0x228B4687, 0x5A6A, 0x4730, {0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54}} +ICompiler3 :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompiler3_vtable: ^ICompiler3_VTable, +} +ICompiler3_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Compile: proc "stdcall" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT, + Disassemble: proc "stdcall" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT, +} + +IValidator_UUID_STRING :: "A6E82BD2-1FD7-4826-9811-2857E797F49A" +IValidator_UUID := &IID{0xA6E82BD2, 0x1FD7, 0x4826, {0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A}} +IValidator :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcvalidator_vtable: ^IValidator_VTable, +} +IValidator_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Validate: proc "stdcall" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT, +} + +IValidator2_UUID_STRING :: "458E1FD1-B1B2-4750-A6E1-9C10F03BED92" +IValidator2_UUID := &IID{0x458E1FD1, 0xB1B2, 0x4750, {0xA6, 0xE1, 0x9C, 0x10, 0xF0, 0x3B, 0xED, 0x92}} +IValidator2 :: struct #raw_union { + #subtype idxcvalidator: IValidator, + using idxcvalidator2_vtable: ^IValidator2_VTable, +} +IValidator2_VTable :: struct { + using idxcvalidator_vtable: IValidator_VTable, + ValidateWithDebug: proc "stdcall" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT, +} + +IContainerBuilder_UUID_STRING :: "334B1F50-2292-4B35-99A1-25588D8C17FE" +IContainerBuilder_UUID := &IID{0x334B1F50, 0x2292, 0x4B35, {0x99, 0xA1, 0x25, 0x58, 0x8D, 0x8C, 0x17, 0xFE}} +IContainerBuilder :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccontainerbuilder_vtable: ^IContainerBuilder_VTable, +} +IContainerBuilder_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "stdcall" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT, + AddPart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT, + RemovePart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT, + SerializeContainer: proc "stdcall" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT, +} + +IAssembler_UUID_STRING :: "091F7A26-1C1F-4948-904B-E6E3A8A771D5" +IAssembler_UUID := &IID{0x091F7A26, 0x1C1F, 0x4948, {0x90, 0x4B, 0xE6, 0xE3, 0xA8, 0xA7, 0x71, 0xD5}} +IAssembler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcassembler_vtable: ^IAssembler_VTable, +} +IAssembler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + AssembleToContainer: proc "stdcall" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT, +} + +IContainerReflection_UUID_STRING :: "D2C21B26-8350-4BDC-976A-331CE6F4C54C" +IContainerReflection_UUID := &IID{0xD2C21B26, 0x8350, 0x4BDC, {0x97, 0x6A, 0x33, 0x1C, 0xE6, 0xF4, 0xC5, 0x4C}} +IContainerReflection :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccontainerreflection_vtable: ^IContainerReflection_VTable, +} +IContainerReflection_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "stdcall" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT, + GetPartCount: proc "stdcall" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT, + GetPartKind: proc "stdcall" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT, + GetPartContent: proc "stdcall" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT, + FindFirstPartKind: proc "stdcall" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT, + GetPartReflection: proc "stdcall" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT, +} + +IOptimizerPass_UUID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" +IOptimizerPass_UUID := &IID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} +IOptimizerPass :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoptimizerpass_vtable: ^IOptimizerPass_VTable, +} +IOptimizerPass_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetOptionName: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, + GetDescription: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, + GetOptionArgCount: proc "stdcall" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT, + GetOptionArgName: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, + GetOptionArgDescription: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, +} + +IOptimizer_UUID_STRING :: "25740E2E-9CBA-401B-9119-4FB42F39F270" +IOptimizer_UUID := &IID{0x25740E2E, 0x9CBA, 0x401B, {0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70}} +IOptimizer :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoptimizer_vtable: ^IOptimizer_VTable, +} +IOptimizer_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetAvailablePassCount: proc "stdcall" (this: ^IOptimizer, pCount: ^u32) -> HRESULT, + GetAvailablePass: proc "stdcall" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT, + RunOptimizer: proc "stdcall" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT, +} + +VersionInfoFlags :: enum u32 { + None = 0, + Debug = 1, + Internal = 2, +} + +IVersionInfo_UUID_STRING :: "B04F5B50-2059-4F12-A8FF-A1E0CDE1CC7E" +IVersionInfo_UUID := &IID{0xB04F5B50, 0x2059, 0x4F12, {0xA8, 0xFF, 0xA1, 0xE0, 0xCD, 0xE1, 0xCC, 0x7E}} +IVersionInfo :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcversioninfo_vtable: ^IVersionInfo_VTable, +} +IVersionInfo_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetVersion: proc "stdcall" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT, + GetFlags: proc "stdcall" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT, +} + +IVersionInfo2_UUID_STRING :: "FB6904C4-42F0-4B62-9C46-983AF7DA7C83" +IVersionInfo2_UUID := &IID{0xFB6904C4, 0x42F0, 0x4B62, {0x9C, 0x46, 0x98, 0x3A, 0xF7, 0xDA, 0x7C, 0x83}} +IVersionInfo2 :: struct #raw_union { + #subtype idxcversioninfo: IVersionInfo, + using idxcversioninfo2_vtable: ^IVersionInfo2_VTable, +} +IVersionInfo2_VTable :: struct { + using idxcversioninfo_vtable: IVersionInfo_VTable, + GetCommitInfo: proc "stdcall" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT, +} + +IVersionInfo3_UUID_STRING :: "5E13E843-9D25-473C-9AD2-03B2D0B44B1E" +IVersionInfo3_UUID := &IID{0x5E13E843, 0x9D25, 0x473C, {0x9A, 0xD2, 0x03, 0xB2, 0xD0, 0xB4, 0x4B, 0x1E}} +IVersionInfo3 :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcversioninfo3_vtable: ^IVersionInfo3_VTable, +} +IVersionInfo3_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetCustomVersionString: proc "stdcall" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT, +} + +ArgPair :: struct { + pName: wstring, + pValue: wstring, +} + +IPdbUtils_UUID_STRING :: "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D" +IPdbUtils_UUID := &IID{0xE6C9647E, 0x9D6A, 0x4C3B, {0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D}} +IPdbUtils :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcpdbutils_vtable: ^IPdbUtils_VTable, +} +IPdbUtils_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "stdcall" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT, + GetSourceCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetSource: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT, + GetSourceName: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetFlagCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetFlag: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetArgCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetArg: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetArgPairCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetArgPair: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT, + GetDefineCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetDefine: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetTargetProfile: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetEntryPoint: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetMainFileName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetHash: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT, + GetName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + IsFullPDB: proc "stdcall" (this: ^IPdbUtils) -> BOOL, + GetFullPDB: proc "stdcall" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT, + GetVersionInfo: proc "stdcall" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT, + SetCompiler: proc "stdcall" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT, + CompileForFullPDB: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT, + OverrideArgs: proc "stdcall" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT, + OverrideRootSignature: proc "stdcall" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT, +} + + +Compiler_CLSID_STRING :: "73E22D93-E6CE-47F3-B5BF-F0664F39C1B0" +Compiler_CLSID := &CLSID{0x73E22D93, 0xE6CE, 0x47F3, {0xB5, 0xBF, 0xF0, 0x66, 0x4F, 0x39, 0xC1, 0xB0}} + +Linker_CLSID_STRING :: "EF6A8087-B0EA-4D56-9E45-D07E1A8B7806" +Linker_CLSID := &CLSID{0xEF6A8087, 0xB0EA, 0x4D56, {0x9E, 0x45, 0xD0, 0x7E, 0x1A, 0x8B, 0x78, 0x6}} + +DiaDataSource_CLSID_STRING :: "CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F" +DiaDataSource_CLSID := &CLSID{0xCD1F6B73, 0x2AB0, 0x484D, {0x8E, 0xDC, 0xEB, 0xE7, 0xA4, 0x3C, 0xA0, 0x9F}} + +CompilerArgs_CLSID_STRING :: "3E56AE82-224D-470F-A1A1-FE3016EE9F9D" +CompilerArgs_CLSID := &CLSID{0x3E56AE82, 0x224D, 0x470F, {0xA1, 0xA1, 0xFE, 0x30, 0x16, 0xEE, 0x9F, 0x9D}} + +Library_CLSID_STRING :: "6245D6AF-66E0-48FD-80B4-4D271796748C" +Library_CLSID := &CLSID{0x6245D6AF, 0x66E0, 0x48FD, {0x80, 0xB4, 0x4D, 0x27, 0x17, 0x96, 0x74, 0x8C}} + +Utils_CLSID_STRING :: Library_CLSID_STRING +Utils_CLSID := Library_CLSID + +Validator_CLSID_STRING :: "8CA3E215-F728-4CF3-8CDD-88AF917587A1" +Validator_CLSID := &CLSID{0x8CA3E215, 0xF728, 0x4CF3, {0x8C, 0xDD, 0x88, 0xAF, 0x91, 0x75, 0x87, 0xA1}} + +Assembler_CLSID_STRING :: "D728DB68-F903-4F80-94CD-DCCF76EC7151" +Assembler_CLSID := &CLSID{0xD728DB68, 0xF903, 0x4F80, {0x94, 0xCD, 0xDC, 0xCF, 0x76, 0xEC, 0x71, 0x51}} + +ContainerReflection_CLSID_STRING :: "b9f54489-55b8-400c-ba3a-1675e4728b91" +ContainerReflection_CLSID := &CLSID{0xB9F54489, 0x55B8, 0x400C, {0xBA, 0x3A, 0x16, 0x75, 0xE4, 0x72, 0x8B, 0x91}} + +Optimizer_CLSID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" +Optimizer_CLSID := &CLSID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} + +ContainerBuilder_CLSID_STRING :: "94134294-411f-4574-b4d0-8741e25240d2" +ContainerBuilder_CLSID := &CLSID{0x94134294, 0x411F, 0x4574, {0xB4, 0xD0, 0x87, 0x41, 0xE2, 0x52, 0x40, 0xD2}} + +PdbUtils_CLSID_STRING :: "54621dfb-f2ce-457e-ae8c-ec355faeec7c" +PdbUtils_CLSID := &CLSID{0x54621DFB, 0xF2CE, 0x457E, {0xAE, 0x8C, 0xEC, 0x35, 0x5F, 0xAE, 0xEC, 0x7C}} + +CP_UTF8 :: 65001 +CP_UTF16 :: 1200 +CP_ACP :: 0 + +make_fourcc :: proc "contextless" (ch0, ch1, ch2, ch3: u32) -> u32 { + return ch0 | (ch1 << 8) | (ch2 << 16) | (ch3 << 24) +} + +PART_PDB :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('B')<<24) +PART_PDB_NAME :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('N')<<24) +PART_PRIVATE_DATA :: u32('P') | (u32('R')<<8) | (u32('I')<<16) | (u32('V')<<24) +PART_ROOT_SIGNATURE :: u32('R') | (u32('T')<<8) | (u32('S')<<16) | (u32('0')<<24) +PART_DXIL :: u32('D') | (u32('X')<<8) | (u32('I')<<16) | (u32('L')<<24) +PART_REFLECTION_DATA :: u32('S') | (u32('T')<<8) | (u32('A')<<16) | (u32('T')<<24) +PART_SHADER_HASH :: u32('H') | (u32('A')<<8) | (u32('S')<<16) | (u32('H')<<24) +PART_INPUT_SIGNATURE :: u32('I') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) +PART_OUTPUT_SIGNATURE :: u32('O') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) +PART_PATCH_CONSTANT_SIGNATURE :: u32('P') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) + +ARG_DEBUG :: "-Zi" +ARG_SKIP_VALIDATION :: "-Vd" +ARG_SKIP_OPTIMIZATIONS :: "-Od" +ARG_PACK_MATRIX_ROW_MAJOR :: "-Zpr" +ARG_PACK_MATRIX_COLUMN_MAJOR :: "-Zpc" +ARG_AVOID_FLOW_CONTROL :: "-Gfa" +ARG_PREFER_FLOW_CONTROL :: "-Gfp" +ARG_ENABLE_STRICTNESS :: "-Ges" +ARG_ENABLE_BACKWARDS_COMPATIBILITY :: "-Gec" +ARG_IEEE_STRICTNESS :: "-Gis" +ARG_OPTIMIZATION_LEVEL0 :: "-O0" +ARG_OPTIMIZATION_LEVEL1 :: "-O1" +ARG_OPTIMIZATION_LEVEL2 :: "-O2" +ARG_OPTIMIZATION_LEVEL3 :: "-O3" +ARG_WARNINGS_ARE_ERRORS :: "-WX" +ARG_RESOURCES_MAY_ALIAS :: "-res_may_alias" +ARG_ALL_RESOURCES_BOUND :: "-all_resources_bound" +ARG_DEBUG_NAME_FOR_SOURCE :: "-Zss" +ARG_DEBUG_NAME_FOR_BINARY :: "-Zsb" + +EXTRA_OUTPUT_NAME_STDOUT :: "*stdout*" +EXTRA_OUTPUT_NAME_STDERR :: "*stderr*" -- cgit v1.2.3 From 735cfcd29011ea9188b008e3389aa236529f0e5f Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Fri, 1 Sep 2023 16:21:43 +0200 Subject: Add formatting of bytes into the best unit of measurement --- core/fmt/doc.odin | 3 ++ core/fmt/fmt.odin | 61 +++++++++++++++++++++++++++++++++++++++ core/mem/mem.odin | 2 ++ core/runtime/core.odin | 2 ++ tests/core/Makefile | 3 ++ tests/core/fmt/test_core_fmt.odin | 59 +++++++++++++++++++++++++++++++++++++ 6 files changed, 130 insertions(+) create mode 100644 tests/core/fmt/test_core_fmt.odin diff --git a/core/fmt/doc.odin b/core/fmt/doc.odin index 991058661..e758f9638 100644 --- a/core/fmt/doc.odin +++ b/core/fmt/doc.odin @@ -35,6 +35,8 @@ Floating-point, complex numbers, and quaternions: %F synonym for %f %h hexadecimal (lower-case) representation with 0h prefix (0h01234abcd) %H hexadecimal (upper-case) representation with 0H prefix (0h01234ABCD) + %m number of bytes in the best unit of measurement, e.g. 123.45mb + %M number of bytes in the best unit of measurement, e.g. 123.45MB String and slice of bytes %s the uninterpreted bytes of the string or slice %q a double-quoted string safely escaped with Odin syntax @@ -85,6 +87,7 @@ Other flags: add leading 0z for dozenal (%#z) add leading 0x or 0X for hexadecimal (%#x or %#X) remove leading 0x for %p (%#p) + add a space between bytes and the unit of measurement (%#m or %#M) ' ' (space) leave a space for elided sign in numbers (% d) 0 pad with leading zeros rather than spaces diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index b3b8067e8..fad2548c8 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1048,6 +1048,65 @@ _fmt_int_128 :: proc(fi: ^Info, u: u128, base: int, is_signed: bool, bit_size: i fi.zero = false _pad(fi, s) } +// Units of measurements: +__MEMORY_LOWER := " b kb mb gb tb pb eb" +__MEMORY_UPPER := " B KB MB GB TB PB EB" +// Formats an integer value as bytes with the best representation. +// +// Inputs: +// - fi: A pointer to an Info structure +// - u: The integer value to format +// - is_signed: A boolean indicating if the integer is signed +// - bit_size: The bit size of the integer +// - digits: A string containing the digits for formatting +// +_fmt_memory :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, units: string) { + abs, neg := strconv.is_integer_negative(u, is_signed, bit_size) + + // Default to a precision of 2, but if less than a kb, 0 + prec := fi.prec if (fi.prec_set || abs < mem.Kilobyte) else 2 + + div, off, unit_len := 1, 0, 1 + for n := abs; n >= mem.Kilobyte; n /= mem.Kilobyte { + div *= mem.Kilobyte + off += 3 + + // First iteration is slightly different because you go from + // units of length 1 to units of length 2. + if unit_len == 1 { + off = 2 + unit_len = 2 + } + } + + // If hash, we add a space between the value and the suffix. + if fi.hash { + unit_len += 1 + } else { + off += 1 + } + + amt := f64(abs) / f64(div) + if neg { + amt = -amt + } + + buf: [256]byte + str := strconv.append_float(buf[:], amt, 'f', prec, 64) + + // Add the unit at the end. + copy(buf[len(str):], units[off:off+unit_len]) + str = string(buf[:len(str)+unit_len]) + + if !fi.plus { + // Strip sign from "+" but not "+Inf". + if str[0] == '+' && str[1] != 'I' { + str = str[1:] + } + } + + _pad(fi, str) +} // Hex Values: __DIGITS_LOWER := "0123456789abcdefx" __DIGITS_UPPER := "0123456789ABCDEFX" @@ -1096,6 +1155,8 @@ fmt_int :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, verb: rune) { io.write_string(fi.writer, "U+", &fi.n) _fmt_int(fi, u, 16, false, bit_size, __DIGITS_UPPER) } + case 'm': _fmt_memory(fi, u, is_signed, bit_size, __MEMORY_LOWER) + case 'M': _fmt_memory(fi, u, is_signed, bit_size, __MEMORY_UPPER) case: fmt_bad_verb(fi, verb) diff --git a/core/mem/mem.odin b/core/mem/mem.odin index a06579d71..dd985d5dd 100644 --- a/core/mem/mem.odin +++ b/core/mem/mem.odin @@ -8,6 +8,8 @@ Kilobyte :: runtime.Kilobyte Megabyte :: runtime.Megabyte Gigabyte :: runtime.Gigabyte Terabyte :: runtime.Terabyte +Petabyte :: runtime.Petabyte +Exabyte :: runtime.Exabyte set :: proc "contextless" (data: rawptr, value: byte, len: int) -> rawptr { return runtime.memset(data, i32(value), len) diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 4f85cf50e..0634f573a 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -337,6 +337,8 @@ Kilobyte :: 1024 * Byte Megabyte :: 1024 * Kilobyte Gigabyte :: 1024 * Megabyte Terabyte :: 1024 * Gigabyte +Petabyte :: 1024 * Terabyte +Exabyte :: 1024 * Petabyte // Logging stuff diff --git a/tests/core/Makefile b/tests/core/Makefile index 77d4b85a0..81bcdeeb8 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -57,3 +57,6 @@ c_libc_test: net_test: $(ODIN) run net -out:test_core_net + +fmt_test: + $(ODIN) run fmt -out:test_core_fmt diff --git a/tests/core/fmt/test_core_fmt.odin b/tests/core/fmt/test_core_fmt.odin new file mode 100644 index 000000000..e9acfa3a5 --- /dev/null +++ b/tests/core/fmt/test_core_fmt.odin @@ -0,0 +1,59 @@ +package test_core_fmt + +import "core:fmt" +import "core:os" +import "core:testing" +import "core:mem" + +TEST_count := 0 +TEST_fail := 0 + +when ODIN_TEST { + expect :: testing.expect + log :: testing.log +} else { + expect :: proc(t: ^testing.T, condition: bool, message: string, loc := #caller_location) { + TEST_count += 1 + if !condition { + TEST_fail += 1 + fmt.printf("[%v] %v\n", loc, message) + return + } + } + log :: proc(t: ^testing.T, v: any, loc := #caller_location) { + fmt.printf("[%v] ", loc) + fmt.printf("log: %v\n", v) + } +} + +main :: proc() { + t := testing.T{} + test_fmt_memory(&t) + + fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count) + if TEST_fail > 0 { + os.exit(1) + } +} + +test_fmt_memory :: proc(t: ^testing.T) { + check :: proc(t: ^testing.T, exp: string, format: string, args: ..any, loc := #caller_location) { + got := fmt.tprintf(format, ..args) + expect(t, got == exp, fmt.tprintf("(%q, %v): %q != %q", format, args, got, exp), loc) + } + + check(t, "5b", "%m", 5) + check(t, "5B", "%M", 5) + check(t, "-5B", "%M", -5) + check(t, "3.00kb", "%m", mem.Kilobyte * 3) + check(t, "3kb", "%.0m", mem.Kilobyte * 3) + check(t, "3KB", "%.0M", mem.Kilobyte * 3) + check(t, "3.000 mb", "%#.3m", mem.Megabyte * 3) + check(t, "3.50 gb", "%#m", u32(mem.Gigabyte * 3.5)) + check(t, "001tb", "%5.0m", mem.Terabyte) + check(t, "-001tb", "%5.0m", -mem.Terabyte) + check(t, "2.50 pb", "%#5.m", uint(mem.Petabyte * 2.5)) + check(t, "1.00 EB", "%#M", mem.Exabyte) + check(t, "255 B", "%#M", u8(255)) + check(t, "0b", "%m", u8(0)) +} -- cgit v1.2.3 From 4cf176de0b8edfbb1c7c1c63d8e1a35eb20653b5 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Fri, 1 Sep 2023 19:51:53 +0200 Subject: actually run the test --- tests/core/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/core/Makefile b/tests/core/Makefile index 81bcdeeb8..919262f85 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -2,7 +2,8 @@ ODIN=../../odin PYTHON=$(shell which python3) all: download_test_assets image_test compress_test strings_test hash_test crypto_test noise_test encoding_test \ - math_test linalg_glsl_math_test filepath_test reflect_test os_exit_test i18n_test match_test c_libc_test net_test + math_test linalg_glsl_math_test filepath_test reflect_test os_exit_test i18n_test match_test c_libc_test net_test \ + fmt_test download_test_assets: $(PYTHON) download_assets.py -- cgit v1.2.3 From aab2fa1af9a0c65f9ec5a77eef90801ffa7bd4b8 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Fri, 1 Sep 2023 19:53:24 +0200 Subject: fix test case --- tests/core/fmt/test_core_fmt.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/fmt/test_core_fmt.odin b/tests/core/fmt/test_core_fmt.odin index e9acfa3a5..8928338b3 100644 --- a/tests/core/fmt/test_core_fmt.odin +++ b/tests/core/fmt/test_core_fmt.odin @@ -51,7 +51,7 @@ test_fmt_memory :: proc(t: ^testing.T) { check(t, "3.000 mb", "%#.3m", mem.Megabyte * 3) check(t, "3.50 gb", "%#m", u32(mem.Gigabyte * 3.5)) check(t, "001tb", "%5.0m", mem.Terabyte) - check(t, "-001tb", "%5.0m", -mem.Terabyte) + check(t, "-01tb", "%5.0m", -mem.Terabyte) check(t, "2.50 pb", "%#5.m", uint(mem.Petabyte * 2.5)) check(t, "1.00 EB", "%#M", mem.Exabyte) check(t, "255 B", "%#M", u8(255)) -- cgit v1.2.3 From 93caf5b31120dec6739c098207f5b00ad7aed299 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Fri, 1 Sep 2023 22:05:04 +0200 Subject: use memory formatting in tracking allocator doc --- core/mem/doc.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/mem/doc.odin b/core/mem/doc.odin index 295a69e96..e232428c2 100644 --- a/core/mem/doc.odin +++ b/core/mem/doc.odin @@ -24,7 +24,7 @@ main :: proc() { _main() for _, leak in track.allocation_map { - fmt.printf("%v leaked %v bytes\n", leak.location, leak.size) + fmt.printf("%v leaked %m\n", leak.location, leak.size) } for bad_free in track.bad_free_array { fmt.printf("%v allocation %p was freed badly\n", bad_free.location, bad_free.memory) -- cgit v1.2.3 From bbf96787562334d3b4d51d91785ad66538b548c4 Mon Sep 17 00:00:00 2001 From: Fabian Sperber Date: Tue, 5 Sep 2023 22:35:30 +0200 Subject: Fix parsing #force_inline call expression with or_return --- core/odin/ast/ast.odin | 21 +++++++++++++++++++++ core/odin/parser/parser.odin | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/core/odin/ast/ast.odin b/core/odin/ast/ast.odin index f2c3e029b..1ac4a25b7 100644 --- a/core/odin/ast/ast.odin +++ b/core/odin/ast/ast.odin @@ -553,6 +553,27 @@ unparen_expr :: proc(expr: ^Expr) -> (val: ^Expr) { return } +strip_or_return_expr :: proc(expr: ^Expr) -> (val: ^Expr) { + val = expr + if expr == nil { + return + } + for { + inner: ^Expr + #partial switch e in val.derived { + case ^Or_Return_Expr: + inner = e.expr + case ^Paren_Expr: + inner = e.expr + } + if inner == nil { + break + } + val = inner + } + return +} + Field_Flags :: distinct bit_set[Field_Flag] Field_Flag :: enum { diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin index da6530911..e9deeea78 100644 --- a/core/odin/parser/parser.odin +++ b/core/odin/parser/parser.odin @@ -2153,7 +2153,7 @@ parse_inlining_operand :: proc(p: ^Parser, lhs: bool, tok: tokenizer.Token) -> ^ } } - #partial switch e in ast.unparen_expr(expr).derived_expr { + #partial switch e in ast.strip_or_return_expr(expr).derived_expr { case ^ast.Proc_Lit: if e.inlining != .None && e.inlining != pi { error(p, expr.pos, "both 'inline' and 'no_inline' cannot be applied to a procedure literal") -- cgit v1.2.3 From 16d797cb018524303459cd1cdb8489ed7c543756 Mon Sep 17 00:00:00 2001 From: Fabian Sperber Date: Tue, 5 Sep 2023 22:57:40 +0200 Subject: Add #const field flag --- core/odin/ast/ast.odin | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/odin/ast/ast.odin b/core/odin/ast/ast.odin index 1ac4a25b7..76ecda59c 100644 --- a/core/odin/ast/ast.odin +++ b/core/odin/ast/ast.odin @@ -585,6 +585,7 @@ Field_Flag :: enum { No_Alias, C_Vararg, Auto_Cast, + Const, Any_Int, Subtype, By_Ptr, @@ -604,6 +605,7 @@ field_flag_strings := [Field_Flag]string{ .No_Alias = "#no_alias", .C_Vararg = "#c_vararg", .Auto_Cast = "auto_cast", + .Const = "#const", .Any_Int = "#any_int", .Subtype = "#subtype", .By_Ptr = "#by_ptr", @@ -617,6 +619,7 @@ field_flag_strings := [Field_Flag]string{ field_hash_flag_strings := []struct{key: string, flag: Field_Flag}{ {"no_alias", .No_Alias}, {"c_vararg", .C_Vararg}, + {"const", .Const}, {"any_int", .Any_Int}, {"subtype", .Subtype}, {"by_ptr", .By_Ptr}, @@ -637,6 +640,7 @@ Field_Flags_Signature :: Field_Flags{ .Using, .No_Alias, .C_Vararg, + .Const, .Auto_Cast, .Any_Int, .By_Ptr, -- cgit v1.2.3 From 886d0de040a6ce06e5e1fb5391e140668f092ade Mon Sep 17 00:00:00 2001 From: Fabian Sperber Date: Tue, 5 Sep 2023 23:08:23 +0200 Subject: Remove auto_cast from field_flags - auto_cast is parsed as its own expression --- core/odin/ast/ast.odin | 3 --- core/odin/parser/parser.odin | 3 --- 2 files changed, 6 deletions(-) diff --git a/core/odin/ast/ast.odin b/core/odin/ast/ast.odin index 76ecda59c..b462a3107 100644 --- a/core/odin/ast/ast.odin +++ b/core/odin/ast/ast.odin @@ -584,7 +584,6 @@ Field_Flag :: enum { Using, No_Alias, C_Vararg, - Auto_Cast, Const, Any_Int, Subtype, @@ -604,7 +603,6 @@ field_flag_strings := [Field_Flag]string{ .Using = "using", .No_Alias = "#no_alias", .C_Vararg = "#c_vararg", - .Auto_Cast = "auto_cast", .Const = "#const", .Any_Int = "#any_int", .Subtype = "#subtype", @@ -641,7 +639,6 @@ Field_Flags_Signature :: Field_Flags{ .No_Alias, .C_Vararg, .Const, - .Auto_Cast, .Any_Int, .By_Ptr, .Default_Parameters, diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin index e9deeea78..39280061f 100644 --- a/core/odin/parser/parser.odin +++ b/core/odin/parser/parser.odin @@ -1666,9 +1666,6 @@ is_token_field_prefix :: proc(p: ^Parser) -> ast.Field_Flag { case .Using: advance_token(p) return .Using - case .Auto_Cast: - advance_token(p) - return .Auto_Cast case .Hash: tok: tokenizer.Token advance_token(p) -- cgit v1.2.3 From 92b24fd02d14ebc028c1b2b8d09bfc7b970ead39 Mon Sep 17 00:00:00 2001 From: Lucas Perlind Date: Wed, 6 Sep 2023 12:29:07 +1000 Subject: Further improve on NSBlock * Correct setting the isa of the NSBlock * Make global blocks managed by the odin runtime * Make local blocks copy to a malloc block that is managed by the objc runtime * Add method to create blocks that take a paramater --- vendor/darwin/Foundation/NSBlock.odin | 101 +++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 33 deletions(-) diff --git a/vendor/darwin/Foundation/NSBlock.odin b/vendor/darwin/Foundation/NSBlock.odin index 9cc58da71..ecb31bcfb 100644 --- a/vendor/darwin/Foundation/NSBlock.odin +++ b/vendor/darwin/Foundation/NSBlock.odin @@ -1,27 +1,37 @@ package objc_Foundation import "core:intrinsics" +import "core:builtin" +import "core:mem" -@(objc_class="NSConcreteGlobalBlock") +@(objc_class="NSBlock") Block :: struct {using _: Object} @(objc_type=Block, objc_name="createGlobal", objc_is_class_method=true) -Block_createGlobal :: proc "c" (user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block { - return Block_createInternal(true, user_data, user_proc) +Block_createGlobal :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr), allocator := context.allocator) -> (^Block, mem.Allocator_Error) #optional_allocator_error { + return Block_createInternal(true, user_data, user_proc, allocator) } - @(objc_type=Block, objc_name="createLocal", objc_is_class_method=true) -Block_createLocal :: proc "c" (user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block { - return Block_createInternal(false, user_data, user_proc) +Block_createLocal :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block { + b, _ := Block_createInternal(false, user_data, user_proc, {}) + return b +} +@(objc_type=Block, objc_name="createGlobalWithParam", objc_is_class_method=true) +Block_createGlobalWithParam :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr, t: $T), allocator := context.allocator) -> (^Block, mem.Allocator_Error) #optional_allocator_error { + return Block_createInternalWithParam(true, user_data, user_proc, allocator) +} +@(objc_type=Block, objc_name="createLocalWithParam", objc_is_class_method=true) +Block_createLocalWithParam :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr, t: $T)) -> ^Block { + b, _ := Block_createInternalWithParam(false, user_data, user_proc, {}) + return b } - @(private) Internal_Block_Literal_Base :: struct { isa: ^intrinsics.objc_class, flags: u32, reserved: u32, - invoke: proc "c" (^Internal_Block_Literal), + invoke: rawptr, // contains a pointer to a proc "c" (^Internal_Block_Literal, ...) descriptor: ^Block_Descriptor, } @@ -29,7 +39,7 @@ Internal_Block_Literal_Base :: struct { Internal_Block_Literal :: struct { using base: Internal_Block_Literal_Base, // Imported Variables - user_proc: proc "c" (user_data: rawptr), + user_proc: rawptr, // contains a pointer to a proc "c" (user_data: rawptr, ...) user_data: rawptr, } @@ -50,36 +60,61 @@ global_block_descriptor := Block_Descriptor{ foreign import libSystem "system:System.framework" foreign libSystem { - _NSConcreteGlobalBlock: ^intrinsics.objc_class + _NSConcreteGlobalBlock: intrinsics.objc_class + _NSConcreteStackBlock: intrinsics.objc_class } @(private="file") -Block_createInternal :: proc "c" (is_global: bool, user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block { - // Set to true on blocks that have captures (and thus are not true - // global blocks) but are known not to escape for various other - // reasons. For backward compatibility with old runtimes, whenever - // BLOCK_IS_NOESCAPE is set, BLOCK_IS_GLOBAL is set too. Copying a - // non-escaping block returns the original block and releasing such a - // block is a no-op, which is exactly how global blocks are handled. - BLOCK_IS_NOESCAPE :: (1 << 23)|BLOCK_IS_GLOBAL +internal_block_literal_make :: proc (is_global: bool, user_data: rawptr, user_proc: rawptr, invoke: rawptr, allocator: mem.Allocator) -> (b: ^Block, err: mem.Allocator_Error) { + _init :: proc(bl: ^Internal_Block_Literal, is_global: bool, user_data: rawptr, user_proc: rawptr, invoke: rawptr) { + // Set to true on blocks that have captures (and thus are not true + // global blocks) but are known not to escape for various other + // reasons. For backward compatibility with old runtimes, whenever + // BLOCK_IS_NOESCAPE is set, BLOCK_IS_GLOBAL is set too. Copying a + // non-escaping block returns the original block and releasing such a + // block is a no-op, which is exactly how global blocks are handled. + BLOCK_IS_NOESCAPE :: (1 << 23)|BLOCK_IS_GLOBAL - BLOCK_HAS_COPY_DISPOSE :: 1 << 25 - BLOCK_HAS_CTOR :: 1 << 26 // helpers have C++ code - BLOCK_IS_GLOBAL :: 1 << 28 - BLOCK_HAS_STRET :: 1 << 29 // IFF BLOCK_HAS_SIGNATURE - BLOCK_HAS_SIGNATURE :: 1 << 30 + BLOCK_HAS_COPY_DISPOSE :: 1 << 25 + BLOCK_HAS_CTOR :: 1 << 26 // helpers have C++ code + BLOCK_IS_GLOBAL :: 1 << 28 + BLOCK_HAS_STRET :: 1 << 29 // IFF BLOCK_HAS_SIGNATURE + BLOCK_HAS_SIGNATURE :: 1 << 30 - extraBytes :: size_of(Internal_Block_Literal) - size_of(Internal_Block_Literal_Base) + bl.isa = is_global ? &_NSConcreteGlobalBlock : &_NSConcreteStackBlock + bl.flags = BLOCK_IS_GLOBAL if is_global else 0 + bl.invoke = invoke + bl.descriptor = &global_block_descriptor + bl.user_proc = auto_cast user_proc + bl.user_data = user_data + } + if is_global { + bl := builtin.new (Internal_Block_Literal, allocator) or_return + _init(bl, true, user_data, user_proc, invoke) + return auto_cast bl, .None + } else { + // malloc blocks are created by calling 'copy' on a stack block + bl: Internal_Block_Literal + _init(&bl, false, user_data, user_proc, invoke) + return auto_cast copy(cast(^Copying(Block))(&bl)), .None + } +} - bl := (^Internal_Block_Literal)(AllocateObject(_NSConcreteGlobalBlock, extraBytes, nil)) - bl.isa = _NSConcreteGlobalBlock - bl.flags = BLOCK_IS_GLOBAL if is_global else 0 - bl.invoke = proc "c" (bl: ^Internal_Block_Literal) { - bl.user_proc(bl.user_data) +@(private="file") +Block_createInternal :: proc (is_global: bool, user_data: rawptr, user_proc: proc "c" (user_data: rawptr), allocator: mem.Allocator) -> (b: ^Block, err: mem.Allocator_Error) { + invoke :: proc "c" (bl: ^Internal_Block_Literal) { + user_proc := (proc "c" (rawptr))(bl.user_proc) + user_proc(bl.user_data) } - bl.descriptor = &global_block_descriptor - bl.user_proc = user_proc - bl.user_data = user_data + return internal_block_literal_make(is_global, user_data, auto_cast user_proc, auto_cast invoke, allocator) +} - return auto_cast bl +@(private="file") +Block_createInternalWithParam :: proc (is_global: bool, user_data: rawptr, user_proc: proc "c" (user_data: rawptr, t: $T), allocator: mem.Allocator) -> (b: ^Block, err: mem.Allocator_Error) { + invoke :: proc "c" (bl: ^Internal_Block_Literal, t: T) { + user_proc := (proc "c" (rawptr, T))(bl.user_proc) + user_proc(bl.user_data, t) + } + return internal_block_literal_make(is_global, user_data, auto_cast user_proc, auto_cast invoke, allocator) } + -- cgit v1.2.3 From 19fe508fb2026294e33d98a2b5202a202c47cd7e Mon Sep 17 00:00:00 2001 From: hikari Date: Thu, 7 Sep 2023 23:58:19 +0300 Subject: [core:sys/windows] Added couple of procedures --- core/sys/windows/kernel32.odin | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin index 2b63595a4..97defaf23 100644 --- a/core/sys/windows/kernel32.odin +++ b/core/sys/windows/kernel32.odin @@ -133,6 +133,20 @@ foreign kernel32 { GetExitCodeThread :: proc(thread: HANDLE, exit_code: ^DWORD) -> BOOL --- TerminateThread :: proc(thread: HANDLE, exit_code: DWORD) -> BOOL --- + GetProcessAffinityMask :: proc( + hProcess: HANDLE, + lpProcessAffinityMask: PDWORD_PTR, + lpSystemAffinityMask: PDWORD_PTR, + ) -> BOOL --- + SetProcessAffinityMask :: proc( + hProcess: HANDLE, + dwProcessAffinityMask: DWORD_PTR, + ) -> BOOL --- + SetThreadAffinityMask :: proc( + hThread: HANDLE, + dwThreadAffinityMask: DWORD_PTR, + ) -> DWORD_PTR --- + CreateSemaphoreW :: proc(attributes: LPSECURITY_ATTRIBUTES, initial_count, maximum_count: LONG, name: LPCWSTR) -> HANDLE --- ReleaseSemaphore :: proc(semaphore: HANDLE, release_count: LONG, previous_count: ^LONG) -> BOOL --- -- cgit v1.2.3 From 1b06f809de28d384adc031f1e6b4d243175d80eb Mon Sep 17 00:00:00 2001 From: hikari Date: Fri, 8 Sep 2023 00:02:27 +0300 Subject: [core:sys/windows] Added SuspendThread --- core/sys/windows/kernel32.odin | 1 + 1 file changed, 1 insertion(+) diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin index 97defaf23..0c612a974 100644 --- a/core/sys/windows/kernel32.odin +++ b/core/sys/windows/kernel32.odin @@ -132,6 +132,7 @@ foreign kernel32 { SetThreadPriority :: proc(thread: HANDLE, priority: c_int) -> BOOL --- GetExitCodeThread :: proc(thread: HANDLE, exit_code: ^DWORD) -> BOOL --- TerminateThread :: proc(thread: HANDLE, exit_code: DWORD) -> BOOL --- + SuspendThread :: proc(hThread: HANDLE) -> DWORD --- GetProcessAffinityMask :: proc( hProcess: HANDLE, -- cgit v1.2.3 From 72118fcc6ac4e03710cc32659d7978a7496ea027 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 11 Sep 2023 16:14:28 +0100 Subject: Fix #2794 (Fix typo for `IsWindowState`) --- vendor/raylib/raylib.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin index 5576a0915..f6e58a564 100644 --- a/vendor/raylib/raylib.odin +++ b/vendor/raylib/raylib.odin @@ -901,7 +901,7 @@ foreign lib { IsWindowMaximized :: proc() -> bool --- // Check if window is currently maximized (only PLATFORM_DESKTOP) IsWindowFocused :: proc() -> bool --- // Check if window is currently focused (only PLATFORM_DESKTOP) IsWindowResized :: proc() -> bool --- // Check if window has been resized last frame - IsWindowState :: proc(flag: ConfigFlag) -> bool --- // Check if one specific window flag is enabled + IsWindowState :: proc(flags: ConfigFlags) -> bool --- // Check if one specific window flag is enabled SetWindowState :: proc(flags: ConfigFlags) --- // Set window configuration state using flags (only PLATFORM_DESKTOP) ClearWindowState :: proc(flags: ConfigFlags) --- // Clear window configuration state flags ToggleFullscreen :: proc() --- // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) -- cgit v1.2.3 From 984a95b8c76cc5a42b401d9a1761c52ede344754 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 11 Sep 2023 23:36:39 +0100 Subject: Update Tilde --- src/tilde/tb.h | 305 +++++++++++++++++++++++++++++++++--------------- src/tilde/tb.lib | Bin 4229318 -> 4265424 bytes src/tilde/tb_arena.h | 6 +- src/tilde_builtin.cpp | 6 +- src/tilde_expr.cpp | 3 + src/tilde_proc.cpp | 8 +- src/tilde_stmt.cpp | 20 ++-- src/tilde_type_info.cpp | 7 +- 8 files changed, 239 insertions(+), 116 deletions(-) diff --git a/src/tilde/tb.h b/src/tilde/tb.h index 081a84995..5bb98fe70 100644 --- a/src/tilde/tb.h +++ b/src/tilde/tb.h @@ -1,3 +1,12 @@ +// Glossary (because i don't know where else to put it) +// IR - intermediate representation +// SoN - sea of nodes (https://www.oracle.com/technetwork/java/javase/tech/c2-ir95-150110.pdf) +// SSA - single static assignment +// GVN - global value numbering +// CSE - common subexpression elimination +// DSE - dead store elimination +// GCM - global code motion +// SROA - scalar replacement of aggregates #ifndef TB_CORE_H #define TB_CORE_H @@ -150,18 +159,19 @@ typedef enum TB_ISelMode { typedef enum TB_DataTypeEnum { // Integers, note void is an i0 and bool is an i1 - // i(0-2047) + // i(0-64) TB_INT, // Floating point numbers // f{32,64} TB_FLOAT, // Pointers - // ptr(0-2047) TB_PTR, // Tuples, these cannot be used in memory ops, just accessed via projections TB_TUPLE, - // represents control flow as a kind of data + // represents control flow for REGION, BRANCH TB_CONTROL, + // represents memory (and I/O) + TB_MEMORY, } TB_DataTypeEnum; typedef enum TB_FloatFormat { @@ -179,6 +189,7 @@ typedef union TB_DataType { }; uint32_t raw; } TB_DataType; +static_assert(sizeof(TB_DataType) == 4, "im expecting this to be a uint32_t"); // classify data types #define TB_IS_VOID_TYPE(x) ((x).type == TB_INT && (x).data == 0) @@ -192,75 +203,136 @@ typedef union TB_DataType { #define TB_GET_FLOAT_FORMAT(x) ((x).data) #define TB_GET_PTR_ADDRSPACE(x) ((x).data) +//////////////////////////////// +// ANNOTATIONS +//////////////////////////////// +// +// (A, B) -> (C, D) +// +// node takes A and B, produces C, D. if there's multiple +// results we need to use projections and the indices are +// based on the order seen here, proj0 is C, proj1 is D. +// +// (A, B) & C -> Int +// +// nodes takes A and B along with C in it's extra data. this is +// where non-node inputs fit. +// typedef enum TB_NodeTypeEnum { TB_NULL = 0, - // Immediates + //////////////////////////////// + // CONSTANTS + //////////////////////////////// TB_INTEGER_CONST, TB_FLOAT32_CONST, TB_FLOAT64_CONST, - // only one per function - TB_START, // fn() - - // regions represent the begining of BBs - TB_REGION, // fn(preds: []region) - - // projection - TB_PROJ, - - TB_CALL, // normal call - TB_SYSCALL, // system call - - // Managed ops - TB_SAFEPOINT, - - // Memory operations - TB_STORE, // fn(r: control, addr: data, src: data) - TB_MEMCPY, - TB_MEMSET, - - // Atomics - TB_ATOMIC_TEST_AND_SET, - TB_ATOMIC_CLEAR, - - TB_ATOMIC_LOAD, - TB_ATOMIC_XCHG, - TB_ATOMIC_ADD, - TB_ATOMIC_SUB, - TB_ATOMIC_AND, - TB_ATOMIC_XOR, - TB_ATOMIC_OR, - - TB_ATOMIC_CMPXCHG, - TB_DEBUGBREAK, - - // Terminators - TB_BRANCH, - TB_RET, - TB_UNREACHABLE, - TB_TRAP, - - TB_POISON, - - // Load - TB_LOAD, - - // Pointers - TB_LOCAL, - - TB_GET_SYMBOL_ADDRESS, - - TB_MEMBER_ACCESS, - TB_ARRAY_ACCESS, + //////////////////////////////// + // MISCELLANEOUS + //////////////////////////////// + // this is an unspecified value, usually generated by the optimizer + // when malformed input is folded into an operation. + TB_POISON, // () -> Any + // projections just extract a single field of a tuple + TB_PROJ, // Tuple & Int -> Any + // this is a simple way to embed machine code into the code + TB_MACHINE_OP, // (Control, Memory) & Buffer -> (Control, Memory) + // reads the TSC on x64 + TB_CYCLE_COUNTER, // (Control) -> Int64 + + //////////////////////////////// + // CONTROL + //////////////////////////////// + // there's only one START and STOP per function + TB_START, // () -> (Control, Memory, Data...) + TB_END, // (Control, Memory, Data?) -> () + // regions are used to represent paths which have multiple entries. + // each input is a predecessor. + TB_REGION, // (Control...) -> (Control) + // phi nodes work the same as in SSA CFG, the value is based on which predecessor was taken. + // each input lines up with the regions such that region.in[i] will use phi.in[i+1] as the + // subsequent data. + TB_PHI, // (Control, Data...) -> Data + // branch is used to implement most control flow, it acts like a switch + // statement in C usually. they take a key and match against some cases, + // if they match, it'll jump to that successor, if none match it'll take + // the default successor. + // + // if (cond) { A; } else { B; } is just switch (cond) { case 0: B; default: A; } + // + // it's possible to not pass a key and the default successor is always called, this is + // a GOTO. tb_inst_goto, tb_inst_if can handle common cases for you. + TB_BRANCH, // (Control, Data?) -> (Control...) + // debugbreak will trap in a continuable manner. + TB_DEBUGBREAK, // (Control, Memory) -> (Control) + // trap will not be continuable but will stop execution. + TB_TRAP, // (Control) -> (Control) + // unreachable means it won't trap or be continuable. + TB_UNREACHABLE, // (Control) -> (Control) + + //////////////////////////////// + // CONTROL + MEMORY + //////////////////////////////// + // nothing special, it's just a function call, 3rd argument here is the + // target pointer (or syscall number) and the rest are just data args. + TB_CALL, // (Control, Memory, Data, Data...) -> (Control, Memory, Data) + TB_SYSCALL, // (Control, Memory, Data, Data...) -> (Control, Memory, Data) + // safepoint polls are the same except they only trigger if the poll site + // says to (platform specific but almost always just the page being made + // unmapped/guard), 3rd argument is the poll site. + TB_SAFEPOINT_POLL, // (Control, Memory, Ptr, Data...) -> (Control) + + //////////////////////////////// + // MEMORY + //////////////////////////////// + // LOAD and STORE are standard memory accesses, they can be folded away. + TB_LOAD, // (Memory, Ptr) -> Data + TB_STORE, // (Memory, Ptr, Data) -> Memory + // bulk memory ops. + TB_MEMCPY, // (Memory, Ptr, Ptr, Size) -> Memory + TB_MEMSET, // (Memory, Ptr, Int8, Size) -> Memory + // these memory accesses represent "volatile" which means + // they may produce side effects and thus cannot be eliminated. + TB_READ, // (Memory, Ptr) -> (Memory, Data) + TB_WRITE, // (Memory, Ptr, Data) -> (Memory, Data) + // atomics have multiple observers (if not they wouldn't need to + // be atomic) and thus produce side effects everywhere just like + // volatiles except they have synchronization guarentees. the atomic + // data ops will return the value before the operation is performed. + // Atomic CAS return the old value and a boolean for success (true if + // the value was changed) + TB_ATOMIC_LOAD, // (Memory, Ptr) -> (Memory, Data) + TB_ATOMIC_XCHG, // (Memory, Ptr, Data) -> (Memory, Data) + TB_ATOMIC_ADD, // (Memory, Ptr, Data) -> (Memory, Data) + TB_ATOMIC_SUB, // (Memory, Ptr, Data) -> (Memory, Data) + TB_ATOMIC_AND, // (Memory, Ptr, Data) -> (Memory, Data) + TB_ATOMIC_XOR, // (Memory, Ptr, Data) -> (Memory, Data) + TB_ATOMIC_OR, // (Memory, Ptr, Data) -> (Memory, Data) + TB_ATOMIC_CAS, // (Memory, Data, Data) -> (Memory, Data, Bool) + + //////////////////////////////// + // POINTERS + //////////////////////////////// + // LOCAL will statically allocate stack space + TB_LOCAL, // () & (Int, Int) -> Ptr + // SYMBOL will return a pointer to a TB_Symbol + TB_SYMBOL, // () & TB_Symbol* -> Ptr + // offsets pointer by constant value + TB_MEMBER_ACCESS, // Ptr & Int -> Ptr + // arguments represent base, index, and stride respectively + // and will perform `base + index*stride` + TB_ARRAY_ACCESS, // (Ptr, Int) & Int -> Ptr + // converts an integer to a pointer + TB_INT2PTR, // Int -> Ptr + // converts a pointer to an integer + TB_PTR2INT, // Ptr -> Int // Conversions TB_TRUNCATE, TB_FLOAT_EXT, TB_SIGN_EXT, TB_ZERO_EXT, - TB_INT2PTR, - TB_PTR2INT, TB_UINT2FLOAT, TB_FLOAT2UINT, TB_INT2FLOAT, @@ -315,18 +387,17 @@ typedef enum TB_NodeTypeEnum { TB_CMP_FLE, // Special ops - // does full multiplication (64x64=128 and so on) returning - // the low and high values in separate projections + // adds two paired integers to two other paired integers and returns + // a low and high value + TB_ADDPAIR, + // does full multiplication (64x64=128 and so on) returning + // the low and high values in separate projections TB_MULPAIR, - // PHI - TB_PHI, // fn(r: region, x: []data) - // variadic TB_VA_START, // x86 intrinsics - TB_X86INTRIN_RDTSC, TB_X86INTRIN_LDMXCSR, TB_X86INTRIN_STMXCSR, TB_X86INTRIN_SQRT, @@ -372,6 +443,9 @@ typedef struct TB_FunctionPrototype TB_FunctionPrototype; typedef struct TB_Attrib TB_Attrib; +// target-specific, just a unique ID for the registers +typedef int TB_PhysicalReg; + // Refers generically to objects within a module // // TB_Function, TB_Global, and TB_External are all subtypes of TB_Symbol @@ -412,12 +486,11 @@ typedef struct TB_Symbol { typedef struct TB_Node TB_Node; struct TB_Node { TB_NodeType type; + uint16_t input_count; // number of node inputs. TB_DataType dt; - uint16_t input_count; // number of node inputs - uint16_t extra_count; // number of bytes for extra operand data - // local to the TB_Passes - uint32_t lattice_id; + // makes it easier to track in graph walks + size_t gvn; TB_Attrib* attribs; TB_Node** inputs; @@ -442,9 +515,8 @@ typedef struct { // TB_PROJ int index; } TB_NodeProj; -typedef struct { // TB_INT - uint64_t num_words; - uint64_t words[]; +typedef struct { // TB_INTEGER_CONST + uint64_t value; } TB_NodeInt; typedef struct { // any compare operator @@ -457,17 +529,26 @@ typedef struct { // any integer binary operator typedef struct { // TB_MULPAIR TB_Node *lo, *hi; -} TB_NodeMulPair; +} TB_NodeArithPair; typedef struct { TB_CharUnits align; - bool is_volatile; } TB_NodeMemAccess; typedef struct { TB_CharUnits size, align; } TB_NodeLocal; +typedef struct { + // this is the raw buffer + size_t length; + const uint8_t* data; + + // represents the outputs, inputs and temporaries in that order + size_t outs, ins, tmps; + TB_PhysicalReg regs[]; +} TB_NodeMachineOp; + typedef struct { float value; } TB_NodeFloat32; @@ -491,6 +572,8 @@ typedef struct { typedef struct { TB_MemoryOrder order; TB_MemoryOrder order2; + TB_Node* proj0; + TB_Node* proj1; } TB_NodeAtomic; typedef struct { @@ -506,9 +589,18 @@ typedef struct { TB_Node* end; const char* tag; + // position in a postorder walk + int postorder_id; // immediate dominator (can be approximate) int dom_depth; TB_Node* dom; + + // used for IR building only, stale after that. + // + // this represents the first and last memory values within a region, + // if a region ever has multiple predecessors we apply a join on these + // memory. + TB_Node *mem_in, *mem_out; } TB_NodeRegion; typedef struct TB_MultiOutput { @@ -558,7 +650,7 @@ typedef struct { #define TB_TYPE_F64 TB_DataType{ { TB_FLOAT, 0, TB_FLT_64 } } #define TB_TYPE_BOOL TB_DataType{ { TB_INT, 0, 1 } } #define TB_TYPE_PTR TB_DataType{ { TB_PTR, 0, 0 } } - +#define TB_TYPE_MEMORY TB_DataType{ { TB_MEMORY,0, 0 } } #define TB_TYPE_INTN(N) TB_DataType{ { TB_INT, 0, (N) } } #define TB_TYPE_PTRN(N) TB_DataType{ { TB_PTR, 0, (N) } } @@ -575,8 +667,9 @@ typedef struct { #define TB_TYPE_F64 (TB_DataType){ { TB_FLOAT, 0, TB_FLT_64 } } #define TB_TYPE_BOOL (TB_DataType){ { TB_INT, 0, 1 } } #define TB_TYPE_PTR (TB_DataType){ { TB_PTR, 0, 0 } } -#define TB_TYPE_INTN(N) (TB_DataType){ { TB_INT, 0, (N) } } -#define TB_TYPE_PTRN(N) (TB_DataType){ { TB_PTR, 0, (N) } } +#define TB_TYPE_MEMORY (TB_DataType){ { TB_MEMORY,0, 0 } } +#define TB_TYPE_INTN(N) (TB_DataType){ { TB_INT, 0, (N) } } +#define TB_TYPE_PTRN(N) (TB_DataType){ { TB_PTR, 0, (N) } } #endif @@ -737,7 +830,7 @@ TB_API TB_External* tb_next_external(TB_External* e); // this is used JIT scenarios to tell the compiler what externals map to TB_API TB_ExternalType tb_extern_get_type(TB_External* e); -TB_Global* tb_extern_transmute(TB_External* e, TB_DebugType* dbg_type, TB_Linkage linkage); +TB_API TB_Global* tb_extern_transmute(TB_External* e, TB_DebugType* dbg_type, TB_Linkage linkage); TB_API TB_External* tb_extern_create(TB_Module* m, ptrdiff_t len, const char* name, TB_ExternalType type); @@ -884,6 +977,11 @@ TB_API void tb_default_print_callback(void* user_data, const char* fmt, ...); TB_API void tb_inst_set_location(TB_Function* f, TB_SourceFile* file, int line, int column); TB_API void tb_inst_reset_location(TB_Function* f); +// this is where the STOP will be +TB_API void tb_inst_set_exit_location(TB_Function* f, TB_SourceFile* file, int line, int column); + +TB_API bool tb_has_effects(TB_Node* n); + // if section is NULL, default to .text TB_API TB_Function* tb_function_create(TB_Module* m, ptrdiff_t len, const char* name, TB_Linkage linkage, TB_ComdatType comdat); @@ -927,9 +1025,12 @@ TB_API TB_Node* tb_inst_float2int(TB_Function* f, TB_Node* src, TB_DataType dt, TB_API TB_Node* tb_inst_bitcast(TB_Function* f, TB_Node* src, TB_DataType dt); TB_API TB_Node* tb_inst_local(TB_Function* f, TB_CharUnits size, TB_CharUnits align); + TB_API TB_Node* tb_inst_load(TB_Function* f, TB_DataType dt, TB_Node* addr, TB_CharUnits align, bool is_volatile); TB_API void tb_inst_store(TB_Function* f, TB_DataType dt, TB_Node* addr, TB_Node* val, TB_CharUnits align, bool is_volatile); +TB_API void tb_inst_safepoint_poll(TB_Function* f, TB_Node* addr, int input_count, TB_Node** inputs); + TB_API TB_Node* tb_inst_bool(TB_Function* f, bool imm); TB_API TB_Node* tb_inst_sint(TB_Function* f, TB_DataType dt, int64_t imm); TB_API TB_Node* tb_inst_uint(TB_Function* f, TB_DataType dt, uint64_t imm); @@ -939,14 +1040,14 @@ TB_API TB_Node* tb_inst_cstring(TB_Function* f, const char* str); TB_API TB_Node* tb_inst_string(TB_Function* f, size_t len, const char* str); // write 'val' over 'count' bytes on 'dst' -TB_API void tb_inst_memset(TB_Function* f, TB_Node* dst, TB_Node* val, TB_Node* count, TB_CharUnits align, bool is_volatile); +TB_API void tb_inst_memset(TB_Function* f, TB_Node* dst, TB_Node* val, TB_Node* count, TB_CharUnits align); // zero 'count' bytes on 'dst' -TB_API void tb_inst_memzero(TB_Function* f, TB_Node* dst, TB_Node* count, TB_CharUnits align, bool is_volatile); +TB_API void tb_inst_memzero(TB_Function* f, TB_Node* dst, TB_Node* count, TB_CharUnits align); // performs a copy of 'count' elements from one memory location to another // both locations cannot overlap. -TB_API void tb_inst_memcpy(TB_Function* f, TB_Node* dst, TB_Node* src, TB_Node* count, TB_CharUnits align, bool is_volatile); +TB_API void tb_inst_memcpy(TB_Function* f, TB_Node* dst, TB_Node* src, TB_Node* count, TB_CharUnits align); // result = base + (index * stride) TB_API TB_Node* tb_inst_array_access(TB_Function* f, TB_Node* base, TB_Node* index, int64_t stride); @@ -1033,9 +1134,9 @@ TB_API TB_Node* tb_inst_cmp_fge(TB_Function* f, TB_Node* a, TB_Node* b); // General intrinsics TB_API TB_Node* tb_inst_va_start(TB_Function* f, TB_Node* a); +TB_API TB_Node* tb_inst_cycle_counter(TB_Function* f); // x86 Intrinsics -TB_API TB_Node* tb_inst_x86_rdtsc(TB_Function* f); TB_API TB_Node* tb_inst_x86_ldmxcsr(TB_Function* f, TB_Node* a); TB_API TB_Node* tb_inst_x86_stmxcsr(TB_Function* f); TB_API TB_Node* tb_inst_x86_sqrt(TB_Function* f, TB_Node* a); @@ -1061,6 +1162,19 @@ TB_API void tb_inst_ret(TB_Function* f, size_t count, TB_Node** values); //////////////////////////////// // Passes //////////////////////////////// +typedef enum { + // allowed to remove PHIs nodes, this is + // helpful because the default IR building + // will produce tons of useless memory PHIs. + TB_PEEPHOLE_PHI = 1, + + // it's allowed to fold memory operations (store or load elimination) + TB_PEEPHOLE_MEMORY = 2, + + // just do every reduction rule i can provide you + TB_PEEPHOLE_ALL = 7, +} TB_PeepholeFlags; + // Function analysis, optimizations, and codegen are all part of this typedef struct TB_Passes TB_Passes; @@ -1069,35 +1183,32 @@ TB_API TB_Passes* tb_pass_enter(TB_Function* f, TB_Arena* arena); TB_API void tb_pass_exit(TB_Passes* opt); // transformation passes: -// peephole: runs most simple reductions on the code, -// should be run after any bigger passes (it's incremental -// so it's not that bad) +// peephole: 99% of the optimizer, i'm sea of nodes pilled so i +// break down most optimizations into local rewrites, it's +// incremental and recommended to run after any non-peephole +// pass. // -// mem2reg: lowers TB_LOCALs into SSA values, this makes more +// mem2reg: lowers TB_LOCALs into SoN values, this makes more // data flow analysis possible on the code and allows to codegen // to place variables into registers. // -// cfg: performs simplifications on the CFG like `a && b => select(a, b, 0)` -// or removing redundant branches. -// -// loop: NOT READY -// -TB_API bool tb_pass_peephole(TB_Passes* opt); +// SROA: splits LOCALs into multiple to allow for more dataflow +// analysis later on. +TB_API void tb_pass_peephole(TB_Passes* opt, TB_PeepholeFlags flags); +TB_API void tb_pass_sroa(TB_Passes* opt); TB_API bool tb_pass_mem2reg(TB_Passes* opt); -TB_API bool tb_pass_loop(TB_Passes* opt); -TB_API bool tb_pass_cfg(TB_Passes* opt); + +TB_API void tb_pass_schedule(TB_Passes* opt); // analysis // print: prints IR in a flattened text form. TB_API bool tb_pass_print(TB_Passes* opt); -TB_API void tb_pass_schedule(TB_Passes* opt); - // codegen TB_API TB_FunctionOutput* tb_pass_codegen(TB_Passes* opt, bool emit_asm); TB_API void tb_pass_kill_node(TB_Passes* opt, TB_Node* n); -TB_API bool tb_pass_mark(TB_Passes* opt, TB_Node* n); +TB_API void tb_pass_mark(TB_Passes* opt, TB_Node* n); TB_API void tb_pass_mark_users(TB_Passes* opt, TB_Node* n); //////////////////////////////// diff --git a/src/tilde/tb.lib b/src/tilde/tb.lib index 2ec6ae708..4b3cdb9b0 100644 Binary files a/src/tilde/tb.lib and b/src/tilde/tb.lib differ diff --git a/src/tilde/tb_arena.h b/src/tilde/tb_arena.h index 548427139..67ec0e181 100644 --- a/src/tilde/tb_arena.h +++ b/src/tilde/tb_arena.h @@ -20,9 +20,9 @@ #endif enum { - TB_ARENA_SMALL_CHUNK_SIZE = 4 * 1024, - TB_ARENA_MEDIUM_CHUNK_SIZE = 512 * 1024, - TB_ARENA_LARGE_CHUNK_SIZE = 2 * 1024 * 1024, + TB_ARENA_SMALL_CHUNK_SIZE = 4 * 1024, + TB_ARENA_MEDIUM_CHUNK_SIZE = 512 * 1024, + TB_ARENA_LARGE_CHUNK_SIZE = 16 * 1024 * 1024, TB_ARENA_ALIGNMENT = 16, }; diff --git a/src/tilde_builtin.cpp b/src/tilde_builtin.cpp index 012e2c1b9..3b4e4f900 100644 --- a/src/tilde_builtin.cpp +++ b/src/tilde_builtin.cpp @@ -230,7 +230,7 @@ gb_internal cgValue cg_builtin_clamp(cgProcedure *p, Type *t, cgValue const &x, gb_internal cgValue cg_builtin_mem_zero(cgProcedure *p, cgValue const &ptr, cgValue const &len) { GB_ASSERT(ptr.kind == cgValue_Value); GB_ASSERT(len.kind == cgValue_Value); - tb_inst_memzero(p->func, ptr.node, len.node, 1, false); + tb_inst_memzero(p->func, ptr.node, len.node, 1); return ptr; } @@ -239,7 +239,7 @@ gb_internal cgValue cg_builtin_mem_copy(cgProcedure *p, cgValue const &dst, cgVa GB_ASSERT(src.kind == cgValue_Value); GB_ASSERT(len.kind == cgValue_Value); // TODO(bill): This needs to be memmove - tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1, false); + tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1); return dst; } @@ -247,7 +247,7 @@ gb_internal cgValue cg_builtin_mem_copy_non_overlapping(cgProcedure *p, cgValue GB_ASSERT(dst.kind == cgValue_Value); GB_ASSERT(src.kind == cgValue_Value); GB_ASSERT(len.kind == cgValue_Value); - tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1, false); + tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1); return dst; } diff --git a/src/tilde_expr.cpp b/src/tilde_expr.cpp index cd4e9f2d3..867b761d4 100644 --- a/src/tilde_expr.cpp +++ b/src/tilde_expr.cpp @@ -1193,6 +1193,9 @@ gb_internal cgValue cg_emit_conv(cgProcedure *p, cgValue value, Type *t) { GB_ASSERT(is_type_typed(st)); data = cg_emit_conv(p, data, t_rawptr); + if (p->name == "main@main") { + GB_PANIC("HERE %s %llu", type_to_string(st), cg_typeid_as_u64(p->module, value.type)); + } cgValue id = cg_typeid(p, st); cgValue data_ptr = cg_emit_struct_ep(p, result.addr, 0); diff --git a/src/tilde_proc.cpp b/src/tilde_proc.cpp index e12357c0e..f5f37d73e 100644 --- a/src/tilde_proc.cpp +++ b/src/tilde_proc.cpp @@ -373,9 +373,9 @@ gb_internal WORKER_TASK_PROC(cg_procedure_compile_worker_proc) { // optimization passes if (false) { - tb_pass_peephole(opt); + tb_pass_peephole(opt, TB_PEEPHOLE_ALL); tb_pass_mem2reg(opt); - tb_pass_peephole(opt); + tb_pass_peephole(opt, TB_PEEPHOLE_ALL); } bool emit_asm = false; @@ -572,7 +572,7 @@ gb_internal cgValue cg_emit_call(cgProcedure * p, cgValue value, Slice TB_CharUnits size = cast(TB_CharUnits)type_size_of(return_type); TB_CharUnits align = cast(TB_CharUnits)gb_max(type_align_of(return_type), 16); TB_Node *local = tb_inst_local(p->func, size, align); - tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false); + tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align); params[param_index++] = local; } } @@ -626,7 +626,7 @@ gb_internal cgValue cg_emit_call(cgProcedure * p, cgValue value, Slice TB_CharUnits align = cast(TB_CharUnits)gb_max(type_align_of(result), 16); TB_Node *local = tb_inst_local(p->func, size, align); // TODO(bill): Should this need to be zeroed any way? - tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false); + tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align); params[param_index++] = local; } } diff --git a/src/tilde_stmt.cpp b/src/tilde_stmt.cpp index 7dca2b671..f45dda0bc 100644 --- a/src/tilde_stmt.cpp +++ b/src/tilde_stmt.cpp @@ -42,6 +42,8 @@ gb_internal cgValue cg_emit_load(cgProcedure *p, cgValue const &ptr, bool is_vol return cg_lvalue_addr(tb_inst_get_symbol_address(p->func, ptr.symbol), type); } } + GB_ASSERT(dt.type != TB_MEMORY); + GB_ASSERT(dt.type != TB_TUPLE); // use the natural alignment // if people need a special alignment, they can use `intrinsics.unaligned_load` @@ -118,7 +120,7 @@ gb_internal void cg_emit_store(cgProcedure *p, cgValue dst, cgValue src, bool is // IMPORTANT TODO(bill): needs to be memmove i64 sz = type_size_of(dst_type); TB_Node *count = tb_inst_uint(p->func, TB_TYPE_INT, cast(u64)sz); - tb_inst_memcpy(p->func, dst_ptr, src_ptr, count, alignment, is_volatile); + tb_inst_memcpy(p->func, dst_ptr, src_ptr, count, alignment/*, is_volatile*/); return; } @@ -159,7 +161,7 @@ gb_internal cgValue cg_address_from_load(cgProcedure *p, cgValue value) { { TB_Node *load_inst = value.node; GB_ASSERT_MSG(load_inst->type == TB_LOAD, "expected a load instruction"); - TB_Node *ptr = load_inst->inputs[1]; + TB_Node *ptr = load_inst->inputs[2]; return cg_value(ptr, alloc_type_pointer(value.type)); } case cgValue_Addr: @@ -813,9 +815,10 @@ gb_internal cgAddr cg_add_local(cgProcedure *p, Type *type, Entity *e, bool zero if (zero_init) { bool is_volatile = false; + gb_unused(is_volatile); TB_Node *zero = tb_inst_uint(p->func, TB_TYPE_I8, 0); TB_Node *count = tb_inst_uint(p->func, TB_TYPE_I32, cast(u64)size); - tb_inst_memset(p->func, local, zero, count, alignment, is_volatile); + tb_inst_memset(p->func, local, zero, count, alignment/*, is_volatile*/); } cgAddr addr = cg_addr(cg_value(local, alloc_type_pointer(type))); @@ -861,7 +864,7 @@ gb_internal cgValue cg_copy_value_to_ptr(cgProcedure *p, cgValue value, Type *or tb_inst_store(p->func, cg_data_type(original_type), copy, value.node, align, false); } else { GB_ASSERT(value.kind == cgValue_Addr); - tb_inst_memcpy(p->func, copy, value.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false); + tb_inst_memcpy(p->func, copy, value.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align); } return cg_value(copy, alloc_type_pointer(original_type)); @@ -871,7 +874,7 @@ gb_internal cgValue cg_address_from_load_or_generate_local(cgProcedure *p, cgVal switch (value.kind) { case cgValue_Value: if (value.node->type == TB_LOAD) { - TB_Node *ptr = value.node->inputs[1]; + TB_Node *ptr = value.node->inputs[2]; return cg_value(ptr, alloc_type_pointer(value.type)); } break; @@ -1042,7 +1045,7 @@ gb_internal void cg_build_assignment(cgProcedure *p, Array const &lvals, TB_CharUnits size = cast(TB_CharUnits)type_size_of(type); TB_CharUnits align = cast(TB_CharUnits)type_align_of(type); TB_Node *copy = tb_inst_local(p->func, size, align); - tb_inst_memcpy(p->func, copy, init.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false); + tb_inst_memcpy(p->func, copy, init.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align); // use the copy instead init.node = copy; } @@ -2399,8 +2402,7 @@ gb_internal void cg_build_type_switch_stmt(cgProcedure *p, Ast *node) { backing_ptr, // dst data.node, // src tb_inst_uint(p->func, TB_TYPE_INT, size), - cast(TB_CharUnits)align, - false + cast(TB_CharUnits)align ); ptr = cg_value(backing_ptr, ct_ptr); @@ -2522,6 +2524,8 @@ gb_internal void cg_build_mutable_value_decl(cgProcedure *p, Ast *node) { TEMPORARY_ALLOCATOR_GUARD(); + + auto inits = array_make(temporary_allocator(), 0, vd->values.count != 0 ? vd->names.count : 0); for (Ast *rhs : vd->values) { cgValue init = cg_build_expr(p, rhs); diff --git a/src/tilde_type_info.cpp b/src/tilde_type_info.cpp index e1a26a26b..ad219071f 100644 --- a/src/tilde_type_info.cpp +++ b/src/tilde_type_info.cpp @@ -118,6 +118,11 @@ gb_internal u64 cg_typeid_as_u64(cgModule *m, Type *type) { data |= (special &~ (1ull<<1)) << 62ull; // special data |= (reserved &~ (1ull<<1)) << 63ull; // reserved } + + if (type == t_string) { + gb_printf_err("%llu\n", data); + } + return data; } @@ -449,7 +454,7 @@ gb_internal void cg_setup_type_info_data(cgModule *m) { u32 flags = type_info_flags_of_type(t); u64 id = cg_typeid_as_u64(m, t); - void *size_ptr = tb_global_add_region(m->mod, global, offset+size_offset, build_context.int_size); + void *size_ptr = tb_global_add_region(m->mod, global, offset+size_offset, build_context.int_size); void *align_ptr = tb_global_add_region(m->mod, global, offset+align_offset, build_context.int_size); void *flags_ptr = tb_global_add_region(m->mod, global, offset+flags_offset, 4); void *id_ptr = tb_global_add_region(m->mod, global, offset+id_offset, build_context.ptr_size); -- cgit v1.2.3 From 53380632a1d5a5582ab2d7ae69715655d0f46986 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 12 Sep 2023 11:44:54 +0100 Subject: Swap order of `prev` and `next` --- core/container/intrusive/list/intrusive_list.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/container/intrusive/list/intrusive_list.odin b/core/container/intrusive/list/intrusive_list.odin index 88e21edc5..d2df4475b 100644 --- a/core/container/intrusive/list/intrusive_list.odin +++ b/core/container/intrusive/list/intrusive_list.odin @@ -20,7 +20,7 @@ List :: struct { Node :: struct { - next, prev: ^Node, + prev, next: ^Node, } push_front :: proc(list: ^List, node: ^Node) { -- cgit v1.2.3 From 8e9d1c7ebf6cbcf9fba5a76e0bfe374d0359179c Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 12 Sep 2023 11:52:05 +0100 Subject: Make procedures contextless where possible --- core/container/intrusive/list/intrusive_list.odin | 44 +++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/core/container/intrusive/list/intrusive_list.odin b/core/container/intrusive/list/intrusive_list.odin index d2df4475b..7302f24f5 100644 --- a/core/container/intrusive/list/intrusive_list.odin +++ b/core/container/intrusive/list/intrusive_list.odin @@ -23,7 +23,7 @@ Node :: struct { prev, next: ^Node, } -push_front :: proc(list: ^List, node: ^Node) { +push_front :: proc "contextless" (list: ^List, node: ^Node) { if list.head != nil { list.head.prev = node node.prev, node.next = nil, list.head @@ -34,7 +34,7 @@ push_front :: proc(list: ^List, node: ^Node) { } } -push_back :: proc(list: ^List, node: ^Node) { +push_back :: proc "contextless" (list: ^List, node: ^Node) { if list.tail != nil { list.tail.next = node node.prev, node.next = list.tail, nil @@ -45,7 +45,7 @@ push_back :: proc(list: ^List, node: ^Node) { } } -remove :: proc(list: ^List, node: ^Node) { +remove :: proc "contextless" (list: ^List, node: ^Node) { if node != nil { if node.next != nil { node.next.prev = node.prev @@ -83,12 +83,34 @@ remove_by_proc :: proc(list: ^List, to_erase: proc(^Node) -> bool) { } } +remove_by_proc_contextless :: proc(list: ^List, to_erase: proc "contextless" (^Node) -> bool) { + for node := list.head; node != nil; { + next := node.next + if to_erase(node) { + if node.next != nil { + node.next.prev = node.prev + } + if node.prev != nil { + node.prev.next = node.next + } + if list.head == node { + list.head = node.next + } + if list.tail == node { + list.tail = node.prev + } + } + node = next + } +} + + -is_empty :: proc(list: ^List) -> bool { +is_empty :: proc "contextless" (list: ^List) -> bool { return list.head == nil } -pop_front :: proc(list: ^List) -> ^Node { +pop_front :: proc "contextless" (list: ^List) -> ^Node { link := list.head if link == nil { return nil @@ -108,7 +130,7 @@ pop_front :: proc(list: ^List) -> ^Node { return link } -pop_back :: proc(list: ^List) -> ^Node { +pop_back :: proc "contextless" (list: ^List) -> ^Node { link := list.tail if link == nil { return nil @@ -134,25 +156,25 @@ Iterator :: struct($T: typeid) { offset: uintptr, } -iterator_head :: proc(list: List, $T: typeid, $field_name: string) -> Iterator(T) +iterator_head :: proc "contextless" (list: List, $T: typeid, $field_name: string) -> Iterator(T) where intrinsics.type_has_field(T, field_name), intrinsics.type_field_type(T, field_name) == Node { return {list.head, offset_of_by_string(T, field_name)} } -iterator_tail :: proc(list: List, $T: typeid, $field_name: string) -> Iterator(T) +iterator_tail :: proc "contextless" (list: List, $T: typeid, $field_name: string) -> Iterator(T) where intrinsics.type_has_field(T, field_name), intrinsics.type_field_type(T, field_name) == Node { return {list.tail, offset_of_by_string(T, field_name)} } -iterator_from_node :: proc(node: ^Node, $T: typeid, $field_name: string) -> Iterator(T) +iterator_from_node :: proc "contextless" (node: ^Node, $T: typeid, $field_name: string) -> Iterator(T) where intrinsics.type_has_field(T, field_name), intrinsics.type_field_type(T, field_name) == Node { return {node, offset_of_by_string(T, field_name)} } -iterate_next :: proc(it: ^Iterator($T)) -> (ptr: ^T, ok: bool) { +iterate_next :: proc "contextless" (it: ^Iterator($T)) -> (ptr: ^T, ok: bool) { node := it.curr if node == nil { return nil, false @@ -162,7 +184,7 @@ iterate_next :: proc(it: ^Iterator($T)) -> (ptr: ^T, ok: bool) { return (^T)(uintptr(node) - it.offset), true } -iterate_prev :: proc(it: ^Iterator($T)) -> (ptr: ^T, ok: bool) { +iterate_prev :: proc "contextless" (it: ^Iterator($T)) -> (ptr: ^T, ok: bool) { node := it.curr if node == nil { return nil, false -- cgit v1.2.3 From 287beaff35479bd25aa2fb7a76eb779a3f0761c8 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Tue, 12 Sep 2023 16:49:42 +0200 Subject: use KiB etc. instead of KB --- core/fmt/fmt.odin | 8 ++++---- tests/core/fmt/test_core_fmt.odin | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index fad2548c8..ab57209c3 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1049,8 +1049,8 @@ _fmt_int_128 :: proc(fi: ^Info, u: u128, base: int, is_signed: bool, bit_size: i _pad(fi, s) } // Units of measurements: -__MEMORY_LOWER := " b kb mb gb tb pb eb" -__MEMORY_UPPER := " B KB MB GB TB PB EB" +__MEMORY_LOWER := " b kib mib gib tib pib eib" +__MEMORY_UPPER := " B KiB MiB GiB TiB PiB EiB" // Formats an integer value as bytes with the best representation. // // Inputs: @@ -1069,13 +1069,13 @@ _fmt_memory :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, units: st div, off, unit_len := 1, 0, 1 for n := abs; n >= mem.Kilobyte; n /= mem.Kilobyte { div *= mem.Kilobyte - off += 3 + off += 4 // First iteration is slightly different because you go from // units of length 1 to units of length 2. if unit_len == 1 { off = 2 - unit_len = 2 + unit_len = 3 } } diff --git a/tests/core/fmt/test_core_fmt.odin b/tests/core/fmt/test_core_fmt.odin index 8928338b3..4459af609 100644 --- a/tests/core/fmt/test_core_fmt.odin +++ b/tests/core/fmt/test_core_fmt.odin @@ -42,18 +42,18 @@ test_fmt_memory :: proc(t: ^testing.T) { expect(t, got == exp, fmt.tprintf("(%q, %v): %q != %q", format, args, got, exp), loc) } - check(t, "5b", "%m", 5) - check(t, "5B", "%M", 5) - check(t, "-5B", "%M", -5) - check(t, "3.00kb", "%m", mem.Kilobyte * 3) - check(t, "3kb", "%.0m", mem.Kilobyte * 3) - check(t, "3KB", "%.0M", mem.Kilobyte * 3) - check(t, "3.000 mb", "%#.3m", mem.Megabyte * 3) - check(t, "3.50 gb", "%#m", u32(mem.Gigabyte * 3.5)) - check(t, "001tb", "%5.0m", mem.Terabyte) - check(t, "-01tb", "%5.0m", -mem.Terabyte) - check(t, "2.50 pb", "%#5.m", uint(mem.Petabyte * 2.5)) - check(t, "1.00 EB", "%#M", mem.Exabyte) - check(t, "255 B", "%#M", u8(255)) - check(t, "0b", "%m", u8(0)) + check(t, "5b", "%m", 5) + check(t, "5B", "%M", 5) + check(t, "-5B", "%M", -5) + check(t, "3.00kib", "%m", mem.Kilobyte * 3) + check(t, "3kib", "%.0m", mem.Kilobyte * 3) + check(t, "3KiB", "%.0M", mem.Kilobyte * 3) + check(t, "3.000 mib", "%#.3m", mem.Megabyte * 3) + check(t, "3.50 gib", "%#m", u32(mem.Gigabyte * 3.5)) + check(t, "01tib", "%5.0m", mem.Terabyte) + check(t, "-1tib", "%5.0m", -mem.Terabyte) + check(t, "2.50 pib", "%#5.m", uint(mem.Petabyte * 2.5)) + check(t, "1.00 EiB", "%#M", mem.Exabyte) + check(t, "255 B", "%#M", u8(255)) + check(t, "0b", "%m", u8(0)) } -- cgit v1.2.3 From d47b0eeee78961f3bc0f785337dfb4674e9092fd Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Tue, 12 Sep 2023 16:51:21 +0200 Subject: update doc --- core/fmt/doc.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/fmt/doc.odin b/core/fmt/doc.odin index e758f9638..597342e76 100644 --- a/core/fmt/doc.odin +++ b/core/fmt/doc.odin @@ -35,8 +35,8 @@ Floating-point, complex numbers, and quaternions: %F synonym for %f %h hexadecimal (lower-case) representation with 0h prefix (0h01234abcd) %H hexadecimal (upper-case) representation with 0H prefix (0h01234ABCD) - %m number of bytes in the best unit of measurement, e.g. 123.45mb - %M number of bytes in the best unit of measurement, e.g. 123.45MB + %m number of bytes in the best unit of measurement, e.g. 123.45mib + %M number of bytes in the best unit of measurement, e.g. 123.45MiB String and slice of bytes %s the uninterpreted bytes of the string or slice %q a double-quoted string safely escaped with Odin syntax -- cgit v1.2.3 From 35857d3103b65020ce486571506aa69f53ad9a1a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 12 Sep 2023 23:01:49 +0100 Subject: Fix wrong type --- core/os/os_linux.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin index 1a4c1fddb..51a14ab44 100644 --- a/core/os/os_linux.odin +++ b/core/os/os_linux.odin @@ -441,7 +441,7 @@ pollfd :: struct { sigset_t :: distinct u64 foreign libc { - @(link_name="__errno_location") __errno_location :: proc() -> ^int --- + @(link_name="__errno_location") __errno_location :: proc() -> ^c.int --- @(link_name="getpagesize") _unix_getpagesize :: proc() -> c.int --- @(link_name="get_nprocs") _unix_get_nprocs :: proc() -> c.int --- @@ -488,7 +488,7 @@ _get_errno :: proc(res: int) -> Errno { // get errno from libc get_last_error :: proc "contextless" () -> int { - return __errno_location()^ + return int(__errno_location()^) } personality :: proc(persona: u64) -> (Errno) { -- cgit v1.2.3 From aaccaa19bfda7571284b114d97c03cfba8024a09 Mon Sep 17 00:00:00 2001 From: hikari Date: Wed, 13 Sep 2023 23:47:18 +0300 Subject: [vendor:directx/d3d11] Added `CalcSubresource` helper macro --- vendor/directx/d3d11/d3d11.odin | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vendor/directx/d3d11/d3d11.odin b/vendor/directx/d3d11/d3d11.odin index ea1e7f5f8..d94c05d06 100644 --- a/vendor/directx/d3d11/d3d11.odin +++ b/vendor/directx/d3d11/d3d11.odin @@ -15,6 +15,7 @@ GUID :: dxgi.GUID IID :: dxgi.IID SIZE_T :: dxgi.SIZE_T BOOL :: dxgi.BOOL +UINT :: dxgi.UINT RECT :: dxgi.RECT SIZE :: dxgi.SIZE @@ -5146,3 +5147,7 @@ MESSAGE_ID :: enum u32 { TRACKED_WORKLOAD_DISJOINT_FAILURE, D3D11_5_MESSAGES_END, } + +CalcSubresource :: #force_inline proc "contextless" (MipSlice: UINT, ArraySlice: UINT, MipLevels: UINT) -> UINT { + return MipSlice + ArraySlice * MipLevels +} -- cgit v1.2.3 From 06d26df046cad644cad066ffaa9978c423f54f8b Mon Sep 17 00:00:00 2001 From: AbdelHameed-Hamed Date: Thu, 14 Sep 2023 19:24:44 +0200 Subject: Move API into one file and use "system" calling convention, and move data definitions into platform specific files. --- vendor/directx/dxc/dxcapi.odin | 594 +++++++++++++++++++++++++++++++ vendor/directx/dxc/dxcapi_unix.odin | 626 --------------------------------- vendor/directx/dxc/dxcapi_windows.odin | 604 ------------------------------- vendor/directx/dxc/dxcdef_unix.odin | 37 ++ vendor/directx/dxc/dxcdef_windows.odin | 16 + 5 files changed, 647 insertions(+), 1230 deletions(-) create mode 100644 vendor/directx/dxc/dxcapi.odin delete mode 100644 vendor/directx/dxc/dxcapi_unix.odin delete mode 100644 vendor/directx/dxc/dxcapi_windows.odin create mode 100644 vendor/directx/dxc/dxcdef_unix.odin create mode 100644 vendor/directx/dxc/dxcdef_windows.odin diff --git a/vendor/directx/dxc/dxcapi.odin b/vendor/directx/dxc/dxcapi.odin new file mode 100644 index 000000000..79d305ea0 --- /dev/null +++ b/vendor/directx/dxc/dxcapi.odin @@ -0,0 +1,594 @@ +package directx_dxc + +when ODIN_OS == .Windows { + foreign import dxcompiler "dxcompiler.lib" +} else { + foreign import dxcompiler "system:dxcompiler" +} + +@(default_calling_convention="c", link_prefix="Dxc") +foreign dxcompiler { + CreateInstance :: proc (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- + CreateInstance2 :: proc (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- +} + +pCreateInstanceProc :: #type proc "c" (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT +pCreateInstance2Proc :: #type proc "c" (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT + +CreateInstance_ProcName :: "DxcCreateInstance" +CreateInstance2_ProcName :: "DxcCreateInstance2" + +IMalloc :: struct #raw_union { + #subtype iunknown: IUnknown, + using imalloc_vtable: ^IMalloc_VTable, +} +IMalloc_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Alloc: proc "system" (this: ^IMalloc, cb: SIZE_T) -> rawptr, + Realloc: proc "system" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr, + Free: proc "system" (this: ^IMalloc, pv: rawptr), + GetSize: proc "system" (this: ^IMalloc, pv: rawptr) -> SIZE_T, + DidAlloc: proc "system" (this: ^IMalloc, pv: rawptr) -> i32, + HeapMinimize: proc "system" (this: ^IMalloc), +} + +ISequentialStream :: struct #raw_union { + #subtype iunknown: IUnknown, + using isequentialstream_vtable: ^ISequentialStream_VTable, +} +ISequentialStream_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Read: proc "system" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT, + Write: proc "system" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT, +} + +STATSTG :: struct { + pwcsName: wstring, + type: u32, + cbSize: u64, + mtime: FILETIME, + ctime: FILETIME, + atime: FILETIME, + grfMode: u32, + grfLocksSupported: u32, + clsid: CLSID, + grfStateBits: u32, + reserved: u32, +} + +IStream :: struct #raw_union { + #subtype isequentialstream: ISequentialStream, + using istream_vtable: ^IStream_VTable, +} +IStream_VTable :: struct { + using isequentialstream_vtable: ISequentialStream_VTable, + Seek: proc "system" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT, + SetSize: proc "system" (this: ^IStream, libNewSize: u64) -> HRESULT, + CopyTo: proc "system" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT, + Commit: proc "system" (this: ^IStream, grfCommitFlags: u32) -> HRESULT, + Revert: proc "system" (this: ^IStream) -> HRESULT, + LockRegion: proc "system" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, + UnlockRegion: proc "system" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, + Stat: proc "system" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT, + Clone: proc "system" (this: ^IStream, ppstm: ^^IStream) -> HRESULT, +} + +IBlob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102" +IBlob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}} +IBlob :: struct #raw_union { + #subtype iunknown: IUnknown, + using id3d10blob_vtable: ^IBlob_VTable, +} +IBlob_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetBufferPointer: proc "system" (this: ^IBlob) -> rawptr, + GetBufferSize: proc "system" (this: ^IBlob) -> SIZE_T, +} + +IBlobEncoding_UUID_STRRING :: "7241D424-2646-4191-97C0-98E96E42FC68" +IBlobEncoding_UUID := &IID{0x7241D424, 0x2646, 0x4191, {0x97, 0xC0, 0x98, 0xE9, 0x6E, 0x42, 0xFC, 0x68}} +IBlobEncoding :: struct #raw_union { + #subtype idxcblob: IBlob, + using idxcblobencoding_vtable: ^IBlobEncoding_VTable, +} +IBlobEncoding_VTable :: struct { + using idxcblob_vtable: IBlob_VTable, + GetEncoding: proc "system" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT, +} + +IBlobUtf16_UUID_STRING :: "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84" +IBlobUtf16_UUID := &IID{0xA3F84EAB, 0x0FAA, 0x497E, {0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84}} +IBlobUtf16 :: struct #raw_union { + #subtype idxcblobencoding: IBlobEncoding, + using idxcblobutf16_vtable : ^IBlobUtf16_VTable, +} +IBlobUtf16_VTable :: struct { + using idxcblobencoding_vtable: IBlobEncoding_VTable, + GetStringPointer: proc "system" (this: ^IBlobUtf16) -> wstring, + GetStringLength: proc "system" (this: ^IBlobUtf16) -> SIZE_T, +} + +IBlobUtf8_UUID_STRING :: "3DA636C9-BA71-4024-A301-30CBF125305B" +IBlobUtf8_UUID := &IID{0x3DA636C9, 0xBA71, 0x4024, {0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B}} +IBlobUtf8 :: struct #raw_union { + #subtype idxcblobencoding: IBlobEncoding, + using idxcblobutf8_vtable : ^IBlobUtf8_VTable, +} +IBlobUtf8_VTable :: struct { + using idxcblobencoding_vtable: IBlobEncoding_VTable, + GetStringPointer: proc "system" (this: ^IBlobUtf8) -> cstring, + GetStringLength: proc "system" (this: ^IBlobUtf8) -> SIZE_T, +} + +IIncludeHandler_UUID_STRING :: "7F61FC7D-950D-467F-B3E3-3C02FB49187C" +IIncludeHandler_UUID := &IID{0x7F61FC7D, 0x950D, 0x467F, {0xB3, 0xE3, 0x3C, 0x02, 0xFB, 0x49, 0x18, 0x7C}} +IIncludeHandler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcincludehandler_vtable: ^IIncludeHandler_VTable, +} +IIncludeHandler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + LoadSource: proc "system" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT, +} + +Define :: struct { + Name: wstring, + Value: wstring, +} + +ICompilerArgs_UUID_STRING :: "73EFFE2A-70DC-45F8-9690-EFF64C02429D" +ICompilerArgs_UUID := &IID{0x73EFFE2A, 0x70DC, 0x45F8, {0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D}} +ICompilerArgs :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompilerargs_vtable: ^ICompilerArgs_VTable, +} +ICompilerArgs_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetArguments: proc "system" (this: ^ICompilerArgs) -> [^]wstring, + GetCount: proc "system" (this: ^ICompilerArgs) -> u32, + AddArguments: proc "system" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT, + AddArgumentsUTF8: proc "system" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT, + AddDefines: proc "system" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT, +} + +ILibrary_UUID_STRING :: "E5204DC7-D18C-4C3C-BDFB-851673980FE7" +ILibrary_UUID := &IID{0xE5204DC7, 0xD18C, 0x4C3C, {0xBD, 0xFB, 0x85, 0x16, 0x73, 0x98, 0x0F, 0xE7}} +ILibrary :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxclibrary_vtable: ^ILibrary_VTable, +} +ILibrary_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + SetMalloc: proc "system" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT, + CreateBlobFromBlob: proc "system" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, + CreateBlobFromFile: proc "system" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingFromPinned: proc "system" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingOnHeapCopy: proc "system" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlobWithEncodingOnMalloc: proc "system" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateIncludeHandler: proc "system" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT, + CreateStreamFromBlobReadOnly: proc "system" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, + GetBlobAsUtf8: proc "system" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + GetBlobAsUtf16: proc "system" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, +} + +IOperationResult_UUID_STRING :: "CEDB484A-D4E9-445A-B991-CA21CA157DC2" +IOperationResult_UUID := &IID{0xCEDB484A, 0xD4E9, 0x445A, {0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2}} +IOperationResult :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoperationresult_vtable: ^IOperationResult_VTable, +} +IOperationResult_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetStatus: proc "system" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT, + GetResult: proc "system" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT, + GetErrorBuffer: proc "system" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT, +} + +ICompiler_UUID_STRING :: "8C210BF3-011F-4422-8D70-6F9ACB8DB617" +ICompiler_UUID := &IID{0x8C210BF3, 0x011F, 0x4422, {0x8D, 0x70, 0x6F, 0x9A, 0xCB, 0x8D, 0xB6, 0x17}} +ICompiler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompiler_vtable: ^ICompiler_VTable, +} +ICompiler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Compile: proc "system" ( + this: ^ICompiler, + pSource: ^Buffer, + pSourceName: wstring, + pEntryPoint: wstring, + pTargetProfile: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult) -> HRESULT, + Preprocess: proc "system" ( + this: ^ICompiler, + pSource: ^Buffer, + pSourceName: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult) -> HRESULT, + Disassemble: proc "system" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT, +} + +ICompiler2_UUID_STRING :: "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37" +ICompiler2_UUID := &IID{0xA005A9D9, 0xB8BB, 0x4594, {0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37}} +ICompiler2 :: struct #raw_union { + #subtype icompiler: ICompiler, + using idxccompiler2_vtable: ^ICompiler2_VTable, +} +ICompiler2_VTable :: struct { + using idxccompiler_vtable: ^ICompiler_VTable, + CompileWithDebug: proc "system" ( + this: ^ICompiler2, + pSource: ^Buffer, + pSourceName: wstring, + pEntryPoint: wstring, + pTargetProfile: wstring, + pArguments: [^]wstring, + argCount: u32, + pDefines: [^]Define, + defineCount: u32, + pIncludeHandler: ^IIncludeHandler, + ppResult: ^^IOperationResult, + ppDebugBlobName: ^wstring, + ppDebugBlob: ^^IBlob) -> HRESULT, +} + +ILinker_UUID_STRING :: "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6" +ILinker_UUID := &IID{0xF1B5BE2A, 0x62DD, 0x4327, {0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6}} +ILinker :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxclinker_vtable: ^ILinker_VTable, +} +ILinker_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + RegisterLibrary: proc "system" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT, + Link: proc "system" ( + this: ^ILinker, + pEntryName: wstring, + pTargetProfile: wstring, + pLibNames: [^]wstring, + libCount: u32, + pArguments: [^]wstring, + argCount: u32, + ppResult: ^^IOperationResult) -> HRESULT, +} + +Buffer :: struct { + Ptr: rawptr, + Size: SIZE_T, + Encoding: u32, +} + +IUtils_UUID_STRING :: "4605C4CB-2019-492A-ADA4-65F20BB7D67F" +IUtils_UUID := &IID{0x4605C4CB, 0x2019, 0x492A, {0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F}} +IUtils :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcutils_vtable: ^IUtils_VTable, +} +IUtils_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + CreateBlobFromBlob: proc "system" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, + CreateBlobFromPinned: proc "system" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + MoveToBlob: proc "system" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateBlob: proc "system" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + LoadFile: proc "system" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, + CreateReadOnlyStreamFromBlob: proc "system" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, + CreateDefaultIncludeHandler: proc "system" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT, + GetBlobAsUtf8: proc "system" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT, + GetBlobAsUtf16: proc "system" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT, + GetDxilContainerPart: proc "system" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT, + CreateReflection: proc "system" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT, + BuildArguments: proc "system" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT, + GetPDBContents: proc "system" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT, +} + +DXC_OUT_KIND :: enum u32 { + NONE = 0, + OBJECT = 1, + ERRORS = 2, + PDB = 3, + SHADER_HASH = 4, + DISASSEMBLY = 5, + HLSL = 6, + TEXT = 7, + REFLECTION = 8, + ROOT_SIGNATURE = 9, + EXTRA_OUTPUTS = 10, + FORCE_DWORD = 0xFFFFFFFF, +} + +IResult_UUID_STRING :: "58346CDA-DDE7-4497-9461-6F87AF5E0659" +IResult_UUID := &IID{0x58346CDA, 0xDDE7, 0x4497, {0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59}} +IResult :: struct #raw_union { + #subtype idxcoperationresult: IOperationResult, + using idxcresult_vtable: ^IResult_VTable, +} +IResult_VTable :: struct { + using idxcoperationresult_vtable: IOperationResult_VTable, + HasOutput: proc "system" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL, + GetOutput: proc "system" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT, + GetNumOutputs: proc "system" (this: ^IResult) -> u32, + GetOutputByIndex: proc "system" (this: ^IResult, Index: u32) -> DXC_OUT_KIND, + PrimaryOutput: proc "system" (this: ^IResult) -> DXC_OUT_KIND, +} + +IExtraOutputs_UUID_STRING :: "319B37A2-A5C2-494A-A5DE-4801B2FAF989" +IExtraOutputs_UUID := &IID{0x319B37A2, 0xA5C2, 0x494A, {0xA5, 0xDE, 0x48, 0x01, 0xB2, 0xFA, 0xF9, 0x89}} +IExtraOutputs :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcextraoutputs_vtable: ^IExtraOutputs_VTable, +} +IExtraOutputs_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetOutputCount: proc "system" (this: ^IExtraOutputs) -> u32, + GetOutput: proc "system" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT, +} + +ICompiler3_UUID_STRING :: "228B4687-5A6A-4730-900C-9702B2203F54" +ICompiler3_UUID := &IID{0x228B4687, 0x5A6A, 0x4730, {0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54}} +ICompiler3 :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccompiler3_vtable: ^ICompiler3_VTable, +} +ICompiler3_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Compile: proc "system" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT, + Disassemble: proc "system" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT, +} + +IValidator_UUID_STRING :: "A6E82BD2-1FD7-4826-9811-2857E797F49A" +IValidator_UUID := &IID{0xA6E82BD2, 0x1FD7, 0x4826, {0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A}} +IValidator :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcvalidator_vtable: ^IValidator_VTable, +} +IValidator_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Validate: proc "system" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT, +} + +IValidator2_UUID_STRING :: "458E1FD1-B1B2-4750-A6E1-9C10F03BED92" +IValidator2_UUID := &IID{0x458E1FD1, 0xB1B2, 0x4750, {0xA6, 0xE1, 0x9C, 0x10, 0xF0, 0x3B, 0xED, 0x92}} +IValidator2 :: struct #raw_union { + #subtype idxcvalidator: IValidator, + using idxcvalidator2_vtable: ^IValidator2_VTable, +} +IValidator2_VTable :: struct { + using idxcvalidator_vtable: IValidator_VTable, + ValidateWithDebug: proc "system" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT, +} + +IContainerBuilder_UUID_STRING :: "334B1F50-2292-4B35-99A1-25588D8C17FE" +IContainerBuilder_UUID := &IID{0x334B1F50, 0x2292, 0x4B35, {0x99, 0xA1, 0x25, 0x58, 0x8D, 0x8C, 0x17, 0xFE}} +IContainerBuilder :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccontainerbuilder_vtable: ^IContainerBuilder_VTable, +} +IContainerBuilder_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "system" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT, + AddPart: proc "system" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT, + RemovePart: proc "system" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT, + SerializeContainer: proc "system" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT, +} + +IAssembler_UUID_STRING :: "091F7A26-1C1F-4948-904B-E6E3A8A771D5" +IAssembler_UUID := &IID{0x091F7A26, 0x1C1F, 0x4948, {0x90, 0x4B, 0xE6, 0xE3, 0xA8, 0xA7, 0x71, 0xD5}} +IAssembler :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcassembler_vtable: ^IAssembler_VTable, +} +IAssembler_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + AssembleToContainer: proc "system" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT, +} + +IContainerReflection_UUID_STRING :: "D2C21B26-8350-4BDC-976A-331CE6F4C54C" +IContainerReflection_UUID := &IID{0xD2C21B26, 0x8350, 0x4BDC, {0x97, 0x6A, 0x33, 0x1C, 0xE6, 0xF4, 0xC5, 0x4C}} +IContainerReflection :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxccontainerreflection_vtable: ^IContainerReflection_VTable, +} +IContainerReflection_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "system" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT, + GetPartCount: proc "system" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT, + GetPartKind: proc "system" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT, + GetPartContent: proc "system" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT, + FindFirstPartKind: proc "system" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT, + GetPartReflection: proc "system" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT, +} + +IOptimizerPass_UUID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" +IOptimizerPass_UUID := &IID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} +IOptimizerPass :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoptimizerpass_vtable: ^IOptimizerPass_VTable, +} +IOptimizerPass_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetOptionName: proc "system" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, + GetDescription: proc "system" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, + GetOptionArgCount: proc "system" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT, + GetOptionArgName: proc "system" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, + GetOptionArgDescription: proc "system" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, +} + +IOptimizer_UUID_STRING :: "25740E2E-9CBA-401B-9119-4FB42F39F270" +IOptimizer_UUID := &IID{0x25740E2E, 0x9CBA, 0x401B, {0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70}} +IOptimizer :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcoptimizer_vtable: ^IOptimizer_VTable, +} +IOptimizer_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetAvailablePassCount: proc "system" (this: ^IOptimizer, pCount: ^u32) -> HRESULT, + GetAvailablePass: proc "system" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT, + RunOptimizer: proc "system" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT, +} + +VersionInfoFlags :: enum u32 { + None = 0, + Debug = 1, + Internal = 2, +} + +IVersionInfo_UUID_STRING :: "B04F5B50-2059-4F12-A8FF-A1E0CDE1CC7E" +IVersionInfo_UUID := &IID{0xB04F5B50, 0x2059, 0x4F12, {0xA8, 0xFF, 0xA1, 0xE0, 0xCD, 0xE1, 0xCC, 0x7E}} +IVersionInfo :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcversioninfo_vtable: ^IVersionInfo_VTable, +} +IVersionInfo_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetVersion: proc "system" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT, + GetFlags: proc "system" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT, +} + +IVersionInfo2_UUID_STRING :: "FB6904C4-42F0-4B62-9C46-983AF7DA7C83" +IVersionInfo2_UUID := &IID{0xFB6904C4, 0x42F0, 0x4B62, {0x9C, 0x46, 0x98, 0x3A, 0xF7, 0xDA, 0x7C, 0x83}} +IVersionInfo2 :: struct #raw_union { + #subtype idxcversioninfo: IVersionInfo, + using idxcversioninfo2_vtable: ^IVersionInfo2_VTable, +} +IVersionInfo2_VTable :: struct { + using idxcversioninfo_vtable: IVersionInfo_VTable, + GetCommitInfo: proc "system" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT, +} + +IVersionInfo3_UUID_STRING :: "5E13E843-9D25-473C-9AD2-03B2D0B44B1E" +IVersionInfo3_UUID := &IID{0x5E13E843, 0x9D25, 0x473C, {0x9A, 0xD2, 0x03, 0xB2, 0xD0, 0xB4, 0x4B, 0x1E}} +IVersionInfo3 :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcversioninfo3_vtable: ^IVersionInfo3_VTable, +} +IVersionInfo3_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + GetCustomVersionString: proc "system" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT, +} + +ArgPair :: struct { + pName: wstring, + pValue: wstring, +} + +IPdbUtils_UUID_STRING :: "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D" +IPdbUtils_UUID := &IID{0xE6C9647E, 0x9D6A, 0x4C3B, {0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D}} +IPdbUtils :: struct #raw_union { + #subtype iunknown: IUnknown, + using idxcpdbutils_vtable: ^IPdbUtils_VTable, +} +IPdbUtils_VTable :: struct { + using iunknown_vtable: IUnknown_VTable, + Load: proc "system" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT, + GetSourceCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetSource: proc "system" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT, + GetSourceName: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetFlagCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetFlag: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetArgCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetArg: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetArgPairCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetArgPair: proc "system" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT, + GetDefineCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, + GetDefine: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, + GetTargetProfile: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetEntryPoint: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetMainFileName: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + GetHash: proc "system" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT, + GetName: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, + IsFullPDB: proc "system" (this: ^IPdbUtils) -> BOOL, + GetFullPDB: proc "system" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT, + GetVersionInfo: proc "system" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT, + SetCompiler: proc "system" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT, + CompileForFullPDB: proc "system" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT, + OverrideArgs: proc "system" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT, + OverrideRootSignature: proc "system" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT, +} + + +Compiler_CLSID_STRING :: "73E22D93-E6CE-47F3-B5BF-F0664F39C1B0" +Compiler_CLSID := &CLSID{0x73E22D93, 0xE6CE, 0x47F3, {0xB5, 0xBF, 0xF0, 0x66, 0x4F, 0x39, 0xC1, 0xB0}} + +Linker_CLSID_STRING :: "EF6A8087-B0EA-4D56-9E45-D07E1A8B7806" +Linker_CLSID := &CLSID{0xEF6A8087, 0xB0EA, 0x4D56, {0x9E, 0x45, 0xD0, 0x7E, 0x1A, 0x8B, 0x78, 0x6}} + +DiaDataSource_CLSID_STRING :: "CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F" +DiaDataSource_CLSID := &CLSID{0xCD1F6B73, 0x2AB0, 0x484D, {0x8E, 0xDC, 0xEB, 0xE7, 0xA4, 0x3C, 0xA0, 0x9F}} + +CompilerArgs_CLSID_STRING :: "3E56AE82-224D-470F-A1A1-FE3016EE9F9D" +CompilerArgs_CLSID := &CLSID{0x3E56AE82, 0x224D, 0x470F, {0xA1, 0xA1, 0xFE, 0x30, 0x16, 0xEE, 0x9F, 0x9D}} + +Library_CLSID_STRING :: "6245D6AF-66E0-48FD-80B4-4D271796748C" +Library_CLSID := &CLSID{0x6245D6AF, 0x66E0, 0x48FD, {0x80, 0xB4, 0x4D, 0x27, 0x17, 0x96, 0x74, 0x8C}} + +Utils_CLSID_STRING :: Library_CLSID_STRING +Utils_CLSID := Library_CLSID + +Validator_CLSID_STRING :: "8CA3E215-F728-4CF3-8CDD-88AF917587A1" +Validator_CLSID := &CLSID{0x8CA3E215, 0xF728, 0x4CF3, {0x8C, 0xDD, 0x88, 0xAF, 0x91, 0x75, 0x87, 0xA1}} + +Assembler_CLSID_STRING :: "D728DB68-F903-4F80-94CD-DCCF76EC7151" +Assembler_CLSID := &CLSID{0xD728DB68, 0xF903, 0x4F80, {0x94, 0xCD, 0xDC, 0xCF, 0x76, 0xEC, 0x71, 0x51}} + +ContainerReflection_CLSID_STRING :: "b9f54489-55b8-400c-ba3a-1675e4728b91" +ContainerReflection_CLSID := &CLSID{0xB9F54489, 0x55B8, 0x400C, {0xBA, 0x3A, 0x16, 0x75, 0xE4, 0x72, 0x8B, 0x91}} + +Optimizer_CLSID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" +Optimizer_CLSID := &CLSID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} + +ContainerBuilder_CLSID_STRING :: "94134294-411f-4574-b4d0-8741e25240d2" +ContainerBuilder_CLSID := &CLSID{0x94134294, 0x411F, 0x4574, {0xB4, 0xD0, 0x87, 0x41, 0xE2, 0x52, 0x40, 0xD2}} + +PdbUtils_CLSID_STRING :: "54621dfb-f2ce-457e-ae8c-ec355faeec7c" +PdbUtils_CLSID := &CLSID{0x54621DFB, 0xF2CE, 0x457E, {0xAE, 0x8C, 0xEC, 0x35, 0x5F, 0xAE, 0xEC, 0x7C}} + +CP_UTF8 :: 65001 +CP_UTF16 :: 1200 +CP_ACP :: 0 + +make_fourcc :: proc "contextless" (ch0, ch1, ch2, ch3: u32) -> u32 { + return ch0 | (ch1 << 8) | (ch2 << 16) | (ch3 << 24) +} + +PART_PDB :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('B')<<24) +PART_PDB_NAME :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('N')<<24) +PART_PRIVATE_DATA :: u32('P') | (u32('R')<<8) | (u32('I')<<16) | (u32('V')<<24) +PART_ROOT_SIGNATURE :: u32('R') | (u32('T')<<8) | (u32('S')<<16) | (u32('0')<<24) +PART_DXIL :: u32('D') | (u32('X')<<8) | (u32('I')<<16) | (u32('L')<<24) +PART_REFLECTION_DATA :: u32('S') | (u32('T')<<8) | (u32('A')<<16) | (u32('T')<<24) +PART_SHADER_HASH :: u32('H') | (u32('A')<<8) | (u32('S')<<16) | (u32('H')<<24) +PART_INPUT_SIGNATURE :: u32('I') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) +PART_OUTPUT_SIGNATURE :: u32('O') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) +PART_PATCH_CONSTANT_SIGNATURE :: u32('P') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) + +ARG_DEBUG :: "-Zi" +ARG_SKIP_VALIDATION :: "-Vd" +ARG_SKIP_OPTIMIZATIONS :: "-Od" +ARG_PACK_MATRIX_ROW_MAJOR :: "-Zpr" +ARG_PACK_MATRIX_COLUMN_MAJOR :: "-Zpc" +ARG_AVOID_FLOW_CONTROL :: "-Gfa" +ARG_PREFER_FLOW_CONTROL :: "-Gfp" +ARG_ENABLE_STRICTNESS :: "-Ges" +ARG_ENABLE_BACKWARDS_COMPATIBILITY :: "-Gec" +ARG_IEEE_STRICTNESS :: "-Gis" +ARG_OPTIMIZATION_LEVEL0 :: "-O0" +ARG_OPTIMIZATION_LEVEL1 :: "-O1" +ARG_OPTIMIZATION_LEVEL2 :: "-O2" +ARG_OPTIMIZATION_LEVEL3 :: "-O3" +ARG_WARNINGS_ARE_ERRORS :: "-WX" +ARG_RESOURCES_MAY_ALIAS :: "-res_may_alias" +ARG_ALL_RESOURCES_BOUND :: "-all_resources_bound" +ARG_DEBUG_NAME_FOR_SOURCE :: "-Zss" +ARG_DEBUG_NAME_FOR_BINARY :: "-Zsb" + +EXTRA_OUTPUT_NAME_STDOUT :: "*stdout*" +EXTRA_OUTPUT_NAME_STDERR :: "*stderr*" diff --git a/vendor/directx/dxc/dxcapi_unix.odin b/vendor/directx/dxc/dxcapi_unix.odin deleted file mode 100644 index d92eaccd7..000000000 --- a/vendor/directx/dxc/dxcapi_unix.odin +++ /dev/null @@ -1,626 +0,0 @@ -//+build linux, darwin -package directx_dxc -import "core:c" - -foreign import dxcompiler "system:dxcompiler" - -FILETIME :: struct { - dwLowDateTime: DWORD, - dwHighDateTime: DWORD, -} - -GUID :: struct { - Data1: DWORD, - Data2: WORD, - Data3: WORD, - Data4: [8]BYTE, -} - -BYTE :: distinct u8 -WORD :: u16 -DWORD :: u32 -BOOL :: distinct b32 -SIZE_T :: uint -ULONG :: c.ulong -CLSID :: GUID -IID :: GUID -LONG :: distinct c.long -HRESULT :: distinct LONG -wstring :: [^]c.wchar_t -BSTR :: wstring - -IUnknown :: struct { - using _iunknown_vtable: ^IUnknown_VTable, -} -IUnknown_VTable :: struct { - QueryInterface: proc "c" (this: ^IUnknown, riid: ^IID, ppvObject: ^rawptr) -> HRESULT, - AddRef: proc "c" (this: ^IUnknown) -> ULONG, - Release: proc "c" (this: ^IUnknown) -> ULONG, -} - -@(default_calling_convention="c", link_prefix="Dxc") -foreign dxcompiler { - CreateInstance :: proc (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- - CreateInstance2 :: proc (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- -} - -pCreateInstanceProc :: #type proc "c" (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT -pCreateInstance2Proc :: #type proc "c" (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT - -CreateInstance_ProcName :: "DxcCreateInstance" -CreateInstance2_ProcName :: "DxcCreateInstance2" - -IMalloc :: struct #raw_union { - #subtype iunknown: IUnknown, - using imalloc_vtable: ^IMalloc_VTable, -} -IMalloc_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Alloc: proc "c" (this: ^IMalloc, cb: SIZE_T) -> rawptr, - Realloc: proc "c" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr, - Free: proc "c" (this: ^IMalloc, pv: rawptr), - GetSize: proc "c" (this: ^IMalloc, pv: rawptr) -> SIZE_T, - DidAlloc: proc "c" (this: ^IMalloc, pv: rawptr) -> i32, - HeapMinimize: proc "c" (this: ^IMalloc), -} - -ISequentialStream :: struct #raw_union { - #subtype iunknown: IUnknown, - using isequentialstream_vtable: ^ISequentialStream_VTable, -} -ISequentialStream_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Read: proc "c" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT, - Write: proc "c" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT, -} - -STATSTG :: struct { - pwcsName: wstring, - type: u32, - cbSize: u64, - mtime: FILETIME, - ctime: FILETIME, - atime: FILETIME, - grfMode: u32, - grfLocksSupported: u32, - clsid: CLSID, - grfStateBits: u32, - reserved: u32, -} - -IStream :: struct #raw_union { - #subtype isequentialstream: ISequentialStream, - using istream_vtable: ^IStream_VTable, -} -IStream_VTable :: struct { - using isequentialstream_vtable: ISequentialStream_VTable, - Seek: proc "c" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT, - SetSize: proc "c" (this: ^IStream, libNewSize: u64) -> HRESULT, - CopyTo: proc "c" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT, - Commit: proc "c" (this: ^IStream, grfCommitFlags: u32) -> HRESULT, - Revert: proc "c" (this: ^IStream) -> HRESULT, - LockRegion: proc "c" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, - UnlockRegion: proc "c" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, - Stat: proc "c" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT, - Clone: proc "c" (this: ^IStream, ppstm: ^^IStream) -> HRESULT, -} - -IBlob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102" -IBlob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}} -IBlob :: struct #raw_union { - #subtype iunknown: IUnknown, - using id3d10blob_vtable: ^IBlob_VTable, -} -IBlob_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetBufferPointer: proc "c" (this: ^IBlob) -> rawptr, - GetBufferSize: proc "c" (this: ^IBlob) -> SIZE_T, -} - -IBlobEncoding_UUID_STRRING :: "7241D424-2646-4191-97C0-98E96E42FC68" -IBlobEncoding_UUID := &IID{0x7241D424, 0x2646, 0x4191, {0x97, 0xC0, 0x98, 0xE9, 0x6E, 0x42, 0xFC, 0x68}} -IBlobEncoding :: struct #raw_union { - #subtype idxcblob: IBlob, - using idxcblobencoding_vtable: ^IBlobEncoding_VTable, -} -IBlobEncoding_VTable :: struct { - using idxcblob_vtable: IBlob_VTable, - GetEncoding: proc "c" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT, -} - -IBlobUtf16_UUID_STRING :: "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84" -IBlobUtf16_UUID := &IID{0xA3F84EAB, 0x0FAA, 0x497E, {0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84}} -IBlobUtf16 :: struct #raw_union { - #subtype idxcblobencoding: IBlobEncoding, - using idxcblobutf16_vtable : ^IBlobUtf16_VTable, -} -IBlobUtf16_VTable :: struct { - using idxcblobencoding_vtable: IBlobEncoding_VTable, - GetStringPointer: proc "c" (this: ^IBlobUtf16) -> wstring, - GetStringLength: proc "c" (this: ^IBlobUtf16) -> SIZE_T, -} - -IBlobUtf8_UUID_STRING :: "3DA636C9-BA71-4024-A301-30CBF125305B" -IBlobUtf8_UUID := &IID{0x3DA636C9, 0xBA71, 0x4024, {0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B}} -IBlobUtf8 :: struct #raw_union { - #subtype idxcblobencoding: IBlobEncoding, - using idxcblobutf8_vtable : ^IBlobUtf8_VTable, -} -IBlobUtf8_VTable :: struct { - using idxcblobencoding_vtable: IBlobEncoding_VTable, - GetStringPointer: proc "c" (this: ^IBlobUtf8) -> cstring, - GetStringLength: proc "c" (this: ^IBlobUtf8) -> SIZE_T, -} - -IIncludeHandler_UUID_STRING :: "7F61FC7D-950D-467F-B3E3-3C02FB49187C" -IIncludeHandler_UUID := &IID{0x7F61FC7D, 0x950D, 0x467F, {0xB3, 0xE3, 0x3C, 0x02, 0xFB, 0x49, 0x18, 0x7C}} -IIncludeHandler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcincludehandler_vtable: ^IIncludeHandler_VTable, -} -IIncludeHandler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - LoadSource: proc "c" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT, -} - -Define :: struct { - Name: wstring, - Value: wstring, -} - -ICompilerArgs_UUID_STRING :: "73EFFE2A-70DC-45F8-9690-EFF64C02429D" -ICompilerArgs_UUID := &IID{0x73EFFE2A, 0x70DC, 0x45F8, {0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D}} -ICompilerArgs :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompilerargs_vtable: ^ICompilerArgs_VTable, -} -ICompilerArgs_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetArguments: proc "c" (this: ^ICompilerArgs) -> [^]wstring, - GetCount: proc "c" (this: ^ICompilerArgs) -> u32, - AddArguments: proc "c" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT, - AddArgumentsUTF8: proc "c" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT, - AddDefines: proc "c" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT, -} - -ILibrary_UUID_STRING :: "E5204DC7-D18C-4C3C-BDFB-851673980FE7" -ILibrary_UUID := &IID{0xE5204DC7, 0xD18C, 0x4C3C, {0xBD, 0xFB, 0x85, 0x16, 0x73, 0x98, 0x0F, 0xE7}} -ILibrary :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxclibrary_vtable: ^ILibrary_VTable, -} -ILibrary_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - SetMalloc: proc "c" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT, - CreateBlobFromBlob: proc "c" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, - CreateBlobFromFile: proc "c" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingFromPinned: proc "c" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingOnHeapCopy: proc "c" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingOnMalloc: proc "c" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateIncludeHandler: proc "c" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT, - CreateStreamFromBlobReadOnly: proc "c" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, - GetBlobAsUtf8: proc "c" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - GetBlobAsUtf16: proc "c" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, -} - -IOperationResult_UUID_STRING :: "CEDB484A-D4E9-445A-B991-CA21CA157DC2" -IOperationResult_UUID := &IID{0xCEDB484A, 0xD4E9, 0x445A, {0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2}} -IOperationResult :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoperationresult_vtable: ^IOperationResult_VTable, -} -IOperationResult_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetStatus: proc "c" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT, - GetResult: proc "c" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT, - GetErrorBuffer: proc "c" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT, -} - -ICompiler_UUID_STRING :: "8C210BF3-011F-4422-8D70-6F9ACB8DB617" -ICompiler_UUID := &IID{0x8C210BF3, 0x011F, 0x4422, {0x8D, 0x70, 0x6F, 0x9A, 0xCB, 0x8D, 0xB6, 0x17}} -ICompiler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompiler_vtable: ^ICompiler_VTable, -} -ICompiler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Compile: proc "c" ( - this: ^ICompiler, - pSource: ^Buffer, - pSourceName: wstring, - pEntryPoint: wstring, - pTargetProfile: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult) -> HRESULT, - Preprocess: proc "c" ( - this: ^ICompiler, - pSource: ^Buffer, - pSourceName: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult) -> HRESULT, - Disassemble: proc "c" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT, -} - -ICompiler2_UUID_STRING :: "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37" -ICompiler2_UUID := &IID{0xA005A9D9, 0xB8BB, 0x4594, {0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37}} -ICompiler2 :: struct #raw_union { - #subtype icompiler: ICompiler, - using idxccompiler2_vtable: ^ICompiler2_VTable, -} -ICompiler2_VTable :: struct { - using idxccompiler_vtable: ^ICompiler_VTable, - CompileWithDebug: proc "c" ( - this: ^ICompiler2, - pSource: ^Buffer, - pSourceName: wstring, - pEntryPoint: wstring, - pTargetProfile: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult, - ppDebugBlobName: ^wstring, - ppDebugBlob: ^^IBlob) -> HRESULT, -} - -ILinker_UUID_STRING :: "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6" -ILinker_UUID := &IID{0xF1B5BE2A, 0x62DD, 0x4327, {0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6}} -ILinker :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxclinker_vtable: ^ILinker_VTable, -} -ILinker_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - RegisterLibrary: proc "c" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT, - Link: proc "c" ( - this: ^ILinker, - pEntryName: wstring, - pTargetProfile: wstring, - pLibNames: [^]wstring, - libCount: u32, - pArguments: [^]wstring, - argCount: u32, - ppResult: ^^IOperationResult) -> HRESULT, -} - -Buffer :: struct { - Ptr: rawptr, - Size: SIZE_T, - Encoding: u32, -} - -IUtils_UUID_STRING :: "4605C4CB-2019-492A-ADA4-65F20BB7D67F" -IUtils_UUID := &IID{0x4605C4CB, 0x2019, 0x492A, {0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F}} -IUtils :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcutils_vtable: ^IUtils_VTable, -} -IUtils_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - CreateBlobFromBlob: proc "c" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, - CreateBlobFromPinned: proc "c" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - MoveToBlob: proc "c" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlob: proc "c" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - LoadFile: proc "c" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateReadOnlyStreamFromBlob: proc "c" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, - CreateDefaultIncludeHandler: proc "c" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT, - GetBlobAsUtf8: proc "c" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT, - GetBlobAsUtf16: proc "c" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT, - GetDxilContainerPart: proc "c" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT, - CreateReflection: proc "c" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT, - BuildArguments: proc "c" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT, - GetPDBContents: proc "c" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT, -} - -DXC_OUT_KIND :: enum u32 { - NONE = 0, - OBJECT = 1, - ERRORS = 2, - PDB = 3, - SHADER_HASH = 4, - DISASSEMBLY = 5, - HLSL = 6, - TEXT = 7, - REFLECTION = 8, - ROOT_SIGNATURE = 9, - EXTRA_OUTPUTS = 10, - FORCE_DWORD = 0xFFFFFFFF, -} - -IResult_UUID_STRING :: "58346CDA-DDE7-4497-9461-6F87AF5E0659" -IResult_UUID := &IID{0x58346CDA, 0xDDE7, 0x4497, {0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59}} -IResult :: struct #raw_union { - #subtype idxcoperationresult: IOperationResult, - using idxcresult_vtable: ^IResult_VTable, -} -IResult_VTable :: struct { - using idxcoperationresult_vtable: IOperationResult_VTable, - HasOutput: proc "c" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL, - GetOutput: proc "c" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT, - GetNumOutputs: proc "c" (this: ^IResult) -> u32, - GetOutputByIndex: proc "c" (this: ^IResult, Index: u32) -> DXC_OUT_KIND, - PrimaryOutput: proc "c" (this: ^IResult) -> DXC_OUT_KIND, -} - -IExtraOutputs_UUID_STRING :: "319B37A2-A5C2-494A-A5DE-4801B2FAF989" -IExtraOutputs_UUID := &IID{0x319B37A2, 0xA5C2, 0x494A, {0xA5, 0xDE, 0x48, 0x01, 0xB2, 0xFA, 0xF9, 0x89}} -IExtraOutputs :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcextraoutputs_vtable: ^IExtraOutputs_VTable, -} -IExtraOutputs_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetOutputCount: proc "c" (this: ^IExtraOutputs) -> u32, - GetOutput: proc "c" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT, -} - -ICompiler3_UUID_STRING :: "228B4687-5A6A-4730-900C-9702B2203F54" -ICompiler3_UUID := &IID{0x228B4687, 0x5A6A, 0x4730, {0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54}} -ICompiler3 :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompiler3_vtable: ^ICompiler3_VTable, -} -ICompiler3_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Compile: proc "c" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT, - Disassemble: proc "c" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT, -} - -IValidator_UUID_STRING :: "A6E82BD2-1FD7-4826-9811-2857E797F49A" -IValidator_UUID := &IID{0xA6E82BD2, 0x1FD7, 0x4826, {0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A}} -IValidator :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcvalidator_vtable: ^IValidator_VTable, -} -IValidator_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Validate: proc "c" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT, -} - -IValidator2_UUID_STRING :: "458E1FD1-B1B2-4750-A6E1-9C10F03BED92" -IValidator2_UUID := &IID{0x458E1FD1, 0xB1B2, 0x4750, {0xA6, 0xE1, 0x9C, 0x10, 0xF0, 0x3B, 0xED, 0x92}} -IValidator2 :: struct #raw_union { - #subtype idxcvalidator: IValidator, - using idxcvalidator2_vtable: ^IValidator2_VTable, -} -IValidator2_VTable :: struct { - using idxcvalidator_vtable: IValidator_VTable, - ValidateWithDebug: proc "c" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT, -} - -IContainerBuilder_UUID_STRING :: "334B1F50-2292-4B35-99A1-25588D8C17FE" -IContainerBuilder_UUID := &IID{0x334B1F50, 0x2292, 0x4B35, {0x99, 0xA1, 0x25, 0x58, 0x8D, 0x8C, 0x17, 0xFE}} -IContainerBuilder :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccontainerbuilder_vtable: ^IContainerBuilder_VTable, -} -IContainerBuilder_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "c" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT, - AddPart: proc "c" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT, - RemovePart: proc "c" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT, - SerializeContainer: proc "c" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT, -} - -IAssembler_UUID_STRING :: "091F7A26-1C1F-4948-904B-E6E3A8A771D5" -IAssembler_UUID := &IID{0x091F7A26, 0x1C1F, 0x4948, {0x90, 0x4B, 0xE6, 0xE3, 0xA8, 0xA7, 0x71, 0xD5}} -IAssembler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcassembler_vtable: ^IAssembler_VTable, -} -IAssembler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - AssembleToContainer: proc "c" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT, -} - -IContainerReflection_UUID_STRING :: "D2C21B26-8350-4BDC-976A-331CE6F4C54C" -IContainerReflection_UUID := &IID{0xD2C21B26, 0x8350, 0x4BDC, {0x97, 0x6A, 0x33, 0x1C, 0xE6, 0xF4, 0xC5, 0x4C}} -IContainerReflection :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccontainerreflection_vtable: ^IContainerReflection_VTable, -} -IContainerReflection_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "c" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT, - GetPartCount: proc "c" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT, - GetPartKind: proc "c" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT, - GetPartContent: proc "c" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT, - FindFirstPartKind: proc "c" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT, - GetPartReflection: proc "c" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT, -} - -IOptimizerPass_UUID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" -IOptimizerPass_UUID := &IID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} -IOptimizerPass :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoptimizerpass_vtable: ^IOptimizerPass_VTable, -} -IOptimizerPass_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetOptionName: proc "c" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, - GetDescription: proc "c" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, - GetOptionArgCount: proc "c" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT, - GetOptionArgName: proc "c" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, - GetOptionArgDescription: proc "c" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, -} - -IOptimizer_UUID_STRING :: "25740E2E-9CBA-401B-9119-4FB42F39F270" -IOptimizer_UUID := &IID{0x25740E2E, 0x9CBA, 0x401B, {0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70}} -IOptimizer :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoptimizer_vtable: ^IOptimizer_VTable, -} -IOptimizer_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetAvailablePassCount: proc "c" (this: ^IOptimizer, pCount: ^u32) -> HRESULT, - GetAvailablePass: proc "c" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT, - RunOptimizer: proc "c" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT, -} - -VersionInfoFlags :: enum u32 { - None = 0, - Debug = 1, - Internal = 2, -} - -IVersionInfo_UUID_STRING :: "B04F5B50-2059-4F12-A8FF-A1E0CDE1CC7E" -IVersionInfo_UUID := &IID{0xB04F5B50, 0x2059, 0x4F12, {0xA8, 0xFF, 0xA1, 0xE0, 0xCD, 0xE1, 0xCC, 0x7E}} -IVersionInfo :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcversioninfo_vtable: ^IVersionInfo_VTable, -} -IVersionInfo_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetVersion: proc "c" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT, - GetFlags: proc "c" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT, -} - -IVersionInfo2_UUID_STRING :: "FB6904C4-42F0-4B62-9C46-983AF7DA7C83" -IVersionInfo2_UUID := &IID{0xFB6904C4, 0x42F0, 0x4B62, {0x9C, 0x46, 0x98, 0x3A, 0xF7, 0xDA, 0x7C, 0x83}} -IVersionInfo2 :: struct #raw_union { - #subtype idxcversioninfo: IVersionInfo, - using idxcversioninfo2_vtable: ^IVersionInfo2_VTable, -} -IVersionInfo2_VTable :: struct { - using idxcversioninfo_vtable: IVersionInfo_VTable, - GetCommitInfo: proc "c" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT, -} - -IVersionInfo3_UUID_STRING :: "5E13E843-9D25-473C-9AD2-03B2D0B44B1E" -IVersionInfo3_UUID := &IID{0x5E13E843, 0x9D25, 0x473C, {0x9A, 0xD2, 0x03, 0xB2, 0xD0, 0xB4, 0x4B, 0x1E}} -IVersionInfo3 :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcversioninfo3_vtable: ^IVersionInfo3_VTable, -} -IVersionInfo3_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetCustomVersionString: proc "c" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT, -} - -ArgPair :: struct { - pName: wstring, - pValue: wstring, -} - -IPdbUtils_UUID_STRING :: "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D" -IPdbUtils_UUID := &IID{0xE6C9647E, 0x9D6A, 0x4C3B, {0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D}} -IPdbUtils :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcpdbutils_vtable: ^IPdbUtils_VTable, -} -IPdbUtils_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "c" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT, - GetSourceCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetSource: proc "c" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT, - GetSourceName: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetFlagCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetFlag: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetArgCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetArg: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetArgPairCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetArgPair: proc "c" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT, - GetDefineCount: proc "c" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetDefine: proc "c" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetTargetProfile: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetEntryPoint: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetMainFileName: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetHash: proc "c" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT, - GetName: proc "c" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - IsFullPDB: proc "c" (this: ^IPdbUtils) -> BOOL, - GetFullPDB: proc "c" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT, - GetVersionInfo: proc "c" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT, - SetCompiler: proc "c" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT, - CompileForFullPDB: proc "c" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT, - OverrideArgs: proc "c" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT, - OverrideRootSignature: proc "c" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT, -} - - -Compiler_CLSID_STRING :: "73E22D93-E6CE-47F3-B5BF-F0664F39C1B0" -Compiler_CLSID := &CLSID{0x73E22D93, 0xE6CE, 0x47F3, {0xB5, 0xBF, 0xF0, 0x66, 0x4F, 0x39, 0xC1, 0xB0}} - -Linker_CLSID_STRING :: "EF6A8087-B0EA-4D56-9E45-D07E1A8B7806" -Linker_CLSID := &CLSID{0xEF6A8087, 0xB0EA, 0x4D56, {0x9E, 0x45, 0xD0, 0x7E, 0x1A, 0x8B, 0x78, 0x6}} - -DiaDataSource_CLSID_STRING :: "CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F" -DiaDataSource_CLSID := &CLSID{0xCD1F6B73, 0x2AB0, 0x484D, {0x8E, 0xDC, 0xEB, 0xE7, 0xA4, 0x3C, 0xA0, 0x9F}} - -CompilerArgs_CLSID_STRING :: "3E56AE82-224D-470F-A1A1-FE3016EE9F9D" -CompilerArgs_CLSID := &CLSID{0x3E56AE82, 0x224D, 0x470F, {0xA1, 0xA1, 0xFE, 0x30, 0x16, 0xEE, 0x9F, 0x9D}} - -Library_CLSID_STRING :: "6245D6AF-66E0-48FD-80B4-4D271796748C" -Library_CLSID := &CLSID{0x6245D6AF, 0x66E0, 0x48FD, {0x80, 0xB4, 0x4D, 0x27, 0x17, 0x96, 0x74, 0x8C}} - -Utils_CLSID_STRING :: Library_CLSID_STRING -Utils_CLSID := Library_CLSID - -Validator_CLSID_STRING :: "8CA3E215-F728-4CF3-8CDD-88AF917587A1" -Validator_CLSID := &CLSID{0x8CA3E215, 0xF728, 0x4CF3, {0x8C, 0xDD, 0x88, 0xAF, 0x91, 0x75, 0x87, 0xA1}} - -Assembler_CLSID_STRING :: "D728DB68-F903-4F80-94CD-DCCF76EC7151" -Assembler_CLSID := &CLSID{0xD728DB68, 0xF903, 0x4F80, {0x94, 0xCD, 0xDC, 0xCF, 0x76, 0xEC, 0x71, 0x51}} - -ContainerReflection_CLSID_STRING :: "b9f54489-55b8-400c-ba3a-1675e4728b91" -ContainerReflection_CLSID := &CLSID{0xB9F54489, 0x55B8, 0x400C, {0xBA, 0x3A, 0x16, 0x75, 0xE4, 0x72, 0x8B, 0x91}} - -Optimizer_CLSID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" -Optimizer_CLSID := &CLSID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} - -ContainerBuilder_CLSID_STRING :: "94134294-411f-4574-b4d0-8741e25240d2" -ContainerBuilder_CLSID := &CLSID{0x94134294, 0x411F, 0x4574, {0xB4, 0xD0, 0x87, 0x41, 0xE2, 0x52, 0x40, 0xD2}} - -PdbUtils_CLSID_STRING :: "54621dfb-f2ce-457e-ae8c-ec355faeec7c" -PdbUtils_CLSID := &CLSID{0x54621DFB, 0xF2CE, 0x457E, {0xAE, 0x8C, 0xEC, 0x35, 0x5F, 0xAE, 0xEC, 0x7C}} - -CP_UTF8 :: 65001 -CP_UTF16 :: 1200 -CP_ACP :: 0 - -make_fourcc :: proc "contextless" (ch0, ch1, ch2, ch3: u32) -> u32 { - return ch0 | (ch1 << 8) | (ch2 << 16) | (ch3 << 24) -} - -PART_PDB :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('B')<<24) -PART_PDB_NAME :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('N')<<24) -PART_PRIVATE_DATA :: u32('P') | (u32('R')<<8) | (u32('I')<<16) | (u32('V')<<24) -PART_ROOT_SIGNATURE :: u32('R') | (u32('T')<<8) | (u32('S')<<16) | (u32('0')<<24) -PART_DXIL :: u32('D') | (u32('X')<<8) | (u32('I')<<16) | (u32('L')<<24) -PART_REFLECTION_DATA :: u32('S') | (u32('T')<<8) | (u32('A')<<16) | (u32('T')<<24) -PART_SHADER_HASH :: u32('H') | (u32('A')<<8) | (u32('S')<<16) | (u32('H')<<24) -PART_INPUT_SIGNATURE :: u32('I') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) -PART_OUTPUT_SIGNATURE :: u32('O') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) -PART_PATCH_CONSTANT_SIGNATURE :: u32('P') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) - -ARG_DEBUG :: "-Zi" -ARG_SKIP_VALIDATION :: "-Vd" -ARG_SKIP_OPTIMIZATIONS :: "-Od" -ARG_PACK_MATRIX_ROW_MAJOR :: "-Zpr" -ARG_PACK_MATRIX_COLUMN_MAJOR :: "-Zpc" -ARG_AVOID_FLOW_CONTROL :: "-Gfa" -ARG_PREFER_FLOW_CONTROL :: "-Gfp" -ARG_ENABLE_STRICTNESS :: "-Ges" -ARG_ENABLE_BACKWARDS_COMPATIBILITY :: "-Gec" -ARG_IEEE_STRICTNESS :: "-Gis" -ARG_OPTIMIZATION_LEVEL0 :: "-O0" -ARG_OPTIMIZATION_LEVEL1 :: "-O1" -ARG_OPTIMIZATION_LEVEL2 :: "-O2" -ARG_OPTIMIZATION_LEVEL3 :: "-O3" -ARG_WARNINGS_ARE_ERRORS :: "-WX" -ARG_RESOURCES_MAY_ALIAS :: "-res_may_alias" -ARG_ALL_RESOURCES_BOUND :: "-all_resources_bound" -ARG_DEBUG_NAME_FOR_SOURCE :: "-Zss" -ARG_DEBUG_NAME_FOR_BINARY :: "-Zsb" - -EXTRA_OUTPUT_NAME_STDOUT :: "*stdout*" -EXTRA_OUTPUT_NAME_STDERR :: "*stderr*" diff --git a/vendor/directx/dxc/dxcapi_windows.odin b/vendor/directx/dxc/dxcapi_windows.odin deleted file mode 100644 index 217fd1f21..000000000 --- a/vendor/directx/dxc/dxcapi_windows.odin +++ /dev/null @@ -1,604 +0,0 @@ -//+build windows -package directx_dxc -import win32 "core:sys/windows" -import dxgi "vendor:directx/dxgi" -foreign import "dxcompiler.lib" - -BOOL :: dxgi.BOOL -SIZE_T :: dxgi.SIZE_T -ULONG :: dxgi.ULONG -CLSID :: dxgi.GUID -IID :: dxgi.IID -HRESULT :: dxgi.HRESULT -IUnknown :: dxgi.IUnknown -IUnknown_VTable :: dxgi.IUnknown_VTable -wstring :: win32.wstring -FILETIME :: win32.FILETIME -BSTR :: wstring - -@(default_calling_convention="c", link_prefix="Dxc") -foreign dxcompiler { - CreateInstance :: proc (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- - CreateInstance2 :: proc (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT --- -} - -pCreateInstanceProc :: #type proc "c" (rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT -pCreateInstance2Proc :: #type proc "c" (pMalloc: ^IMalloc, rclsid: ^CLSID, riid: ^IID, ppv: rawptr) -> HRESULT - -CreateInstance_ProcName :: "DxcCreateInstance" -CreateInstance2_ProcName :: "DxcCreateInstance2" - -IMalloc :: struct #raw_union { - #subtype iunknown: IUnknown, - using imalloc_vtable: ^IMalloc_VTable, -} -IMalloc_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Alloc: proc "stdcall" (this: ^IMalloc, cb: SIZE_T) -> rawptr, - Realloc: proc "stdcall" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr, - Free: proc "stdcall" (this: ^IMalloc, pv: rawptr), - GetSize: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> SIZE_T, - DidAlloc: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> i32, - HeapMinimize: proc "stdcall" (this: ^IMalloc), -} - -ISequentialStream :: struct #raw_union { - #subtype iunknown: IUnknown, - using isequentialstream_vtable: ^ISequentialStream_VTable, -} -ISequentialStream_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Read: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT, - Write: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT, -} - -STATSTG :: struct { - pwcsName: wstring, - type: u32, - cbSize: u64, - mtime: FILETIME, - ctime: FILETIME, - atime: FILETIME, - grfMode: u32, - grfLocksSupported: u32, - clsid: CLSID, - grfStateBits: u32, - reserved: u32, -} - -IStream :: struct #raw_union { - #subtype isequentialstream: ISequentialStream, - using istream_vtable: ^IStream_VTable, -} -IStream_VTable :: struct { - using isequentialstream_vtable: ISequentialStream_VTable, - Seek: proc "stdcall" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT, - SetSize: proc "stdcall" (this: ^IStream, libNewSize: u64) -> HRESULT, - CopyTo: proc "stdcall" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT, - Commit: proc "stdcall" (this: ^IStream, grfCommitFlags: u32) -> HRESULT, - Revert: proc "stdcall" (this: ^IStream) -> HRESULT, - LockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, - UnlockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT, - Stat: proc "stdcall" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT, - Clone: proc "stdcall" (this: ^IStream, ppstm: ^^IStream) -> HRESULT, -} - -IBlob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102" -IBlob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}} -IBlob :: struct #raw_union { - #subtype iunknown: IUnknown, - using id3d10blob_vtable: ^IBlob_VTable, -} -IBlob_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetBufferPointer: proc "stdcall" (this: ^IBlob) -> rawptr, - GetBufferSize: proc "stdcall" (this: ^IBlob) -> SIZE_T, -} - -IBlobEncoding_UUID_STRRING :: "7241D424-2646-4191-97C0-98E96E42FC68" -IBlobEncoding_UUID := &IID{0x7241D424, 0x2646, 0x4191, {0x97, 0xC0, 0x98, 0xE9, 0x6E, 0x42, 0xFC, 0x68}} -IBlobEncoding :: struct #raw_union { - #subtype idxcblob: IBlob, - using idxcblobencoding_vtable: ^IBlobEncoding_VTable, -} -IBlobEncoding_VTable :: struct { - using idxcblob_vtable: IBlob_VTable, - GetEncoding: proc "stdcall" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT, -} - -IBlobUtf16_UUID_STRING :: "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84" -IBlobUtf16_UUID := &IID{0xA3F84EAB, 0x0FAA, 0x497E, {0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84}} -IBlobUtf16 :: struct #raw_union { - #subtype idxcblobencoding: IBlobEncoding, - using idxcblobutf16_vtable : ^IBlobUtf16_VTable, -} -IBlobUtf16_VTable :: struct { - using idxcblobencoding_vtable: IBlobEncoding_VTable, - GetStringPointer: proc "stdcall" (this: ^IBlobUtf16) -> wstring, - GetStringLength: proc "stdcall" (this: ^IBlobUtf16) -> SIZE_T, -} - -IBlobUtf8_UUID_STRING :: "3DA636C9-BA71-4024-A301-30CBF125305B" -IBlobUtf8_UUID := &IID{0x3DA636C9, 0xBA71, 0x4024, {0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B}} -IBlobUtf8 :: struct #raw_union { - #subtype idxcblobencoding: IBlobEncoding, - using idxcblobutf8_vtable : ^IBlobUtf8_VTable, -} -IBlobUtf8_VTable :: struct { - using idxcblobencoding_vtable: IBlobEncoding_VTable, - GetStringPointer: proc "stdcall" (this: ^IBlobUtf8) -> cstring, - GetStringLength: proc "stdcall" (this: ^IBlobUtf8) -> SIZE_T, -} - -IIncludeHandler_UUID_STRING :: "7F61FC7D-950D-467F-B3E3-3C02FB49187C" -IIncludeHandler_UUID := &IID{0x7F61FC7D, 0x950D, 0x467F, {0xB3, 0xE3, 0x3C, 0x02, 0xFB, 0x49, 0x18, 0x7C}} -IIncludeHandler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcincludehandler_vtable: ^IIncludeHandler_VTable, -} -IIncludeHandler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - LoadSource: proc "stdcall" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT, -} - -Define :: struct { - Name: wstring, - Value: wstring, -} - -ICompilerArgs_UUID_STRING :: "73EFFE2A-70DC-45F8-9690-EFF64C02429D" -ICompilerArgs_UUID := &IID{0x73EFFE2A, 0x70DC, 0x45F8, {0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D}} -ICompilerArgs :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompilerargs_vtable: ^ICompilerArgs_VTable, -} -ICompilerArgs_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetArguments: proc "stdcall" (this: ^ICompilerArgs) -> [^]wstring, - GetCount: proc "stdcall" (this: ^ICompilerArgs) -> u32, - AddArguments: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT, - AddArgumentsUTF8: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT, - AddDefines: proc "stdcall" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT, -} - -ILibrary_UUID_STRING :: "E5204DC7-D18C-4C3C-BDFB-851673980FE7" -ILibrary_UUID := &IID{0xE5204DC7, 0xD18C, 0x4C3C, {0xBD, 0xFB, 0x85, 0x16, 0x73, 0x98, 0x0F, 0xE7}} -ILibrary :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxclibrary_vtable: ^ILibrary_VTable, -} -ILibrary_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - SetMalloc: proc "stdcall" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT, - CreateBlobFromBlob: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, - CreateBlobFromFile: proc "stdcall" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingFromPinned: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingOnHeapCopy: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlobWithEncodingOnMalloc: proc "stdcall" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateIncludeHandler: proc "stdcall" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT, - CreateStreamFromBlobReadOnly: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, - GetBlobAsUtf8: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - GetBlobAsUtf16: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, -} - -IOperationResult_UUID_STRING :: "CEDB484A-D4E9-445A-B991-CA21CA157DC2" -IOperationResult_UUID := &IID{0xCEDB484A, 0xD4E9, 0x445A, {0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2}} -IOperationResult :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoperationresult_vtable: ^IOperationResult_VTable, -} -IOperationResult_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetStatus: proc "stdcall" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT, - GetResult: proc "stdcall" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT, - GetErrorBuffer: proc "stdcall" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT, -} - -ICompiler_UUID_STRING :: "8C210BF3-011F-4422-8D70-6F9ACB8DB617" -ICompiler_UUID := &IID{0x8C210BF3, 0x011F, 0x4422, {0x8D, 0x70, 0x6F, 0x9A, 0xCB, 0x8D, 0xB6, 0x17}} -ICompiler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompiler_vtable: ^ICompiler_VTable, -} -ICompiler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Compile: proc "stdcall" ( - this: ^ICompiler, - pSource: ^Buffer, - pSourceName: wstring, - pEntryPoint: wstring, - pTargetProfile: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult) -> HRESULT, - Preprocess: proc "stdcall" ( - this: ^ICompiler, - pSource: ^Buffer, - pSourceName: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult) -> HRESULT, - Disassemble: proc "stdcall" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT, -} - -ICompiler2_UUID_STRING :: "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37" -ICompiler2_UUID := &IID{0xA005A9D9, 0xB8BB, 0x4594, {0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37}} -ICompiler2 :: struct #raw_union { - #subtype icompiler: ICompiler, - using idxccompiler2_vtable: ^ICompiler2_VTable, -} -ICompiler2_VTable :: struct { - using idxccompiler_vtable: ^ICompiler_VTable, - CompileWithDebug: proc "stdcall" ( - this: ^ICompiler2, - pSource: ^Buffer, - pSourceName: wstring, - pEntryPoint: wstring, - pTargetProfile: wstring, - pArguments: [^]wstring, - argCount: u32, - pDefines: [^]Define, - defineCount: u32, - pIncludeHandler: ^IIncludeHandler, - ppResult: ^^IOperationResult, - ppDebugBlobName: ^wstring, - ppDebugBlob: ^^IBlob) -> HRESULT, -} - -ILinker_UUID_STRING :: "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6" -ILinker_UUID := &IID{0xF1B5BE2A, 0x62DD, 0x4327, {0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6}} -ILinker :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxclinker_vtable: ^ILinker_VTable, -} -ILinker_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - RegisterLibrary: proc "stdcall" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT, - Link: proc "stdcall" ( - this: ^ILinker, - pEntryName: wstring, - pTargetProfile: wstring, - pLibNames: [^]wstring, - libCount: u32, - pArguments: [^]wstring, - argCount: u32, - ppResult: ^^IOperationResult) -> HRESULT, -} - -Buffer :: struct { - Ptr: rawptr, - Size: SIZE_T, - Encoding: u32, -} - -IUtils_UUID_STRING :: "4605C4CB-2019-492A-ADA4-65F20BB7D67F" -IUtils_UUID := &IID{0x4605C4CB, 0x2019, 0x492A, {0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F}} -IUtils :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcutils_vtable: ^IUtils_VTable, -} -IUtils_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - CreateBlobFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT, - CreateBlobFromPinned: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - MoveToBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - LoadFile: proc "stdcall" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT, - CreateReadOnlyStreamFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT, - CreateDefaultIncludeHandler: proc "stdcall" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT, - GetBlobAsUtf8: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT, - GetBlobAsUtf16: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT, - GetDxilContainerPart: proc "stdcall" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT, - CreateReflection: proc "stdcall" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT, - BuildArguments: proc "stdcall" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT, - GetPDBContents: proc "stdcall" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT, -} - -DXC_OUT_KIND :: enum u32 { - NONE = 0, - OBJECT = 1, - ERRORS = 2, - PDB = 3, - SHADER_HASH = 4, - DISASSEMBLY = 5, - HLSL = 6, - TEXT = 7, - REFLECTION = 8, - ROOT_SIGNATURE = 9, - EXTRA_OUTPUTS = 10, - FORCE_DWORD = 0xFFFFFFFF, -} - -IResult_UUID_STRING :: "58346CDA-DDE7-4497-9461-6F87AF5E0659" -IResult_UUID := &IID{0x58346CDA, 0xDDE7, 0x4497, {0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59}} -IResult :: struct #raw_union { - #subtype idxcoperationresult: IOperationResult, - using idxcresult_vtable: ^IResult_VTable, -} -IResult_VTable :: struct { - using idxcoperationresult_vtable: IOperationResult_VTable, - HasOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL, - GetOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT, - GetNumOutputs: proc "stdcall" (this: ^IResult) -> u32, - GetOutputByIndex: proc "stdcall" (this: ^IResult, Index: u32) -> DXC_OUT_KIND, - PrimaryOutput: proc "stdcall" (this: ^IResult) -> DXC_OUT_KIND, -} - -IExtraOutputs_UUID_STRING :: "319B37A2-A5C2-494A-A5DE-4801B2FAF989" -IExtraOutputs_UUID := &IID{0x319B37A2, 0xA5C2, 0x494A, {0xA5, 0xDE, 0x48, 0x01, 0xB2, 0xFA, 0xF9, 0x89}} -IExtraOutputs :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcextraoutputs_vtable: ^IExtraOutputs_VTable, -} -IExtraOutputs_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetOutputCount: proc "stdcall" (this: ^IExtraOutputs) -> u32, - GetOutput: proc "stdcall" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT, -} - -ICompiler3_UUID_STRING :: "228B4687-5A6A-4730-900C-9702B2203F54" -ICompiler3_UUID := &IID{0x228B4687, 0x5A6A, 0x4730, {0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54}} -ICompiler3 :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccompiler3_vtable: ^ICompiler3_VTable, -} -ICompiler3_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Compile: proc "stdcall" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT, - Disassemble: proc "stdcall" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT, -} - -IValidator_UUID_STRING :: "A6E82BD2-1FD7-4826-9811-2857E797F49A" -IValidator_UUID := &IID{0xA6E82BD2, 0x1FD7, 0x4826, {0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A}} -IValidator :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcvalidator_vtable: ^IValidator_VTable, -} -IValidator_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Validate: proc "stdcall" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT, -} - -IValidator2_UUID_STRING :: "458E1FD1-B1B2-4750-A6E1-9C10F03BED92" -IValidator2_UUID := &IID{0x458E1FD1, 0xB1B2, 0x4750, {0xA6, 0xE1, 0x9C, 0x10, 0xF0, 0x3B, 0xED, 0x92}} -IValidator2 :: struct #raw_union { - #subtype idxcvalidator: IValidator, - using idxcvalidator2_vtable: ^IValidator2_VTable, -} -IValidator2_VTable :: struct { - using idxcvalidator_vtable: IValidator_VTable, - ValidateWithDebug: proc "stdcall" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT, -} - -IContainerBuilder_UUID_STRING :: "334B1F50-2292-4B35-99A1-25588D8C17FE" -IContainerBuilder_UUID := &IID{0x334B1F50, 0x2292, 0x4B35, {0x99, 0xA1, 0x25, 0x58, 0x8D, 0x8C, 0x17, 0xFE}} -IContainerBuilder :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccontainerbuilder_vtable: ^IContainerBuilder_VTable, -} -IContainerBuilder_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "stdcall" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT, - AddPart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT, - RemovePart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT, - SerializeContainer: proc "stdcall" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT, -} - -IAssembler_UUID_STRING :: "091F7A26-1C1F-4948-904B-E6E3A8A771D5" -IAssembler_UUID := &IID{0x091F7A26, 0x1C1F, 0x4948, {0x90, 0x4B, 0xE6, 0xE3, 0xA8, 0xA7, 0x71, 0xD5}} -IAssembler :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcassembler_vtable: ^IAssembler_VTable, -} -IAssembler_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - AssembleToContainer: proc "stdcall" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT, -} - -IContainerReflection_UUID_STRING :: "D2C21B26-8350-4BDC-976A-331CE6F4C54C" -IContainerReflection_UUID := &IID{0xD2C21B26, 0x8350, 0x4BDC, {0x97, 0x6A, 0x33, 0x1C, 0xE6, 0xF4, 0xC5, 0x4C}} -IContainerReflection :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxccontainerreflection_vtable: ^IContainerReflection_VTable, -} -IContainerReflection_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "stdcall" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT, - GetPartCount: proc "stdcall" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT, - GetPartKind: proc "stdcall" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT, - GetPartContent: proc "stdcall" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT, - FindFirstPartKind: proc "stdcall" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT, - GetPartReflection: proc "stdcall" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT, -} - -IOptimizerPass_UUID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" -IOptimizerPass_UUID := &IID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} -IOptimizerPass :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoptimizerpass_vtable: ^IOptimizerPass_VTable, -} -IOptimizerPass_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetOptionName: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, - GetDescription: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT, - GetOptionArgCount: proc "stdcall" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT, - GetOptionArgName: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, - GetOptionArgDescription: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT, -} - -IOptimizer_UUID_STRING :: "25740E2E-9CBA-401B-9119-4FB42F39F270" -IOptimizer_UUID := &IID{0x25740E2E, 0x9CBA, 0x401B, {0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70}} -IOptimizer :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcoptimizer_vtable: ^IOptimizer_VTable, -} -IOptimizer_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetAvailablePassCount: proc "stdcall" (this: ^IOptimizer, pCount: ^u32) -> HRESULT, - GetAvailablePass: proc "stdcall" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT, - RunOptimizer: proc "stdcall" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT, -} - -VersionInfoFlags :: enum u32 { - None = 0, - Debug = 1, - Internal = 2, -} - -IVersionInfo_UUID_STRING :: "B04F5B50-2059-4F12-A8FF-A1E0CDE1CC7E" -IVersionInfo_UUID := &IID{0xB04F5B50, 0x2059, 0x4F12, {0xA8, 0xFF, 0xA1, 0xE0, 0xCD, 0xE1, 0xCC, 0x7E}} -IVersionInfo :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcversioninfo_vtable: ^IVersionInfo_VTable, -} -IVersionInfo_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetVersion: proc "stdcall" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT, - GetFlags: proc "stdcall" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT, -} - -IVersionInfo2_UUID_STRING :: "FB6904C4-42F0-4B62-9C46-983AF7DA7C83" -IVersionInfo2_UUID := &IID{0xFB6904C4, 0x42F0, 0x4B62, {0x9C, 0x46, 0x98, 0x3A, 0xF7, 0xDA, 0x7C, 0x83}} -IVersionInfo2 :: struct #raw_union { - #subtype idxcversioninfo: IVersionInfo, - using idxcversioninfo2_vtable: ^IVersionInfo2_VTable, -} -IVersionInfo2_VTable :: struct { - using idxcversioninfo_vtable: IVersionInfo_VTable, - GetCommitInfo: proc "stdcall" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT, -} - -IVersionInfo3_UUID_STRING :: "5E13E843-9D25-473C-9AD2-03B2D0B44B1E" -IVersionInfo3_UUID := &IID{0x5E13E843, 0x9D25, 0x473C, {0x9A, 0xD2, 0x03, 0xB2, 0xD0, 0xB4, 0x4B, 0x1E}} -IVersionInfo3 :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcversioninfo3_vtable: ^IVersionInfo3_VTable, -} -IVersionInfo3_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - GetCustomVersionString: proc "stdcall" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT, -} - -ArgPair :: struct { - pName: wstring, - pValue: wstring, -} - -IPdbUtils_UUID_STRING :: "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D" -IPdbUtils_UUID := &IID{0xE6C9647E, 0x9D6A, 0x4C3B, {0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D}} -IPdbUtils :: struct #raw_union { - #subtype iunknown: IUnknown, - using idxcpdbutils_vtable: ^IPdbUtils_VTable, -} -IPdbUtils_VTable :: struct { - using iunknown_vtable: IUnknown_VTable, - Load: proc "stdcall" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT, - GetSourceCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetSource: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT, - GetSourceName: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetFlagCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetFlag: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetArgCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetArg: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetArgPairCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetArgPair: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT, - GetDefineCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT, - GetDefine: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT, - GetTargetProfile: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetEntryPoint: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetMainFileName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - GetHash: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT, - GetName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT, - IsFullPDB: proc "stdcall" (this: ^IPdbUtils) -> BOOL, - GetFullPDB: proc "stdcall" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT, - GetVersionInfo: proc "stdcall" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT, - SetCompiler: proc "stdcall" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT, - CompileForFullPDB: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT, - OverrideArgs: proc "stdcall" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT, - OverrideRootSignature: proc "stdcall" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT, -} - - -Compiler_CLSID_STRING :: "73E22D93-E6CE-47F3-B5BF-F0664F39C1B0" -Compiler_CLSID := &CLSID{0x73E22D93, 0xE6CE, 0x47F3, {0xB5, 0xBF, 0xF0, 0x66, 0x4F, 0x39, 0xC1, 0xB0}} - -Linker_CLSID_STRING :: "EF6A8087-B0EA-4D56-9E45-D07E1A8B7806" -Linker_CLSID := &CLSID{0xEF6A8087, 0xB0EA, 0x4D56, {0x9E, 0x45, 0xD0, 0x7E, 0x1A, 0x8B, 0x78, 0x6}} - -DiaDataSource_CLSID_STRING :: "CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F" -DiaDataSource_CLSID := &CLSID{0xCD1F6B73, 0x2AB0, 0x484D, {0x8E, 0xDC, 0xEB, 0xE7, 0xA4, 0x3C, 0xA0, 0x9F}} - -CompilerArgs_CLSID_STRING :: "3E56AE82-224D-470F-A1A1-FE3016EE9F9D" -CompilerArgs_CLSID := &CLSID{0x3E56AE82, 0x224D, 0x470F, {0xA1, 0xA1, 0xFE, 0x30, 0x16, 0xEE, 0x9F, 0x9D}} - -Library_CLSID_STRING :: "6245D6AF-66E0-48FD-80B4-4D271796748C" -Library_CLSID := &CLSID{0x6245D6AF, 0x66E0, 0x48FD, {0x80, 0xB4, 0x4D, 0x27, 0x17, 0x96, 0x74, 0x8C}} - -Utils_CLSID_STRING :: Library_CLSID_STRING -Utils_CLSID := Library_CLSID - -Validator_CLSID_STRING :: "8CA3E215-F728-4CF3-8CDD-88AF917587A1" -Validator_CLSID := &CLSID{0x8CA3E215, 0xF728, 0x4CF3, {0x8C, 0xDD, 0x88, 0xAF, 0x91, 0x75, 0x87, 0xA1}} - -Assembler_CLSID_STRING :: "D728DB68-F903-4F80-94CD-DCCF76EC7151" -Assembler_CLSID := &CLSID{0xD728DB68, 0xF903, 0x4F80, {0x94, 0xCD, 0xDC, 0xCF, 0x76, 0xEC, 0x71, 0x51}} - -ContainerReflection_CLSID_STRING :: "b9f54489-55b8-400c-ba3a-1675e4728b91" -ContainerReflection_CLSID := &CLSID{0xB9F54489, 0x55B8, 0x400C, {0xBA, 0x3A, 0x16, 0x75, 0xE4, 0x72, 0x8B, 0x91}} - -Optimizer_CLSID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C" -Optimizer_CLSID := &CLSID{0xAE2CD79F, 0xCC22, 0x453F, {0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C}} - -ContainerBuilder_CLSID_STRING :: "94134294-411f-4574-b4d0-8741e25240d2" -ContainerBuilder_CLSID := &CLSID{0x94134294, 0x411F, 0x4574, {0xB4, 0xD0, 0x87, 0x41, 0xE2, 0x52, 0x40, 0xD2}} - -PdbUtils_CLSID_STRING :: "54621dfb-f2ce-457e-ae8c-ec355faeec7c" -PdbUtils_CLSID := &CLSID{0x54621DFB, 0xF2CE, 0x457E, {0xAE, 0x8C, 0xEC, 0x35, 0x5F, 0xAE, 0xEC, 0x7C}} - -CP_UTF8 :: 65001 -CP_UTF16 :: 1200 -CP_ACP :: 0 - -make_fourcc :: proc "contextless" (ch0, ch1, ch2, ch3: u32) -> u32 { - return ch0 | (ch1 << 8) | (ch2 << 16) | (ch3 << 24) -} - -PART_PDB :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('B')<<24) -PART_PDB_NAME :: u32('I') | (u32('L')<<8) | (u32('D')<<16) | (u32('N')<<24) -PART_PRIVATE_DATA :: u32('P') | (u32('R')<<8) | (u32('I')<<16) | (u32('V')<<24) -PART_ROOT_SIGNATURE :: u32('R') | (u32('T')<<8) | (u32('S')<<16) | (u32('0')<<24) -PART_DXIL :: u32('D') | (u32('X')<<8) | (u32('I')<<16) | (u32('L')<<24) -PART_REFLECTION_DATA :: u32('S') | (u32('T')<<8) | (u32('A')<<16) | (u32('T')<<24) -PART_SHADER_HASH :: u32('H') | (u32('A')<<8) | (u32('S')<<16) | (u32('H')<<24) -PART_INPUT_SIGNATURE :: u32('I') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) -PART_OUTPUT_SIGNATURE :: u32('O') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) -PART_PATCH_CONSTANT_SIGNATURE :: u32('P') | (u32('S')<<8) | (u32('G')<<16) | (u32('1')<<24) - -ARG_DEBUG :: "-Zi" -ARG_SKIP_VALIDATION :: "-Vd" -ARG_SKIP_OPTIMIZATIONS :: "-Od" -ARG_PACK_MATRIX_ROW_MAJOR :: "-Zpr" -ARG_PACK_MATRIX_COLUMN_MAJOR :: "-Zpc" -ARG_AVOID_FLOW_CONTROL :: "-Gfa" -ARG_PREFER_FLOW_CONTROL :: "-Gfp" -ARG_ENABLE_STRICTNESS :: "-Ges" -ARG_ENABLE_BACKWARDS_COMPATIBILITY :: "-Gec" -ARG_IEEE_STRICTNESS :: "-Gis" -ARG_OPTIMIZATION_LEVEL0 :: "-O0" -ARG_OPTIMIZATION_LEVEL1 :: "-O1" -ARG_OPTIMIZATION_LEVEL2 :: "-O2" -ARG_OPTIMIZATION_LEVEL3 :: "-O3" -ARG_WARNINGS_ARE_ERRORS :: "-WX" -ARG_RESOURCES_MAY_ALIAS :: "-res_may_alias" -ARG_ALL_RESOURCES_BOUND :: "-all_resources_bound" -ARG_DEBUG_NAME_FOR_SOURCE :: "-Zss" -ARG_DEBUG_NAME_FOR_BINARY :: "-Zsb" - -EXTRA_OUTPUT_NAME_STDOUT :: "*stdout*" -EXTRA_OUTPUT_NAME_STDERR :: "*stderr*" diff --git a/vendor/directx/dxc/dxcdef_unix.odin b/vendor/directx/dxc/dxcdef_unix.odin new file mode 100644 index 000000000..649bb8a13 --- /dev/null +++ b/vendor/directx/dxc/dxcdef_unix.odin @@ -0,0 +1,37 @@ +//+build linux, darwin +package directx_dxc +import "core:c" + +FILETIME :: struct { + dwLowDateTime: DWORD, + dwHighDateTime: DWORD, +} + +GUID :: struct { + Data1: DWORD, + Data2: WORD, + Data3: WORD, + Data4: [8]BYTE, +} + +BYTE :: distinct u8 +WORD :: u16 +DWORD :: u32 +BOOL :: distinct b32 +SIZE_T :: uint +ULONG :: c.ulong +CLSID :: GUID +IID :: GUID +LONG :: distinct c.long +HRESULT :: distinct LONG +wstring :: [^]c.wchar_t +BSTR :: wstring + +IUnknown :: struct { + using _iunknown_vtable: ^IUnknown_VTable, +} +IUnknown_VTable :: struct { + QueryInterface: proc "c" (this: ^IUnknown, riid: ^IID, ppvObject: ^rawptr) -> HRESULT, + AddRef: proc "c" (this: ^IUnknown) -> ULONG, + Release: proc "c" (this: ^IUnknown) -> ULONG, +} diff --git a/vendor/directx/dxc/dxcdef_windows.odin b/vendor/directx/dxc/dxcdef_windows.odin new file mode 100644 index 000000000..16e6f6566 --- /dev/null +++ b/vendor/directx/dxc/dxcdef_windows.odin @@ -0,0 +1,16 @@ +//+build windows +package directx_dxc +import win32 "core:sys/windows" +import dxgi "vendor:directx/dxgi" + +BOOL :: dxgi.BOOL +SIZE_T :: dxgi.SIZE_T +ULONG :: dxgi.ULONG +CLSID :: dxgi.GUID +IID :: dxgi.IID +HRESULT :: dxgi.HRESULT +IUnknown :: dxgi.IUnknown +IUnknown_VTable :: dxgi.IUnknown_VTable +wstring :: win32.wstring +FILETIME :: win32.FILETIME +BSTR :: wstring -- cgit v1.2.3 From 3505c1d790ee0f05ed14e6b96121f16e6ffb75f4 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 19 Sep 2023 15:12:44 +0100 Subject: Fix constant literals using the wrong type --- src/llvm_backend_const.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index 01b0528d0..fc7d4e2f7 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -467,7 +467,7 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo } if (value.kind == ExactValue_Invalid) { - return lb_const_nil(m, type); + return lb_const_nil(m, original_type); } if (value.kind == ExactValue_Procedure) { @@ -1052,13 +1052,14 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo i32 index = field_remapping[f->Variable.field_index]; if (elem_type_can_be_constant(f->type)) { if (sel.index.count == 1) { - values[index] = lb_const_value(m, f->type, tav.value, allow_local).value; + values[index] = lb_const_value(m, f->type, tav.value, allow_local).value; visited[index] = true; } else { if (!visited[index]) { - values[index] = lb_const_value(m, f->type, {}, false).value; + values[index] = lb_const_value(m, f->type, {}, false).value; visited[index] = true; } + unsigned idx_list_len = cast(unsigned)sel.index.count-1; unsigned *idx_list = gb_alloc_array(temporary_allocator(), unsigned, idx_list_len); @@ -1171,7 +1172,6 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo } } return lb_addr_load(p, v); - } } else if (is_type_bit_set(type)) { ast_node(cl, CompoundLit, value.value_compound); -- cgit v1.2.3