Fixed compilation error exception handling
このコミットが含まれているのは:
1 親
9a26c5c4bd
コミット
a028d3d93d
2ファイル変更
+10
-16
検索条件に一致するファイルはありません
@@ -19,11 +19,14 @@ namespace ComputeSharp.Exceptions
|
||||
[Pure]
|
||||
private static string GetExceptionMessage(string error)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append("The Dxc compiler encountered an error while trying to compile the shader.");
|
||||
StringBuilder builder = new(512);
|
||||
|
||||
builder.AppendLine("The Dxc compiler encountered one or more errors while trying to compile the shader:");
|
||||
builder.AppendLine();
|
||||
builder.AppendLine(error.Trim());
|
||||
builder.AppendLine();
|
||||
builder.AppendLine("Make sure to only be using supported features by checking the README file in the ComputeSharp repository: https://github.com/Sergio0694/ComputeSharp.");
|
||||
builder.AppendLine("If you're sure that your C# shader code is valid, please open an issue an include a working repro and the following error message:");
|
||||
builder.AppendLine(error.TrimEnd());
|
||||
builder.Append("If you're sure that your C# shader code is valid, please open an issue an include a working repro and this error message.");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
@@ -114,22 +114,13 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// <returns>This method always throws and never actually returs.</returns>
|
||||
[DoesNotReturn]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private static ComPtr<IDxcBlob> ThrowHslsCompilationException(ComPtr<IDxcOperationResult> dxcOperationResult)
|
||||
private static ComPtr<IDxcBlob> ThrowHslsCompilationException(IDxcOperationResult* dxcOperationResult)
|
||||
{
|
||||
using ComPtr<IDxcBlobEncoding> dxcBlobEncodingError = default;
|
||||
|
||||
dxcOperationResult.Get()->GetErrorBuffer(dxcBlobEncodingError.GetAddressOf()).Assert();
|
||||
dxcOperationResult->GetErrorBuffer(dxcBlobEncodingError.GetAddressOf()).Assert();
|
||||
|
||||
using ComPtr<IDxcBlobUtf16> dxcBlobUtf16Error = default;
|
||||
|
||||
DxcLibrary.Get()->GetBlobAsUtf16(
|
||||
dxcBlobEncodingError.Upcast<IDxcBlobEncoding, IDxcBlob>().Get(),
|
||||
dxcBlobUtf16Error.Upcast<IDxcBlobUtf16, IDxcBlobEncoding>().GetAddressOf()).Assert();
|
||||
|
||||
string message = new string(
|
||||
(char*)dxcBlobUtf16Error.Get()->GetStringPointer(),
|
||||
0,
|
||||
checked((int)dxcBlobUtf16Error.Get()->GetStringLength()));
|
||||
string message = new((sbyte*)dxcBlobEncodingError.Get()->GetBufferPointer());
|
||||
|
||||
throw new HlslCompilationException(message);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする