From 0951ca6bbe07e301b575389412a4dd0d4ca99c87 Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 10 Oct 2016 18:43:24 -0700 Subject: [PATCH] Add check for bad texture resource slot --- libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp index f18962976c..ed0b9607e6 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackendPipeline.cpp @@ -192,6 +192,11 @@ void GLBackend::resetResourceStage() { void GLBackend::do_setResourceTexture(const Batch& batch, size_t paramOffset) { GLuint slot = batch._params[paramOffset + 1]._uint; + if (slot >= (GLuint) MAX_NUM_RESOURCE_TEXTURES) { + // "GLBackend::do_setResourceTexture: Trying to set a resource Texture at slot #" + slot + " which doesn't exist. MaxNumResourceTextures = " + getMaxNumResourceTextures()); + return; + } + TexturePointer resourceTexture = batch._textures.get(batch._params[paramOffset + 0]._uint); if (!resourceTexture) {