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 Result Preprocess(IDxcBlob source,
                          string sourceName,
                          string[] arguments,
                          DxcDefine[] defines,
                          IDxcIncludeHandler includeHandler,
                          out IDxcOperationResult?result)
 {
     return(Preprocess(
                source,
                sourceName,
                arguments,
                arguments?.Length ?? 0,
                defines,
                includeHandler,
                out result));
 }
Example #3
0
 public Result Compile(IDxcBlob source,
                       string sourceName,
                       string entryPoint,
                       string targetProfile,
                       string[] arguments,
                       DxcDefine[] defines,
                       IDxcIncludeHandler includeHandler, out IDxcOperationResult?result)
 {
     return(Compile(
                source,
                sourceName,
                entryPoint,
                targetProfile,
                arguments,
                arguments?.Length ?? 0,
                defines,
                includeHandler,
                out result));
 }
Example #4
0
        public unsafe Result Compile(IDxcBlob source,
                                     string sourceName,
                                     string entryPoint,
                                     string targetProfile,
                                     string[] arguments,
                                     int argumentsCount,
                                     DxcDefine[] defines,
                                     IDxcIncludeHandler includeHandler,
                                     out IDxcOperationResult?result)
        {
            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,
                                    includeHandler,
                                    out result);

                if (hr.Failure)
                {
                    result = default;
                    return(hr);
                }

                return(hr);
            }
            finally
            {
                if (argumentsPtr != null)
                {
                    Interop.Free(argumentsPtr);
                }
            }
        }
Example #5
0
        public unsafe Result Link(string entryName, string targetProfile, string[] libNames, string[] arguments, out IDxcOperationResult?result)
        {
            IntPtr *libNamesPtr  = (IntPtr *)0;
            IntPtr *argumentsPtr = (IntPtr *)0;

            try
            {
                if (libNames?.Length > 0)
                {
                    libNamesPtr = Interop.AllocToPointers(libNames, libNames.Length);
                }

                if (arguments?.Length > 0)
                {
                    argumentsPtr = Interop.AllocToPointers(arguments, arguments.Length);
                }

                Result hr = Link(entryName,
                                 targetProfile,
                                 (IntPtr)libNamesPtr, (libNames?.Length) ?? 0,
                                 (IntPtr)argumentsPtr, (arguments?.Length) ?? 0,
                                 out result);

                if (hr.Failure)
                {
                    result = default;
                    return(default);