Handle glCreateShaderProgramv returning 0 if the call fails

* The majority of GL calls that create objects are pretty failure proof
  since they don't really do anything apart from create/allocate. In the
  case of glCreateShaderProgramv though it requires the call to be valid
  e.g. the type enum to be correct, so it can actually return 0 if that
  happens.
* If we don't check for this then we end up creating an ID and program
  for name 0 which causes all sorts of problems.
This commit is contained in:
baldurk
2017-03-20 11:55:48 +00:00
parent be86d52491
commit 3ea26714fb
@@ -470,6 +470,9 @@ GLuint WrappedOpenGL::glCreateShaderProgramv(GLenum type, GLsizei count, const G
{
GLuint real = m_Real.glCreateShaderProgramv(type, count, strings);
if(real == 0)
return real;
GLResource res = ProgramRes(GetCtx(), real);
ResourceId id = GetResourceManager()->RegisterResource(res);