From d48334049aa8d92981178060369eea3739556411 Mon Sep 17 00:00:00 2001 From: Nicolas Guillemot Date: Sat, 10 Sep 2016 18:15:47 -0700 Subject: [PATCH] handle NULL samplers array in glBindSamplers fix based on glBindTextures --- renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp index e1874ecac..2b56dd8fd 100644 --- a/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_sampler_funcs.cpp @@ -177,7 +177,10 @@ bool WrappedOpenGL::Serialise_glBindSamplers(GLuint first, GLsizei count, const for(int32_t i = 0; i < Count; i++) { - SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(SamplerRes(GetCtx(), samplers[i]))); + SERIALISE_ELEMENT(ResourceId, id, + samplers && samplers[i] + ? GetResourceManager()->GetID(SamplerRes(GetCtx(), samplers[i])) + : ResourceId()); if(m_State <= EXECUTING) { @@ -209,8 +212,9 @@ void WrappedOpenGL::glBindSamplers(GLuint first, GLsizei count, const GLuint *sa m_ContextRecord->AddChunk(scope.Get()); for(GLsizei i = 0; i < count; i++) - GetResourceManager()->MarkResourceFrameReferenced(SamplerRes(GetCtx(), samplers[i]), - eFrameRef_Read); + if (samplers != NULL && samplers[i] != 0) + GetResourceManager()->MarkResourceFrameReferenced(SamplerRes(GetCtx(), samplers[i]), + eFrameRef_Read); } }