From 3ea26714fb9bafebd313d6660ba61aa981331e32 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 20 Mar 2017 11:55:48 +0000 Subject: [PATCH] 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. --- renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp index c445b6680..aa832f825 100644 --- a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp @@ -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);