Skip to content

Commit

Permalink
NULL sets a program to stock.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed May 6, 2012
1 parent 43dbec5 commit a5f1634
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gfx/shader_cg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit a5f1634

Please sign in to comment.