From d65fb7cec8ce36ce7f6ff082f8d04bdd8bc0208c Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Mon, 25 Nov 2024 20:56:03 -0500 Subject: Drop emissive on old Intel GPUs (#3110) * #3103 Add the ability to disable the emissive buffer for older GPUs with low memory bandwidth. * #3135 Add a "vintage" mode for slower GPUs * #2719 Fix for skies being overbrightened * #2632 Do not apply tonemapping on legacy skies --- indra/llrender/llglslshader.cpp | 17 +++++++++++++++++ indra/llrender/llglslshader.h | 2 ++ indra/llrender/llimagegl.cpp | 5 +++-- indra/llrender/llshadermgr.cpp | 14 +++++++++++++- indra/llrender/llshadermgr.h | 1 + 5 files changed, 36 insertions(+), 3 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 45bb24a5b7..b3f32fdc83 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1866,6 +1866,23 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf } } +void LLGLSLShader::uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + const auto& iter = mValue.find(location); + LLVector4 vec(x, y, z, w); + if (iter == mValue.end() || shouldChange(iter->second, vec)) + { + glUniform4f(location, x, y, z, w); + mValue[location] = vec; + } + } +} + void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 2d669c70a9..58c456f134 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -52,6 +52,7 @@ public: bool hasAmbientOcclusion = false; bool hasSrgb = false; bool isDeferred = false; + bool hasFullGBuffer = false; bool hasScreenSpaceReflections = false; bool hasAlphaMask = false; bool hasReflectionProbes = false; @@ -221,6 +222,7 @@ public: void uniform1f(const LLStaticHashedString& uniform, GLfloat v); void uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y); void uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z); + void uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w); void uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); void uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 9df0fef5d1..84c61c790f 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -259,8 +259,8 @@ void LLImageGL::initClass(LLWindow* window, S32 num_catagories, bool skip_analyz if (thread_texture_loads || thread_media_updates) { LLImageGLThread::createInstance(window); - LLImageGLThread::sEnabledTextures = thread_texture_loads; - LLImageGLThread::sEnabledMedia = thread_media_updates; + LLImageGLThread::sEnabledTextures = gGLManager.mGLVersion > 3.95f ? thread_texture_loads : false; + LLImageGLThread::sEnabledMedia = gGLManager.mGLVersion > 3.95f ? thread_media_updates : false; } } @@ -332,6 +332,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) case GL_RGB8: return 24; case GL_RGBA: return 32; case GL_RGBA8: return 32; + case GL_RGB10_A2: return 32; 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; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index e02dd4771e..47f1032c34 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -223,6 +223,14 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } } + if (features->hasFullGBuffer) + { + if (!shader->attachFragmentObject("deferred/gbufferUtil.glsl")) + { + return false; + } + } + if (features->hasScreenSpaceReflections || features->hasReflectionProbes) { if (!shader->attachFragmentObject("deferred/screenSpaceReflUtil.glsl")) @@ -606,7 +614,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_ATMOS 0.34\n"); // bit 0 extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_PBR 0.67\n"); // bit 1 extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_HDRI 1.0\n"); // bit 2 - extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(flag) (abs(norm.w-flag)< 0.1)\n"); + extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(data, flag) (abs(data-flag)< 0.1)\n"); if (defines) { @@ -717,6 +725,9 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev } } + // Master definition can be found in deferredUtil.glsl + extra_code_text[extra_code_count++] = strdup("struct GBufferInfo { vec4 albedo; vec4 specular; vec3 normal; vec4 emissive; float gbufferFlag; float envIntensity; };\n"); + //copy file into memory enum { flag_write_to_out_of_extra_block_area = 0x01 @@ -1249,6 +1260,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("sky_hdr_scale"); mReservedUniforms.push_back("sky_sunlight_scale"); mReservedUniforms.push_back("sky_ambient_scale"); + mReservedUniforms.push_back("classic_mode"); mReservedUniforms.push_back("blue_horizon"); mReservedUniforms.push_back("blue_density"); mReservedUniforms.push_back("haze_horizon"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 0eb9db6715..34bd73a42e 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -121,6 +121,7 @@ public: SKY_HDR_SCALE, // "sky_hdr_scale" SKY_SUNLIGHT_SCALE, // "sky_sunlight_scale" SKY_AMBIENT_SCALE, // "sky_ambient_scale" + CLASSIC_MODE, // "classic_mode" BLUE_HORIZON, // "blue_horizon" BLUE_DENSITY, // "blue_density" HAZE_HORIZON, // "haze_horizon" -- cgit v1.2.3