public unsafe IDxcOperationResult Compile(IDxcBlob source, string sourceName, string entryPoint, string targetProfile, string[] arguments, int argumentsCount, DxcDefine[] defines, int defineCount, IDxcIncludeHandler includeHandler) { IntPtr *argumentsPtr = (IntPtr *)0; try { if (arguments != null && argumentsCount > 0) { argumentsPtr = Interop.AllocToPointers(arguments, argumentsCount); } Result hr = Compile(source, sourceName, entryPoint, targetProfile, (IntPtr)argumentsPtr, argumentsCount, defines, defineCount, includeHandler, out IDxcOperationResult result); if (hr.Failure) { result = default; return(default);
public Span <byte> GetObjectBytecode(out IDxcBlobUtf16 outputName) { using (IDxcBlob blob = GetOutput <IDxcBlob>(DxcOutKind.Object, out outputName)) { return(blob.AsByte()); } }
public Span <byte> GetObjectBytecode() { using (IDxcBlob blob = GetOutput(DxcOutKind.Object)) { return(blob.AsByte()); } }
public unsafe IDxcOperationResult Compile(IDxcBlob source, string sourceName, string entryPoint, string targetProfile, string[] arguments, int argumentsCount, DxcDefine[] defines, IDxcIncludeHandler includeHandler) { IntPtr *argumentsPtr = (IntPtr *)0; try { if (arguments != null && argumentsCount > 0) { argumentsPtr = Interop.AllocToPointers(arguments, argumentsCount); } Compile(source, sourceName, entryPoint, targetProfile, (IntPtr)argumentsPtr, argumentsCount, defines, includeHandler, out IDxcOperationResult? result).CheckError(); return(result !); } finally { if (argumentsPtr != null) { Interop.Free(argumentsPtr); } } }
public unsafe IDxcOperationResult?Preprocess(IDxcBlob source, string sourceName, string[] arguments, int argumentsCount, DxcDefine[] defines, IDxcIncludeHandler includeHandler) { IntPtr *argumentsPtr = (IntPtr *)0; try { if (arguments != null && argumentsCount > 0) { argumentsPtr = Interop.AllocToPointers(arguments, argumentsCount); } Result hr = Preprocess(source, sourceName, (IntPtr)argumentsPtr, argumentsCount, defines, includeHandler, out IDxcOperationResult? result); if (hr.Failure) { result = default; return(default);
public static string GetStringFromBlob(IDxcLibrary library, IDxcBlob blob) { unsafe { blob = library.GetBlobAstUf16(blob); return(new string(blob.GetBufferPointer(), 0, (int)(blob.GetBufferSize() / 2))); } }
public unsafe Result CompileWithDebug(IDxcBlob source, string sourceName, string entryPoint, string targetProfile, string[] arguments, int argumentsCount, DxcDefine[] defines, IDxcIncludeHandler includeHandler, out IDxcOperationResult?result, out string?debugBlobName, out IDxcBlob?debugBlob) { IntPtr *argumentsPtr = (IntPtr *)0; try { IntPtr debugBlobNameOut = default; if (arguments != null && argumentsCount > 0) { argumentsPtr = Interop.AllocToPointers(arguments, argumentsCount); } Result hr = CompileWithDebug(source, sourceName, entryPoint, targetProfile, (IntPtr)argumentsPtr, argumentsCount, defines, includeHandler, out result, new IntPtr(&debugBlobNameOut), out debugBlob); if (debugBlobNameOut != IntPtr.Zero) { debugBlobName = Marshal.PtrToStringUni(debugBlobNameOut); } else { debugBlobName = string.Empty; } if (hr.Failure) { result = default; return(hr); } return(hr); } finally { if (argumentsPtr != null) { Interop.Free(argumentsPtr); } } }
public T CreateReflection <T>(IDxcBlob blob) where T : ComObject { DxcBuffer reflectionData = new DxcBuffer { Ptr = blob.GetBufferPointer(), Size = blob.GetBufferSize(), Encoding = Dxc.DXC_CP_ACP }; CreateReflection(ref reflectionData, typeof(T).GUID, out IntPtr nativePtr).CheckError(); return(MarshallingHelpers.FromPointer <T>(nativePtr)); }
public IDxcOperationResult?Preprocess(IDxcBlob source, string sourceName, string[] arguments, DxcDefine[] defines, IDxcIncludeHandler includeHandler) { return(Preprocess( source, sourceName, arguments, arguments?.Length ?? 0, defines, includeHandler)); }
public IDxcOperationResult?Compile(IDxcBlob source, string sourceName, string entryPoint, string targetProfile, string[] arguments, DxcDefine[] defines, IDxcIncludeHandler includeHandler) { return(Compile( source, sourceName, entryPoint, targetProfile, arguments, arguments?.Length ?? 0, defines, includeHandler)); }
public static byte[] GetBytesFromBlob(IDxcBlob blob) { unsafe { byte * pMem = (byte *)blob.GetBufferPointer(); uint size = blob.GetBufferSize(); byte[] result = new byte[size]; fixed(byte *pTarget = result) { for (uint i = 0; i < size; ++i) { pTarget[i] = pMem[i]; } } return(result); } }
public IDxcOperationResult?CompileWithDebug(IDxcBlob source, string sourceName, string entryPoint, string targetProfile, string[] arguments, DxcDefine[] defines, IDxcIncludeHandler includeHandler, out string?debugBlobName, out IDxcBlob?debugBlob) { return(CompileWithDebug( source, sourceName, entryPoint, targetProfile, arguments, arguments?.Length ?? 0, defines, includeHandler, out debugBlobName, out debugBlob)); }
public Result CreateReflection <T>(IDxcBlob blob, out T?reflection) where T : ComObject { DxcBuffer reflectionData = new DxcBuffer { Ptr = blob.GetBufferPointer(), Size = blob.GetBufferSize(), Encoding = Dxc.DXC_CP_ACP }; Result result = CreateReflection(ref reflectionData, typeof(T).GUID, out IntPtr nativePtr); if (result.Failure) { reflection = default; return(result); } reflection = MarshallingHelpers.FromPointer <T>(nativePtr); return(result); }
public IDxcOperationResult CompileWithDebug(IDxcBlob source, string sourceName, string entryPoint, string targetProfile, string[] arguments, int argumentsCount, DxcDefine[] defines, IDxcIncludeHandler includeHandler, out string debugBlobName, out IDxcBlob debugBlob) { return(CompileWithDebug( source, sourceName, entryPoint, targetProfile, arguments, argumentsCount, defines, defines != null ? defines.Length : 0, includeHandler, out debugBlobName, out debugBlob)); }
public IDxcOperationResult Validate(IDxcBlob shader, int flags) { Validate(shader, flags, out IDxcOperationResult result).CheckError(); return(result); }
public IDxcBlobEncoding Disassemble(IDxcBlob source) { Disassemble(source, out IDxcBlobEncoding result).CheckError(); return(result); }
public IDxcBlob CreateBlobFromBlob(IDxcBlob blob, int offset, int length) { CreateBlobFromBlob(blob, offset, length, out IDxcBlob result).CheckError(); return(result); }
public IDxcBlobEncoding GetBlobAsUtf16(IDxcBlob blob) { GetBlobAsUtf16(blob, out IDxcBlobEncoding result).CheckError(); return(result); }
public IStream CreateStreamFromBlobReadOnly(IDxcBlob blob) { CreateStreamFromBlobReadOnly(blob, out IStream result).CheckError(); return(result); }