only include shader name in error if file name not present
This commit is contained in:
parent
9f22c9ca3a
commit
0c9e8ae79a
@ -985,24 +985,59 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
||||
{
|
||||
String gpu_obj_output = Zi;
|
||||
{
|
||||
M_GpuObj *disp_obj = 0;
|
||||
b32 ok = 1;
|
||||
StringList success_gpu_obj_outputs = Zi;
|
||||
StringList error_gpu_obj_outputs = Zi;
|
||||
for (u32 gpu_obj_idx = 0; gpu_obj_idx < M.gpu_objs.count; ++gpu_obj_idx)
|
||||
{
|
||||
M_GpuObj *gpu_obj = &M.gpu_objs.array[gpu_obj_idx];
|
||||
if (!disp_obj || TrimWhitespace(disp_obj->output).len == 0 || gpu_obj->return_code != 0)
|
||||
String output = TrimWhitespace(gpu_obj->output);
|
||||
b32 obj_errored = gpu_obj->return_code != 0;
|
||||
if (obj_errored)
|
||||
{
|
||||
disp_obj = gpu_obj;
|
||||
ok = 0;
|
||||
}
|
||||
}
|
||||
if (disp_obj)
|
||||
if (output.len > 0)
|
||||
{
|
||||
gpu_obj_output = StringF(
|
||||
String msg = output;
|
||||
if (!StringContains(msg, Lit("In file")))
|
||||
{
|
||||
// If error message is missing "In file" then it may have
|
||||
// failed to even find the entry point, meaning we should
|
||||
// include the name of the shader in the error message for
|
||||
// clarification.
|
||||
msg = StringF(
|
||||
perm,
|
||||
"%F\n%F",
|
||||
FmtString(disp_obj->name),
|
||||
FmtString(TrimWhitespace(disp_obj->output))
|
||||
"Error compiling shader \"%F\"\n%F",
|
||||
FmtString(gpu_obj->name),
|
||||
FmtString(output)
|
||||
);
|
||||
}
|
||||
if (obj_errored)
|
||||
{
|
||||
if (error_gpu_obj_outputs.count == 0)
|
||||
{
|
||||
PushStringToList(perm, &error_gpu_obj_outputs, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PushStringToList(perm, &success_gpu_obj_outputs, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
gpu_obj_output = StringFromList(perm, success_gpu_obj_outputs, Lit("\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
gpu_obj_output = StringFromList(perm, error_gpu_obj_outputs, Lit("\n"));
|
||||
if (TrimWhitespace(gpu_obj_output).len == 0)
|
||||
{
|
||||
gpu_obj_output = Lit("Unknown error compiling shaders");
|
||||
}
|
||||
}
|
||||
}
|
||||
String embed_obj_output = Zi;
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user