summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-11-13 12:12:49 +0800
committerErik Kundiman <erik@megapahit.org>2024-11-13 12:12:49 +0800
commit4ffc623e0fbb3e8a8559d7d833d70cb759ff8ebc (patch)
treeb699a71b4439219b78055edebe0165cf4f37ff0c /indra/llrender
parent362d0668a5927a34856233266bc6559889a4b6ac (diff)
parentc654dac4b7593355a5754042d0b43e03924b3efb (diff)
Merge remote-tracking branch 'secondlife/release/2024.09-ExtraFPS' into 2024.09-ExtraFPS
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llimagegl.cpp51
-rw-r--r--indra/llrender/llvertexbuffer.cpp6
2 files changed, 27 insertions, 30 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 09a2138b5e..08c05a0771 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -2555,41 +2555,32 @@ bool LLImageGL::scaleDown(S32 desired_discard)
if (gGLManager.mDownScaleMethod == 0)
{ // use an FBO to downscale the texture
- // allocate new texture
- U32 temp_texname = 0;
- generateTextures(1, &temp_texname);
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, temp_texname, true);
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glTexImage2D");
- glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, NULL);
- }
-
- // account for new texture getting created
- alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
-
- // Use render-to-texture to scale down the texture
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glFramebufferTexture2D");
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, mTarget, temp_texname, 0);
- }
-
glViewport(0, 0, desired_width, desired_height);
// draw a full screen triangle
- gGL.getTexUnit(0)->bind(this);
- glDrawArrays(GL_TRIANGLES, 0, 3);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ if (gGL.getTexUnit(0)->bind(this, true, true))
+ {
+ glDrawArrays(GL_TRIANGLES, 0, 3);
- // delete old texture and assign new texture name
- deleteTextures(1, &mTexName);
- mTexName = temp_texname;
+ free_tex_image(mTexName);
+ glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, nullptr);
+ glCopyTexSubImage2D(mTarget, 0, 0, 0, 0, 0, desired_width, desired_height);
+ alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
- if (mHasMipMaps)
- { // generate mipmaps if needed
- LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
- gGL.getTexUnit(0)->bind(this);
- glGenerateMipmap(mTarget);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ mTexOptionsDirty = true;
+
+ if (mHasMipMaps)
+ { // generate mipmaps if needed
+ LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
+ gGL.getTexUnit(0)->bind(this);
+ glGenerateMipmap(mTarget);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ }
+ else
+ {
+ LL_WARNS_ONCE("LLImageGL") << "Failed to bind texture for downscaling." << LL_ENDL;
+ return false;
}
}
else
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 091c43c19c..cc0329c6f8 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -272,11 +272,13 @@ static GLuint gen_buffer()
{
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer");
sIndex = pool_size;
+#if !LL_DARWIN
if (!gGLManager.mIsAMD)
{
glGenBuffers(pool_size, sNamePool);
}
else
+#endif
{ // work around for AMD driver bug
for (U32 i = 0; i < pool_size; ++i)
{
@@ -942,6 +944,10 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
void LLVertexBuffer::initClass(LLWindow* window)
{
llassert(sVBOPool == nullptr);
+
+ LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
+ sVBOPool = new LLAppleVBOPool();
+
//if (gGLManager.mIsApple)
if(0)
{