summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-01-19 11:33:11 -0600
committerDave Parks <davep@lindenlab.com>2023-01-19 11:33:11 -0600
commit8b39e0e1a6787ae374287dc62064af8576149e86 (patch)
tree50d749e24c5aaee988739f33b54a55342567d999 /indra/llrender
parent7bd9d21e19b923096ba2b5ea3cbc8be3e13d7aa0 (diff)
SL-18869 Followup -- leverage "small commands" and time slicing to get rid of frame stalls on main thread without the need for multithreaded GL
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llimagegl.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 7162134c92..db17f812bd 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1404,9 +1404,53 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
stop_glerror();
{
LL_PROFILE_ZONE_NAMED("glTexImage2D");
+ LL_PROFILE_ZONE_NUM(width);
+ LL_PROFILE_ZONE_NUM(height);
free_cur_tex_image();
+#if 0
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, use_scratch ? scratch : pixels);
+#else
+ // break up calls to a manageable size for the GL command buffer
+ {
+ LL_PROFILE_ZONE_NAMED("glTexImage2D alloc");
+ glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, nullptr);
+ }
+
+ U8* src = (U8*)(use_scratch ? scratch : pixels);
+ if (src)
+ {
+ LL_PROFILE_ZONE_NAMED("glTexImage2D copy");
+ U32 components = dataFormatComponents(pixformat);
+ U32 type_width = 0;
+
+ switch (pixtype)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_BYTE:
+ type_width = 1;
+ break;
+ case GL_UNSIGNED_SHORT:
+ case GL_SHORT:
+ type_width = 2;
+ break;
+ case GL_UNSIGNED_INT:
+ case GL_INT:
+ case GL_FLOAT:
+ type_width = 4;
+ break;
+ default:
+ LL_ERRS() << "Unknown type: " << pixtype << LL_ENDL;
+ }
+
+ U32 line_width = width * components * type_width;
+ for (U32 y = 0; y < height; ++y)
+ {
+ glTexSubImage2D(target, miplevel, 0, y, width, 1, pixformat, pixtype, src);
+ src += line_width;
+ }
+ }
+#endif
alloc_tex_image(width, height, pixformat);
}
stop_glerror();