From 63b36c6f69f8b73528894900005bf9d5314a8c48 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 23 Jan 2018 16:43:11 +0200 Subject: MAINT-8197 Check buffer before using it --- indra/newview/llglsandbox.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llglsandbox.cpp') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 1b6494195b..c7128a55ae 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -1006,7 +1006,13 @@ F32 gpu_benchmark() //make a dummy triangle to draw with LLPointer buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, GL_STATIC_DRAW_ARB); - buff->allocateBuffer(3, 0, true); + + if (!buff->allocateBuffer(3, 0, true)) + { + LL_WARNS() << "Failed to allocate buffer during benchmark." << LL_ENDL; + // abandon the benchmark test + return -1.f; + } LLStrider v; LLStrider tc; -- cgit v1.2.3 From 2f4931a0a6aea6f1a55bd83f79a65e4c2125fdb8 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 23 Jan 2018 21:09:26 +0200 Subject: MAINT-8197 Account for dummy tex unit --- indra/newview/llglsandbox.cpp | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'indra/newview/llglsandbox.cpp') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index c7128a55ae..dc18d6c647 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -957,14 +957,21 @@ F32 gpu_benchmark() ~TextureHolder() { // unbind - texUnit->unbind(LLTexUnit::TT_TEXTURE); + if (texUnit) + { + texUnit->unbind(LLTexUnit::TT_TEXTURE); + } // ensure that we delete these textures regardless of how we exit LLImageGL::deleteTextures(source.size(), &source[0]); } - void bind(U32 index) + bool bind(U32 index) { - texUnit->bindManual(LLTexUnit::TT_TEXTURE, source[index]); + if (texUnit) // should always be there with dummy (-1), but just in case + { + return texUnit->bindManual(LLTexUnit::TT_TEXTURE, source[index]); + } + return false; } private: @@ -992,13 +999,27 @@ F32 gpu_benchmark() LLGLDepthTest depth(GL_FALSE); for (U32 i = 0; i < count; ++i) - { //allocate render targets and textures - dest[i].allocate(res,res,GL_RGBA,false, false, LLTexUnit::TT_TEXTURE, true); + { + //allocate render targets and textures + if (!dest[i].allocate(res, res, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true)) + { + LL_WARNS() << "Failed to allocate render target." << LL_ENDL; + // abandon the benchmark test + delete[] pixels; + return -1.f; + } dest[i].bindTarget(); dest[i].clear(); dest[i].flush(); - texHolder.bind(i); + if (!texHolder.bind(i)) + { + // can use a dummy value mDummyTexUnit = new LLTexUnit(-1); + LL_WARNS() << "Failed to bind tex unit." << LL_ENDL; + // abandon the benchmark test + delete[] pixels; + return -1.f; + } LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels); } -- cgit v1.2.3 From a1934bee39ec4ba951306a262987032897c2860d Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Mon, 30 Apr 2018 20:23:57 +0300 Subject: MAINT-8610 Fixed GPU Benchmark appears to be broken - "Failed to allocate buffer during benchmark" --- indra/newview/llglsandbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llglsandbox.cpp') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index fc93181ef4..4b0b10dd5a 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -1060,7 +1060,7 @@ F32 gpu_benchmark() delete [] pixels; //make a dummy triangle to draw with - LLPointer buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, GL_STATIC_DRAW_ARB); + LLPointer buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, GL_STREAM_DRAW_ARB); if (!buff->allocateBuffer(3, 0, true)) { -- cgit v1.2.3