NULL sets a program to stock.

This commit is contained in:
Themaister 2012-05-06 22:34:57 +02:00
parent 43dbec58a3
commit a5f1634dca

View File

@ -1221,16 +1221,24 @@ bool gl_cg_load_shader(unsigned index, const char *path)
memset(&prg[index], 0, sizeof(prg[index]));
if (load_program(index, path, true))
if (path)
{
set_program_attributes(index);
return true;
if (load_program(index, path, true))
{
set_program_attributes(index);
return true;
}
else
{
// Always make sure we have a valid shader.
memcpy(&prg[index], &prg[0], sizeof(prg[0]));
return false;
}
}
else
{
// Always make sure we have a valid shader.
memcpy(&prg[index], &prg[0], sizeof(prg[0]));
return false;
prg[index] = prg[0];
return true;
}
}