Shaders: Show errors on file load with name in "".

This commit is contained in:
Brandon Wright 2019-01-27 19:12:42 -06:00
parent 9523f10518
commit 5fc0271330
2 changed files with 8 additions and 5 deletions

View File

@ -364,7 +364,7 @@ bool GLSLShader::load_shader(char *filename)
if (lines.empty())
{
printf("Couldn't read shader file %s\n", temp);
printf("Couldn't read shader file \"%s\"\n", temp);
return false;
}
@ -379,7 +379,7 @@ bool GLSLShader::load_shader(char *filename)
retval = slang_compile(lines, "vertex");
if (retval < 0)
{
printf("Vertex shader in %s failed to compile.\n", p->filename);
printf("Vertex shader in \"%s\" failed to compile.\n", p->filename);
return false;
}
vertex_shader = retval;
@ -387,7 +387,7 @@ bool GLSLShader::load_shader(char *filename)
retval = slang_compile(lines, "fragment");
if (retval < 0)
{
printf ("Fragment shader in %s failed to compile.\n", p->filename);
printf ("Fragment shader in \"%s\" failed to compile.\n", p->filename);
return false;
}
fragment_shader = retval;
@ -401,7 +401,7 @@ bool GLSLShader::load_shader(char *filename)
GL_VERTEX_SHADER,
&vertex_shader) || !vertex_shader)
{
printf("Couldn't compile vertex shader in %s.\n", p->filename);
printf("Couldn't compile vertex shader in \"%s\".\n", p->filename);
return false;
}
@ -411,7 +411,7 @@ bool GLSLShader::load_shader(char *filename)
GL_FRAGMENT_SHADER,
&fragment_shader) || !fragment_shader)
{
printf("Couldn't compile fragment shader in %s.\n", p->filename);
printf("Couldn't compile fragment shader in \"%s\".\n", p->filename);
return false;
}
}

View File

@ -259,7 +259,10 @@ static char *read_file(const char *filename)
file = fopen(filename, "rb");
if (!file)
{
printf ("File not found: \"%s\"\n", filename);
return NULL;
}
fseek(file, 0, SEEK_END);
size = ftell(file);