diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llcubemaparray.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 24 | ||||
-rw-r--r-- | indra/llrender/llimagegl.cpp | 44 | ||||
-rw-r--r-- | indra/llrender/llimagegl.h | 9 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 2 |
5 files changed, 52 insertions, 29 deletions
diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index ac48a633c7..7d3a92237b 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -122,7 +122,7 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, BOOL us bind(0); - U32 format = components == 4 ? GL_RGBA12 : GL_RGB16F; + U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F; U32 mip = 0; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index c08c576531..303edddfaf 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -86,12 +86,27 @@ void APIENTRY gl_debug_callback(GLenum source, const GLchar* message, GLvoid* userParam) { - if (severity != GL_DEBUG_SEVERITY_HIGH //&& - //severity != GL_DEBUG_SEVERITY_MEDIUM && - //severity != GL_DEBUG_SEVERITY_LOW + /*if (severity != GL_DEBUG_SEVERITY_HIGH && + severity != GL_DEBUG_SEVERITY_MEDIUM && + severity != GL_DEBUG_SEVERITY_LOW ) { //suppress out-of-spec messages sent by nvidia driver (mostly vertexbuffer hints) return; + }*/ + + // list of messages to suppress + const char* suppress[] = + { + "Buffer detailed info:", + "Program undefined behavior warning: The current GL state uses a sampler (0) that has depth comparisons enabled" + }; + + for (const char* msg : suppress) + { + if (strncmp(msg, message, strlen(msg)) == 0) + { + return; + } } if (severity == GL_DEBUG_SEVERITY_HIGH) @@ -133,7 +148,8 @@ void APIENTRY gl_debug_callback(GLenum source, glGetBufferParameteriv(GL_UNIFORM_BUFFER, GL_BUFFER_SIZE, &ubo_size); glGetBufferParameteriv(GL_UNIFORM_BUFFER, GL_BUFFER_IMMUTABLE_STORAGE, &ubo_immutable); } - //if (severity == GL_DEBUG_SEVERITY_HIGH) + + if (severity == GL_DEBUG_SEVERITY_HIGH) { LL_ERRS() << "Halting on GL Error" << LL_ENDL; } diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 5b0690bc79..3e3a3095e3 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -42,6 +42,8 @@ #include "llwindow.h" #include "llframetimer.h" +extern LL_COMMON_API bool on_main_thread(); + #if !LL_IMAGEGL_THREAD_CHECK #define checkActiveThread() #endif @@ -132,7 +134,8 @@ bool LLImageGL::sCompressTextures = false; std::set<LLImageGL*> LLImageGL::sImageList; -bool LLImageGLThread::sEnabled = false; +bool LLImageGLThread::sEnabledTextures = false; +bool LLImageGLThread::sEnabledMedia = false; //**************************************************************************************************** //The below for texture auditing use only @@ -242,14 +245,16 @@ BOOL is_little_endian() } //static -void LLImageGL::initClass(LLWindow* window, S32 num_catagories, BOOL skip_analyze_alpha /* = false */, bool multi_threaded /* = false */) +void LLImageGL::initClass(LLWindow* window, S32 num_catagories, BOOL skip_analyze_alpha /* = false */, bool thread_texture_loads /* = false */, bool thread_media_updates /* = false */) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; sSkipAnalyzeAlpha = skip_analyze_alpha; - if (multi_threaded) + if (thread_texture_loads || thread_media_updates) { LLImageGLThread::createInstance(window); + LLImageGLThread::sEnabledTextures = thread_texture_loads; + LLImageGLThread::sEnabledMedia = thread_media_updates; } } @@ -260,6 +265,7 @@ void LLImageGL::cleanupClass() LLImageGLThread::deleteSingleton(); } + //static S32 LLImageGL::dataFormatBits(S32 dataformat) { @@ -1125,9 +1131,20 @@ U32 type_width_from_pixtype(U32 pixtype) return type_width; } +bool should_stagger_image_set(bool compressed) +{ +#if LL_DARWIN + return false; +#else + // glTexSubImage2D doesn't work with compressed textures on select tested Nvidia GPUs on Windows 10 -Cosmic,2023-03-08 + // Setting media textures off-thread seems faster when not using sub_image_lines (Nvidia/Windows 10) -Cosmic,2023-03-31 + return !compressed && on_main_thread(); +#endif +} + // Equivalent to calling glSetSubImage2D(target, miplevel, x_offset, y_offset, width, height, pixformat, pixtype, src), assuming the total width of the image is data_width // However, instead there are multiple calls to glSetSubImage2D on smaller slices of the image -void subImageLines(U32 target, S32 miplevel, S32 x_offset, S32 y_offset, S32 width, S32 height, U32 pixformat, U32 pixtype, const U8* src, S32 data_width) +void sub_image_lines(U32 target, S32 miplevel, S32 x_offset, S32 y_offset, S32 width, S32 height, U32 pixformat, U32 pixtype, const U8* src, S32 data_width) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; @@ -1223,11 +1240,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 if (!res) LL_ERRS() << "LLImageGL::setSubImage(): bindTexture failed" << LL_ENDL; stop_glerror(); -#if LL_DARWIN - const bool use_sub_image = false; -#else - const bool use_sub_image = !isCompressed(); -#endif + const bool use_sub_image = should_stagger_image_set(isCompressed()); if (!use_sub_image) { // *TODO: Why does this work here, in setSubImage, but not in @@ -1238,7 +1251,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 } else { - subImageLines(mTarget, 0, x_pos, y_pos, width, height, mFormatPrimary, mFormatType, sub_datap, data_width); + sub_image_lines(mTarget, 0, x_pos, y_pos, width, height, mFormatPrimary, mFormatType, sub_datap, data_width); } gGL.getTexUnit(0)->disable(); stop_glerror(); @@ -1455,13 +1468,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt LL_PROFILE_ZONE_NUM(height); free_cur_tex_image(); -#if LL_DARWIN - const bool use_sub_image = false; -#else - // glTexSubImage2D doesn't work with compressed textures on select tested Nvidia GPUs on Windows 10 -Cosmic,2023-03-08 - // *TODO: Small chance that glCompressedTexImage2D/glCompressedTexSubImage2D may work better here - const bool use_sub_image = !compress; -#endif + const bool use_sub_image = should_stagger_image_set(compress); if (!use_sub_image) { LL_PROFILE_ZONE_NAMED("glTexImage2D alloc + copy"); @@ -1479,7 +1486,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt if (src) { LL_PROFILE_ZONE_NAMED("glTexImage2D copy"); - subImageLines(target, miplevel, 0, 0, width, height, pixformat, pixtype, src, width); + sub_image_lines(target, miplevel, 0, 0, width, height, pixformat, pixtype, src, width); } } alloc_tex_image(width, height, pixformat); @@ -2504,7 +2511,6 @@ LLImageGLThread::LLImageGLThread(LLWindow* window) , mWindow(window) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - sEnabled = true; mFinished = false; mContext = mWindow->createSharedContext(); diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 42f6efef77..87fb9e363e 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -287,7 +287,7 @@ public: #endif public: - static void initClass(LLWindow* window, S32 num_catagories, BOOL skip_analyze_alpha = false, bool multi_threaded = false); + static void initClass(LLWindow* window, S32 num_catagories, BOOL skip_analyze_alpha = false, bool thread_texture_loads = false, bool thread_media_updates = false); static void cleanupClass() ; private: @@ -329,8 +329,10 @@ public: class LLImageGLThread : public LLSimpleton<LLImageGLThread>, LL::ThreadPool { public: - // follows gSavedSettings "RenderGLMultiThreaded" - static bool sEnabled; + // follows gSavedSettings "RenderGLMultiThreadedTextures" + static bool sEnabledTextures; + // follows gSavedSettings "RenderGLMultiThreadedMedia" + static bool sEnabledMedia; LLImageGLThread(LLWindow* window); @@ -349,5 +351,4 @@ private: LLAtomicBool mFinished; }; - #endif // LL_LLIMAGEGL_H diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 6dac614eea..7f507a0b58 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -483,7 +483,7 @@ U32 LLRenderTarget::getNumTextures() const void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options) { - gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index)); + gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index), filter_options == LLTexUnit::TFO_TRILINEAR || filter_options == LLTexUnit::TFO_ANISOTROPIC); bool isSRGB = false; llassert(mInternalFormat.size() > index); |