Bug 1239126. Handle gl_InstanceID attribute with no location. r=jgilbert

This patch avoids a crash when querying program info when gl_InstanceID is used.

ANGLE will return -1 from GetAttribLocation("gl_InstanceID") (this location is
hardcoded in the ANGLE source) but still includes gl_InstanceID in it's attribute list.
This commit is contained in:
Jeff Muizelaar 2016-01-04 15:58:27 -05:00
Родитель ac809b12d2
Коммит 69e504a564
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -172,10 +172,12 @@ QueryProgramInfo(WebGLProgram* prog, gl::GLContext* gl)
// Collect active locations:
GLint loc = gl->fGetAttribLocation(prog->mGLName, mappedName.BeginReading());
if (loc == -1)
MOZ_CRASH("Active attrib has no location.");
info->activeAttribLocs.insert(loc);
if (loc == -1) {
if (mappedName != "gl_InstanceID")
MOZ_CRASH("Active attrib has no location.");
} else {
info->activeAttribLocs.insert(loc);
}
}
// Uniforms