Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Veldrid.SPIRV/SpirvCompilation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Text;
using System.Text.RegularExpressions;

namespace Veldrid.SPIRV
{
Expand Down Expand Up @@ -333,10 +334,19 @@ internal static unsafe SpirvCompilationResult CompileGlslToSpirv(
try
{
result = VeldridSpirvNative.CompileGlslToSpirv(&info);
if (!result->Succeeded)
if (!result->Succeeded)
{
throw new SpirvCompilationException(
SpirvCompilationException ex = new SpirvCompilationException(
"Compilation failed: " + Util.GetString((byte*)result->GetData(0), result->GetLength(0)));

MatchCollection mc = Regex.Matches(ex.Message, @":\d+:");
if (mc.Count != 0) {
ex.Data.Add("LineNumber", int.Parse(mc[0].Value.Trim(':')));
}
ex.Data.Add("ShaderStage", stage);


throw ex;
}

uint length = result->GetLength(0);
Expand Down