diff --git a/irr/src/COpenGLCoreCacheHandler.h b/irr/src/COpenGLCoreCacheHandler.h index 744511629..bf588aa8a 100644 --- a/irr/src/COpenGLCoreCacheHandler.h +++ b/irr/src/COpenGLCoreCacheHandler.h @@ -100,7 +100,9 @@ class COpenGLCoreCacheHandler GL.Enable(curTextureType); #endif - GL.BindTexture(curTextureType, static_cast(texture)->getOpenGLTextureName()); + auto name = static_cast(texture)->getOpenGLTextureName(); + _IRR_DEBUG_BREAK_IF(name == 0) + GL.BindTexture(curTextureType, name); } else { texture = 0; diff --git a/irr/src/COpenGLCoreRenderTarget.h b/irr/src/COpenGLCoreRenderTarget.h index 50656ce1f..96eacc207 100644 --- a/irr/src/COpenGLCoreRenderTarget.h +++ b/irr/src/COpenGLCoreRenderTarget.h @@ -35,8 +35,14 @@ public: ColorAttachment = Driver->getFeature().ColorAttachment; MultipleRenderTarget = Driver->getFeature().MultipleRenderTarget; - if (ColorAttachment > 0) + if (ColorAttachment > 0) { + TEST_GL_ERROR(Driver); Driver->irrGlGenFramebuffers(1, &BufferID); + if (!BufferID) { + os::Printer::log("COpenGLCoreRenderTarget: framebuffer not created", ELL_ERROR); + return; + } + } AssignedTextures.set_used(static_cast(ColorAttachment)); diff --git a/irr/src/COpenGLCoreTexture.h b/irr/src/COpenGLCoreTexture.h index 63551cc0a..1b02c9234 100644 --- a/irr/src/COpenGLCoreTexture.h +++ b/irr/src/COpenGLCoreTexture.h @@ -99,6 +99,11 @@ public: } GL.GenTextures(1, &TextureName); + TEST_GL_ERROR(Driver); + if (!TextureName) { + os::Printer::log("COpenGLCoreTexture: texture not created", ELL_ERROR); + return; + } const COpenGLCoreTexture *prevTexture = Driver->getCacheHandler()->getTextureCache().get(0); Driver->getCacheHandler()->getTextureCache().set(0, this); @@ -195,6 +200,11 @@ public: #endif GL.GenTextures(1, &TextureName); + TEST_GL_ERROR(Driver); + if (!TextureName) { + os::Printer::log("COpenGLCoreTexture: texture not created", ELL_ERROR); + return; + } const COpenGLCoreTexture *prevTexture = Driver->getCacheHandler()->getTextureCache().get(0); Driver->getCacheHandler()->getTextureCache().set(0, this); diff --git a/irr/src/OpenGL/Driver.cpp b/irr/src/OpenGL/Driver.cpp index 25c9a14f6..2f6a3ebdf 100644 --- a/irr/src/OpenGL/Driver.cpp +++ b/irr/src/OpenGL/Driver.cpp @@ -212,6 +212,7 @@ void COpenGL3DriverBase::initQuadsIndices(u32 max_vertex_count) } QuadIndexVBO.upload(QuadsIndices.data(), QuadsIndices.size() * sizeof(u16), 0, GL_STATIC_DRAW, true); + assert(QuadIndexVBO.exists()); } void COpenGL3DriverBase::initVersion() @@ -626,6 +627,7 @@ void COpenGL3DriverBase::drawBuffers(const scene::IVertexBuffer *vb, const void *vertices = vb->getData(); if (hwvert) { assert(hwvert->IsVertex); + assert(hwvert->Vbo.exists()); GL.BindBuffer(GL_ARRAY_BUFFER, hwvert->Vbo.getName()); vertices = nullptr; } @@ -633,6 +635,7 @@ void COpenGL3DriverBase::drawBuffers(const scene::IVertexBuffer *vb, const void *indexList = ib->getData(); if (hwidx) { assert(!hwidx->IsVertex); + assert(hwidx->Vbo.exists()); GL.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, hwidx->Vbo.getName()); indexList = nullptr; }