summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2024-05-07 09:47:37 -0500
committerGitHub <noreply@github.com>2024-05-07 09:47:37 -0500
commit155ddf23363f1d5c534c69f50505faf67e51948f (patch)
tree976912ed4fa3bc2af7b0b68201460f08614748b5 /indra/llrender
parentf79548ec68ebcef8f8f83705b65fd59da43c3e26 (diff)
parentf9473e8afcb624cc1b101195bf15943ec372b56f (diff)
Merge pull request #1421 from secondlife/DRTVWR-600-maint-A
Drtvwr 600 maint a
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llcubemaparray.cpp6
-rw-r--r--indra/llrender/llimagegl.cpp14
-rw-r--r--indra/llrender/llimagegl.h8
-rw-r--r--indra/llrender/llrendertarget.cpp2
4 files changed, 24 insertions, 6 deletions
diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp
index ed0ad07dc0..4f8d4015b6 100644
--- a/indra/llrender/llcubemaparray.cpp
+++ b/indra/llrender/llcubemaparray.cpp
@@ -42,6 +42,8 @@
//#pragma optimize("", off)
+using namespace LLImageGLMemory;
+
// MUST match order of OpenGL face-layers
GLenum LLCubeMapArray::sTargets[6] =
{
@@ -128,6 +130,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
U32 mip = 0;
+ free_cur_tex_image();
+
while (resolution >= 1)
{
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, mip, format, resolution, resolution, count * 6, 0,
@@ -141,6 +145,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
++mip;
}
+ alloc_tex_image(resolution * 6, resolution, format);
+
mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
if (use_mips)
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index ed729f64e3..39345929b3 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -63,7 +63,7 @@ static U64 sTextureBytes = 0;
// track a texture alloc on the currently bound texture.
// asserts that no currently tracked alloc exists
-static void alloc_tex_image(U32 width, U32 height, U32 pixformat)
+void LLImageGLMemory::alloc_tex_image(U32 width, U32 height, U32 pixformat)
{
U32 texUnit = gGL.getCurrentTexUnitIndex();
U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture();
@@ -81,7 +81,7 @@ static void alloc_tex_image(U32 width, U32 height, U32 pixformat)
}
// track texture free on given texName
-static void free_tex_image(U32 texName)
+void LLImageGLMemory::free_tex_image(U32 texName)
{
sTexMemMutex.lock();
auto iter = sTextureAllocs.find(texName);
@@ -98,7 +98,7 @@ static void free_tex_image(U32 texName)
}
// track texture free on given texNames
-static void free_tex_images(U32 count, const U32* texNames)
+void LLImageGLMemory::free_tex_images(U32 count, const U32* texNames)
{
for (int i = 0; i < count; ++i)
{
@@ -107,13 +107,15 @@ static void free_tex_images(U32 count, const U32* texNames)
}
// track texture free on currently bound texture
-static void free_cur_tex_image()
+void LLImageGLMemory::free_cur_tex_image()
{
U32 texUnit = gGL.getCurrentTexUnitIndex();
U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture();
free_tex_image(texName);
}
+using namespace LLImageGLMemory;
+
// static
U64 LLImageGL::getTextureBytesAllocated()
{
@@ -289,6 +291,8 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
case GL_SRGB_ALPHA: return 32;
case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac
case GL_DEPTH_COMPONENT: return 24;
+ case GL_RGB16F: return 48;
+ case GL_RGBA16F: return 64;
default:
LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL;
return 0;
@@ -2432,7 +2436,7 @@ bool LLImageGL::getMask(const LLVector2 &tc)
S32 idx = y*mPickMaskWidth+x;
S32 offset = idx%8;
- res = mPickMask[idx/8] & (1 << offset) ? true : false;
+ res = (mPickMask[idx/8] & (1 << offset)) != 0;
}
return res;
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index 60fa1258b6..18187734f1 100644
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -47,6 +47,14 @@ class LLWindow;
#define BYTES_TO_MEGA_BYTES(x) ((x) >> 20)
#define MEGA_BYTES_TO_BYTES(x) ((x) << 20)
+namespace LLImageGLMemory
+{
+ void alloc_tex_image(U32 width, U32 height, U32 pixformat);
+ void free_tex_image(U32 texName);
+ void free_tex_images(U32 count, const U32* texNames);
+ void free_cur_tex_image();
+}
+
//============================================================================
class LLImageGL : public LLRefCount
{
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 9cd7527d3e..098e23435d 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -545,7 +545,7 @@ void LLRenderTarget::flush()
bool LLRenderTarget::isComplete() const
{
- return (!mTex.empty() || mDepth) ? true : false;
+ return !mTex.empty() || mDepth;
}
void LLRenderTarget::getViewport(S32* viewport)