From 67f56bf431b434cca512a1a9fe45e693afcbd96b Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 5 Dec 2019 11:42:43 +0000 Subject: [PATCH] When creating SPIR-V bindpoint mapping ensure we cover all attrib binds --- renderdoc/driver/gl/gl_shader_refl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/renderdoc/driver/gl/gl_shader_refl.cpp b/renderdoc/driver/gl/gl_shader_refl.cpp index 88ef34e1d..01cfd0db0 100644 --- a/renderdoc/driver/gl/gl_shader_refl.cpp +++ b/renderdoc/driver/gl/gl_shader_refl.cpp @@ -2667,6 +2667,19 @@ void EvaluateSPIRVBindpointMapping(GLuint curProg, int shadIdx, const ShaderRefl if(mapping.inputAttributes[i] < 0) mapping.inputAttributes[i] = -1; + // ensure the mapping contains a value for all valid vertex attribs, even if it doesn't use them. + GLint numVAttribBindings = 16; + GL.glGetIntegerv(eGL_MAX_VERTEX_ATTRIBS, &numVAttribBindings); + + // if more vertex attribs exist, resize and set them all to -1 + if(numVAttribBindings > mapping.inputAttributes.count()) + { + size_t prevSize = mapping.inputAttributes.size(); + mapping.inputAttributes.resize(numVAttribBindings); + for(size_t i = prevSize; i < mapping.inputAttributes.size(); i++) + mapping.inputAttributes[i] = -1; + } + #if ENABLED(RDOC_DEVEL) for(size_t i = 1; i < ARRAY_COUNT(dummyReadback); i++) if(dummyReadback[i] != 0x6c7b8a9d)