Skip to content
Snippets Groups Projects
Commit 0ed10de9 authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

Merged MAINT-8197

Account for dummy tex unit and failed allocation

Approved-by: default avatarAndrey Lihatskiy <andreylproductengine@lindenlab.com>
Approved-by: default avatarGraham Madarasz <graham@lindenlab.com>
Approved-by: default avatarSimon Linden <simon@lindenlab.com>
Approved-by: default avatarMaxim Nikolenko <maximnproductengine@lindenlab.com>
parents d251b3ad 2f4931a0
No related branches found
No related tags found
No related merge requests found
...@@ -957,14 +957,21 @@ F32 gpu_benchmark() ...@@ -957,14 +957,21 @@ F32 gpu_benchmark()
~TextureHolder() ~TextureHolder()
{ {
// unbind // unbind
texUnit->unbind(LLTexUnit::TT_TEXTURE); if (texUnit)
{
texUnit->unbind(LLTexUnit::TT_TEXTURE);
}
// ensure that we delete these textures regardless of how we exit // ensure that we delete these textures regardless of how we exit
LLImageGL::deleteTextures(source.size(), &source[0]); 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: private:
...@@ -992,13 +999,27 @@ F32 gpu_benchmark() ...@@ -992,13 +999,27 @@ F32 gpu_benchmark()
LLGLDepthTest depth(GL_FALSE); LLGLDepthTest depth(GL_FALSE);
for (U32 i = 0; i < count; ++i) 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].bindTarget();
dest[i].clear(); dest[i].clear();
dest[i].flush(); 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); LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment