summaryrefslogtreecommitdiff
path: root/indra/llrender/llimagegl.cpp
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2022-02-01 15:49:32 -0700
committerDave Houlton <euclid@lindenlab.com>2022-02-01 15:49:32 -0700
commitfdc4a81b578f26ce573d6b60760c8235312a6372 (patch)
tree0ee6880004038bd6af925b9e8bd0b1d4cd4f4cd3 /indra/llrender/llimagegl.cpp
parent795a349b9f44183970b1e8abc632c4d7f8bbea37 (diff)
Revert "Merged in euclid-16418 (pull request #846)"
This reverts commit 40fe5277e1390c975d9a3184ff8fc46d69dfb450, reversing changes made to af830e5fc5840194be95140f644a27011b9b7e06.
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r--indra/llrender/llimagegl.cpp66
1 files changed, 11 insertions, 55 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 4b4f071171..1e9b9f642e 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1215,8 +1215,9 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
if (pixformat == GL_ALPHA && pixtype == GL_UNSIGNED_BYTE)
{ //GL_ALPHA is deprecated, convert to RGBA
use_scratch = true;
+ scratch = new U32[width * height];
+
U32 pixel_count = (U32)(width * height);
- scratch = new U32[pixel_count];
for (U32 i = 0; i < pixel_count; i++)
{
U8* pix = (U8*)&scratch[i];
@@ -1231,8 +1232,9 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE)
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
use_scratch = true;
+ scratch = new U32[width * height];
+
U32 pixel_count = (U32)(width * height);
- scratch = new U32[pixel_count];
for (U32 i = 0; i < pixel_count; i++)
{
U8 lum = ((U8*)pixels)[i * 2 + 0];
@@ -1250,8 +1252,9 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE)
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGB
use_scratch = true;
+ scratch = new U32[width * height];
+
U32 pixel_count = (U32)(width * height);
- scratch = new U32[pixel_count];
for (U32 i = 0; i < pixel_count; i++)
{
U8 lum = ((U8*)pixels)[i];
@@ -1311,7 +1314,10 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
}
stop_glerror();
- if (scratch) delete[] scratch;
+ if (use_scratch)
+ {
+ delete[] scratch;
+ }
}
//create an empty GL texture: just create a texture name
@@ -1465,49 +1471,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
return createGLTexture(discard_level, rawdata, FALSE, usename);
}
-// Create a new GL name and allocate tex storage (unitialized) for it
-// Used to break resource contention stall in background media tex updates
-void LLImageGL::allocNewTexName()
-{
- LL_PROFILE_ZONE_SCOPED;
- if (on_main_thread()) return; // Should only be called on bg update thread
- if (!mGLTextureCreated) return;
- if (0 != mNewTexName) return; // only 1 rename in flight at a time
-
- generateTextures(1, &mNewTexName); // create new GL name
-
- mHasMipMaps = false; // Media textures aren't mipped
- mMipLevels = 0;
- // Set state to match current
- gGL.getTexUnit(0)->bind(this, false, false, mNewTexName);
- glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_BASE_LEVEL, 0);
- glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAX_LEVEL, mMaxDiscardLevel);
- glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_WIDTH, mWidth);
- glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_HEIGHT, mHeight);
- gGL.getTexUnit(0)->setHasMipMaps(mHasMipMaps);
- gGL.getTexUnit(0)->setTextureAddressMode(mAddressMode);
- gGL.getTexUnit(0)->setTextureFilteringOption(mFilterOption);
-
- setManualImage(mTarget, 0, mFormatInternal, mWidth, mHeight, mFormatPrimary, mFormatType,
- (GLvoid *) nullptr, mAllowCompression);
-
- gGL.getTexUnit(0)->unbind(mBindTarget);
-
- mLastBindTime = sLastFrameTime;
-}
-
-// Delete no-longer-needed GL tex name (on main thread)
-void LLImageGL::swapTexName()
-{
- if (mNewTexName)
- {
- deleteTextures(1, &mTexName);
- mTexName = mNewTexName;
- mNewTexName = 0;
- }
-}
-
-BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 usename /* = 0 */)
+BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
checkActiveThread();
@@ -1751,14 +1715,6 @@ void LLImageGL::destroyGLTexture()
mTexName = 0;
mGLTextureCreated = FALSE ;
}
-
- // clean up any in-flight name change
- if (0 != mNewTexName)
- {
- // Memory is transient, not tracked by sGlobalTextuerMemory
- LLImageGL::deleteTextures(1, &mNewTexName);
- mNewTexName = 0;
- }
}
//force to invalidate the gl texture, most likely a sculpty texture