private static ComPtr <IDxcBlob> ThrowHslsCompilationException(IDxcOperationResult *dxcOperationResult) { using ComPtr <IDxcBlobEncoding> dxcBlobEncodingError = default; dxcOperationResult->GetErrorBuffer(dxcBlobEncodingError.GetAddressOf()).Assert(); string message = new((sbyte *)dxcBlobEncodingError.Get()->GetBufferPointer()); throw new HlslCompilationException(message); }
/// <summary>To be documented.</summary> public readonly unsafe int Validate(IDxcBlob *pShader, uint Flags, ref IDxcOperationResult *ppResult) { var @this = (IDxcValidator *)Unsafe.AsPointer(ref Unsafe.AsRef(in this)); int ret = default; fixed(IDxcOperationResult **ppResultPtr = &ppResult) { ret = ((delegate * unmanaged[Cdecl] < IDxcValidator *, IDxcBlob *, uint, IDxcOperationResult **, int >)LpVtbl[3])(@this, pShader, Flags, ppResultPtr); } return(ret); }
/// <summary>To be documented.</summary> public readonly unsafe int AssembleToContainer(IDxcBlob *pShader, ref IDxcOperationResult *ppResult) { var @this = (IDxcAssembler *)Unsafe.AsPointer(ref Unsafe.AsRef(in this)); int ret = default; fixed(IDxcOperationResult **ppResultPtr = &ppResult) { ret = ((delegate * unmanaged[Cdecl] < IDxcAssembler *, IDxcBlob *, IDxcOperationResult **, int >)LpVtbl[3])(@this, pShader, ppResultPtr); } return(ret); }
/// <summary>To be documented.</summary> public readonly unsafe int SerializeContainer(ref IDxcOperationResult *ppResult) { var @this = (IDxcContainerBuilder *)Unsafe.AsPointer(ref Unsafe.AsRef(in this)); int ret = default; fixed(IDxcOperationResult **ppResultPtr = &ppResult) { ret = ((delegate * unmanaged[Cdecl] < IDxcContainerBuilder *, IDxcOperationResult **, int >)LpVtbl[6])(@this, ppResultPtr); } return(ret); }
private static ComPtr <IDxcBlob> ThrowHslsCompilationException(IDxcOperationResult *dxcOperationResult) { using ComPtr <IDxcBlobEncoding> dxcBlobEncodingError = default; dxcOperationResult->GetErrorBuffer(dxcBlobEncodingError.GetAddressOf()).Assert(); string message = new((sbyte *)dxcBlobEncodingError.Get()->GetBufferPointer()); // The error message will be in a format like this: // "hlsl.hlsl:11:20: error: redefinition of 'float1' as different kind of symbol // static const float float1 = asfloat(0xFFC00000); // ^ // note: previous definition is here" // These regex-s try to match the unnecessary headers and remove them, if present. // This doesn't need to be bulletproof, and these regex-s should match all cases anyway. message = Regex.Replace(message, @"^hlsl\.hlsl:\d+:\d+: (\w+:)", static m => m.Groups[1].Value, RegexOptions.Multiline); // Add a trailing '.' if not present if (message is { Length : > 0 } &&