diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-31 15:19:28 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-31 15:19:28 -0500 |
commit | 29e344bbd0043bb1cd5f1defd6f9a193b0cc728e (patch) | |
tree | 90b87adc2d5e317de99bd0c137fac5af01799a03 /indra/llrender/llcubemaparray.cpp | |
parent | 105f50478c84b0c14243da3d49479c65ec6ee040 (diff) |
SL-18483 Work around for crash on AMD when using glGenerateMipmap on cubemap array.
Diffstat (limited to 'indra/llrender/llcubemaparray.cpp')
-rw-r--r-- | indra/llrender/llcubemaparray.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index a21f7d084e..52118172c0 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -123,16 +123,28 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, BOOL us bind(0); U32 format = components == 4 ? GL_RGBA12 : GL_RGB10; - - glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, format, resolution, resolution, count*6, 0, - GL_RGB, GL_UNSIGNED_BYTE, nullptr); + + U32 mip = 0; + + while (resolution >= 1) + { + glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, mip, format, resolution, resolution, count * 6, 0, + GL_RGBA, GL_UNSIGNED_BYTE, nullptr); + + if (!use_mips) + { + break; + } + resolution /= 2; + ++mip; + } mImage->setAddressMode(LLTexUnit::TAM_CLAMP); if (use_mips) { mImage->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); - glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY); + //glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY); // <=== latest AMD drivers do not appreciate this method of allocating mipmaps } else { |