diff options
Diffstat (limited to 'indra')
57 files changed, 521 insertions, 311 deletions
| diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 38de9c7cf1..1bd65eb57d 100755 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -637,7 +637,7 @@ class LLManifest(object, metaclass=LLManifestRegistry):              'vers':'_'.join(self.args['version'])}          print("Creating unpacked file:", unpacked_file_name)          # could add a gz here but that doubles the time it takes to do this step -        tf = tarfile.open(self.src_path_of(unpacked_file_name), 'w:') +        tf = tarfile.open(self.build_path_of(unpacked_file_name), 'w:')          # add the entire installation package, at the very top level          tf.add(self.get_dst_prefix(), "")          tf.close() diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 41ff369de2..a783e18e49 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -692,7 +692,8 @@ private:          memset(cpu_vendor, 0, len);          sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0);          cpu_vendor[0x1f] = 0; -        setInfo(eVendor, cpu_vendor); +        // M series CPUs don't provide this field so if empty, just fall back to Apple. +        setInfo(eVendor, (cpu_vendor[0] != '\0') ? cpu_vendor : "Apple");          setInfo(eStepping, getSysctlInt("machdep.cpu.stepping"));          setInfo(eModel, getSysctlInt("machdep.cpu.model")); diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 7fa4230237..0759447902 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -2080,79 +2080,83 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da          {              if (domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant(daeElement::matchType(domMesh::ID()))))              { -                for (LLModel* model : mModelsMap.find(mesh)->second) +                dae_model_map::iterator it = mModelsMap.find(mesh); +                if (it != mModelsMap.end())                  { -                    LLMatrix4 transformation = mTransform; +                    for (LLModel* model : it->second) +                    { +                        LLMatrix4 transformation = mTransform; -                    if (mTransform.determinant() < 0) -                    { //negative scales are not supported -                        LL_INFOS() << "Negative scale detected, unsupported transform.  domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; -                        LLSD args; -                        args["Message"] = "NegativeScaleTrans"; -                        args["LABEL"] = getElementLabel(instance_geo); -                        mWarningsArray.append(args); +                        if (mTransform.determinant() < 0) +                        { //negative scales are not supported +                            LL_INFOS() << "Negative scale detected, unsupported transform.  domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; +                            LLSD args; +                            args["Message"] = "NegativeScaleTrans"; +                            args["LABEL"] = getElementLabel(instance_geo); +                            mWarningsArray.append(args); -                        badElement = true; -                    } +                            badElement = true; +                        } -                    LLModelLoader::material_map materials = getMaterials(model, instance_geo, dae); - -                    // adjust the transformation to compensate for mesh normalization -                    LLVector3 mesh_scale_vector; -                    LLVector3 mesh_translation_vector; -                    model->getNormalizedScaleTranslation(mesh_scale_vector, mesh_translation_vector); - -                    LLMatrix4 mesh_translation; -                    mesh_translation.setTranslation(mesh_translation_vector); -                    mesh_translation *= transformation; -                    transformation = mesh_translation; - -                    LLMatrix4 mesh_scale; -                    mesh_scale.initScale(mesh_scale_vector); -                    mesh_scale *= transformation; -                    transformation = mesh_scale; - -                    if (transformation.determinant() < 0) -                    { //negative scales are not supported -                        LL_INFOS() << "Negative scale detected, unsupported post-normalization transform.  domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; -                        LLSD args; -                        args["Message"] = "NegativeScaleNormTrans"; -                        args["LABEL"] = getElementLabel(instance_geo); -                        mWarningsArray.append(args); -                        badElement = true; -                    } +                        LLModelLoader::material_map materials = getMaterials(model, instance_geo, dae); + +                        // adjust the transformation to compensate for mesh normalization +                        LLVector3 mesh_scale_vector; +                        LLVector3 mesh_translation_vector; +                        model->getNormalizedScaleTranslation(mesh_scale_vector, mesh_translation_vector); + +                        LLMatrix4 mesh_translation; +                        mesh_translation.setTranslation(mesh_translation_vector); +                        mesh_translation *= transformation; +                        transformation = mesh_translation; + +                        LLMatrix4 mesh_scale; +                        mesh_scale.initScale(mesh_scale_vector); +                        mesh_scale *= transformation; +                        transformation = mesh_scale; + +                        if (transformation.determinant() < 0) +                        { //negative scales are not supported +                            LL_INFOS() << "Negative scale detected, unsupported post-normalization transform.  domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; +                            LLSD args; +                            args["Message"] = "NegativeScaleNormTrans"; +                            args["LABEL"] = getElementLabel(instance_geo); +                            mWarningsArray.append(args); +                            badElement = true; +                        } -                    std::string label; +                        std::string label; -                    if (model->mLabel.empty()) -                    { -                        label = getLodlessLabel(instance_geo); +                        if (model->mLabel.empty()) +                        { +                            label = getLodlessLabel(instance_geo); -                        llassert(!label.empty()); +                            llassert(!label.empty()); -                        if (model->mSubmodelID) -                        { -                            label += (char)((int)'a' + model->mSubmodelID); -                        } +                            if (model->mSubmodelID) +                            { +                                label += (char)((int)'a' + model->mSubmodelID); +                            } -                        model->mLabel = label + lod_suffix[mLod]; -                    } -                    else -                    { -                        // Don't change model's name if possible, it will play havoc with scenes that already use said model. -                        size_t ext_pos = getSuffixPosition(model->mLabel); -                        if (ext_pos != -1) -                        { -                            label = model->mLabel.substr(0, ext_pos); +                            model->mLabel = label + lod_suffix[mLod];                          }                          else                          { -                            label = model->mLabel; +                            // Don't change model's name if possible, it will play havoc with scenes that already use said model. +                            size_t ext_pos = getSuffixPosition(model->mLabel); +                            if (ext_pos != -1) +                            { +                                label = model->mLabel.substr(0, ext_pos); +                            } +                            else +                            { +                                label = model->mLabel; +                            }                          } -                    } -                    mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials)); -                    stretch_extents(model, transformation); +                        mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials)); +                        stretch_extents(model, transformation); +                    }                  }              }          } diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 6ba5463acd..45bb24a5b7 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1046,7 +1046,7 @@ void LLGLSLShader::bind()  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; -    llassert(mProgramObject != 0); +    llassert_always(mProgramObject != 0);      gGL.flush(); @@ -1069,6 +1069,9 @@ void LLGLSLShader::bind()          LLShaderMgr::instance()->updateShaderUniforms(this);          mUniformsDirty = false;      } + +    llassert_always(sCurBoundShaderPtr != nullptr); +    llassert_always(sCurBoundShader == mProgramObject);  }  void LLGLSLShader::bind(U8 variant) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 26e6aad770..9df0fef5d1 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -2179,15 +2179,15 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)      // this will mid-skew the data (and thus increase the chances of not      // being used as a mask) from high-frequency alpha maps which      // suffer the worst from aliasing when used as alpha masks. -    if (w >= 4 && h >= 4) +    if (w >= 2 && h >= 2)      { -        llassert(w%4 == 0); -        llassert(h%4 == 0); +        llassert(w % 2 == 0); +        llassert(h % 2 == 0);          const GLubyte* rowstart = ((const GLubyte*) data_in) + mAlphaOffset; -        for (U32 y = 0; y < h; y+=4) +        for (U32 y = 0; y < h; y += 2)          {              const GLubyte* current = rowstart; -            for (U32 x = 0; x < w; x+=4) +            for (U32 x = 0; x < w; x += 2)              {                  const U32 s1 = current[0];                  alphatotal += s1; @@ -2210,8 +2210,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)                  sample[asum/(16*4)] += 4;              } - -            rowstart += 4 * w * mAlphaStride; +            rowstart += 2 * w * mAlphaStride;          }          length *= 2; // we sampled everything twice, essentially      } @@ -2453,41 +2452,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/llrender.cpp b/indra/llrender/llrender.cpp index c8a9fb4893..eb2cd560a6 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1569,7 +1569,8 @@ void LLRender::flush()      if (mCount > 0)      {          LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; -        llassert(LLGLSLShader::sCurBoundShaderPtr != nullptr); +        llassert_always(LLGLSLShader::sCurBoundShaderPtr != nullptr); +          if (!mUIOffset.empty())          {              sUICalls++; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 150277c8df..e02dd4771e 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -559,17 +559,11 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev          }          else if (major_version == 3)          { -            if (minor_version < 10) +            if (minor_version <= 29)              { -                shader_code_text[shader_code_count++] = strdup("#version 300\n"); -            } -            else if (minor_version <= 19) -            { -                shader_code_text[shader_code_count++] = strdup("#version 310\n"); -            } -            else if (minor_version <= 29) -            { -                shader_code_text[shader_code_count++] = strdup("#version 320\n"); +                // OpenGL 3.2 had GLSL version 1.50.  anything after that the version numbers match. +                // https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#OpenGL_and_GLSL_versions +                shader_code_text[shader_code_count++] = strdup("#version 150\n");              }              else              { diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 12ae36f4bb..1f0c424188 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,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const  void LLVertexBuffer::initClass(LLWindow* window)  {      llassert(sVBOPool == nullptr); +      if (gGLManager.mIsApple)      {          LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 859ccbd4cd..5bcfddfe25 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1799,6 +1799,47 @@ if (WINDOWS)      add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon llwebrtc copy_w_viewer_manifest) +    # Useful for remote debugging or profiling if set to target a shared drive. for example, brad sets it to "dist/secondlife" to deploy under +    # the build tree (and then I share that directory) or "f:/dist/secondlife" to deploy to a network mounted drive (although this can be slow). +    # this will also create an "unpacked" tarball at build-<platform>/newview/unpacked_<platform>_7_1_11_<build num>.tar +    set(LOCAL_DIST_DIR "" CACHE PATH "Path for 'local' unpacked copy of viewer distribution to be deployed to.") +    set(product SecondLife-${ARCH}-${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}) +    if(IS_DIRECTORY ${LOCAL_DIST_DIR}) +        add_custom_command( +            OUTPUT  ${LOCAL_DIST_DIR}/.${product}.copy_touched +            COMMAND ${PYTHON_EXECUTABLE} +            ARGS +            ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py +            "--actions=\"copy package unpacked\"" +            --arch=${ARCH} +            --artwork=${ARTWORK_DIR} +            "--bugsplat=${BUGSPLAT_DB}" +            "--openal=${USE_OPENAL}" +            "--tracy=${USE_TRACY}" +            --build=${CMAKE_CURRENT_BINARY_DIR} +            --buildtype=$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,${CMAKE_BUILD_TYPE}> +            "--channel=${VIEWER_CHANNEL}" +            --configuration=$<CONFIG> +            --dest=${LOCAL_DIST_DIR} +            --grid=${GRID} +            --source=${CMAKE_CURRENT_SOURCE_DIR} +            --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt +            --touch=${LOCAL_DIST_DIR}/.${product}.copy_touched +            DEPENDS +            ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py +            stage_third_party_libs +            llwebrtc +            ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt +            ${COPY_INPUT_DEPENDENCIES} +            ${VIEWER_BINARY_NAME} +            COMMENT "Performing viewer_manifest local dist copy" +            ) + +        add_custom_target(copy_local_dist_viewer_manifest ALL DEPENDS ${LOCAL_DIST_DIR}/.${product}.copy_touched) +    elseif (NOT LOCAL_DIST_DIR STREQUAL "") +        message(FATAL_ERROR "LOCAL_DIST_DIR ${LOCAL_DIST_DIR} specified but is not valid target directory to copy viewer distribution into.  Please create the directory and try again") +    endif ()  # IS_DIRECTORY ${LOCAL_DIST_DIR} +      if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)        add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts)      endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8802644e8c..5202f70346 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7836,7 +7836,7 @@          <key>Type</key>          <string>U32</string>          <key>Value</key> -        <integer>1</integer> +        <integer>0</integer>      </map>      <key>RenderDebugTextureBind</key>      <map> @@ -16038,5 +16038,16 @@      <key>Value</key>      <integer>0</integer>    </map> +  <key>RenderHDREnabled</key> +  <map> +    <key>Comment</key> +    <string>Enable HDR rendering.</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Boolean</string> +    <key>Value</key> +    <integer>1</integer> +  </map>  </map>  </llsd> diff --git a/indra/newview/app_settings/shaders/class1/deferred/CASF.glsl b/indra/newview/app_settings/shaders/class1/deferred/CASF.glsl index e80c59b39f..017855325c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/CASF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/CASF.glsl @@ -1150,7 +1150,7 @@ vec3 linear_to_srgb(vec3 cl);   AF3 ASignedF3(AF3 m){return ASatF3(m*AF3_(A_INFN_F));}   AF4 ASignedF4(AF4 m){return ASatF4(m*AF4_(A_INFN_F));}  //------------------------------------------------------------------------------------------------------------------------------ - AF1 AGtZeroF1(AF1 m){return ASatF1(m*AF1_(A_INFP_F));} +// #2744 avoid constant overflow  AF1 AGtZeroF1(AF1 m){return ASatF1(m*AF1_(A_INFP_F));}   AF2 AGtZeroF2(AF2 m){return ASatF2(m*AF2_(A_INFP_F));}   AF3 AGtZeroF3(AF3 m){return ASatF3(m*AF3_(A_INFP_F));}   AF4 AGtZeroF4(AF4 m){return ASatF4(m*AF4_(A_INFP_F));} diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index b904df3a1b..32b768cc63 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -36,6 +36,7 @@ in vec2 vary_texcoord0;  in vec3 vary_position;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  void main()  { @@ -51,7 +52,7 @@ void main()      frag_data[0] = vec4(diff.rgb, 0.0);      frag_data[1] = vec4(0,0,0,0);      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 2cc3085cd0..79c1b392e9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl @@ -40,6 +40,8 @@ in vec2 vary_texcoord0;  in vec3 vary_position;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag); +  void main()  {      mirrorClip(vary_position); @@ -62,6 +64,6 @@ void main()          frag_data[1] = vertex_color.aaaa; // spec          //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested          vec3 nvn = normalize(tnorm); -        frag_data[2] = vec4(nvn, GBUFFER_FLAG_HAS_ATMOS); +        frag_data[2] = encodeNormal(nvn, GBUFFER_FLAG_HAS_ATMOS);          frag_data[3] = vec4(vertex_color.a, 0, 0, 0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 3319e32cdf..5a83e19b37 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -75,6 +75,9 @@ const float ONE_OVER_PI = 0.3183098861;  vec3 srgb_to_linear(vec3 cs);  vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten); +vec4 decodeNormal(vec4 norm); + +  float calcLegacyDistanceAttenuation(float distance, float falloff)  {      float dist_atten = 1.0 - clamp((distance + falloff)/(1.0 + falloff), 0.0, 1.0); @@ -145,8 +148,7 @@ vec2 getScreenCoordinate(vec2 screenpos)  vec4 getNorm(vec2 screenpos)  { -    vec4 norm = texture(normalMap, screenpos.xy); -    norm.xyz = normalize(norm.xyz); +    vec4 norm = decodeNormal(texture(normalMap, screenpos.xy));      return norm;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl index 1751e17814..fadf06d592 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl @@ -39,6 +39,8 @@ in vec2 vary_texcoord0;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag); +  void main()  {      mirrorClip(vary_position); @@ -53,7 +55,7 @@ void main()      frag_data[0] = vec4(col.rgb, 0.0);      frag_data[1] = vec4(0,0,0,0); // spec      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl index f5b517a8ea..10d06da416 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl @@ -36,6 +36,7 @@ in vec4 vertex_color;  in vec2 vary_texcoord0;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  void main()  { @@ -51,6 +52,6 @@ void main()      frag_data[0] = vec4(col.rgb, 0.0);      frag_data[1] = vec4(0,0,0,0);      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl index 89ea0c1710..f7c8fc9596 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl @@ -33,6 +33,7 @@ uniform sampler2D diffuseMap;  in vec3 vary_normal;  in vec2 vary_texcoord0; +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  void main()  { @@ -46,7 +47,7 @@ void main()      frag_data[0] = vec4(col.rgb, 0.0);      frag_data[1] = vec4(0,0,0,0); // spec      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 7f056a51e8..d83f5a3145 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -35,6 +35,7 @@ in vec2 vary_texcoord0;  in vec3 vary_position;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  void main()  { @@ -42,9 +43,8 @@ void main()      vec3 col = vertex_color.rgb * texture(diffuseMap, vary_texcoord0.xy).rgb;      frag_data[0] = vec4(col, 0.0);      frag_data[1] = vertex_color.aaaa; // spec -    //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(vertex_color.a, 0, 0, 0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl index 5c73878ba9..6d8943e7ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl @@ -33,6 +33,8 @@ in vec2 vary_texcoord0;  in vec3 vary_position;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag); +  vec3 linear_to_srgb(vec3 c);  void main() @@ -46,6 +48,6 @@ void main()      frag_data[0] = vec4(col, 0.0);      frag_data[1] = vec4(spec, vertex_color.a); // spec      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(vertex_color.a, 0, 0, 0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl index a1b7a4b11f..2aac333543 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl @@ -43,3 +43,15 @@ void mirrorClip(vec3 pos)      }  } +vec4 encodeNormal(vec3 norm, float gbuffer_flag) +{ +    return vec4(norm * 0.5 + 0.5, gbuffer_flag); +} + +vec4 decodeNormal(vec4 norm) +{ +    norm.xyz = norm.xyz * 2.0 - 1.0; +    return norm; +} + + diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 99cb23839a..a6bca68cb0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -38,6 +38,8 @@ in vec2 vary_texcoord0;  vec3 linear_to_srgb(vec3 c); +vec4 encodeNormal(vec3 norm, float gbuffer_flag); +  void main()  {      vec4 col = texture(diffuseMap, vary_texcoord0.xy); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl index b521081af9..c0d4c387af 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl @@ -61,6 +61,7 @@ uniform vec4 clipPlane;  uniform float clipSign;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  uniform mat3 normal_matrix; @@ -113,7 +114,7 @@ void main()      // See: C++: addDeferredAttachments(), GLSL: softenLightF      frag_data[0] = max(vec4(col, 0.0), vec4(0));                                                   // Diffuse      frag_data[1] = max(vec4(spec.rgb,0.0), vec4(0));                                    // PBR linear packed Occlusion, Roughness, Metal. -    frag_data[2] = vec4(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags +    frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags      frag_data[3] = max(vec4(emissive,0), vec4(0));                                                // PBR sRGB Emissive  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl index 410c447c64..b434479511 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl @@ -162,6 +162,7 @@ in vec4[2] vary_coords;  #endif  void mirrorClip(vec3 position); +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  float terrain_mix(TerrainMix tm, vec4 tms4); @@ -429,7 +430,7 @@ void main()  #endif      frag_data[0] = max(vec4(pbr_mix.col.xyz, 0.0), vec4(0));                                                   // Diffuse      frag_data[1] = max(vec4(mix_orm.rgb, base_color_factor_alpha), vec4(0));                                    // PBR linear packed Occlusion, Roughness, Metal. -    frag_data[2] = vec4(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags +    frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags      frag_data[3] = max(vec4(mix_emissive,0), vec4(0));                                                // PBR sRGB Emissive  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index 1fd31e0546..5ff84b5937 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -39,6 +39,7 @@ in vec4 vary_texcoord0;  in vec4 vary_texcoord1;  void mirrorClip(vec3 position); +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  void main()  { @@ -60,7 +61,7 @@ void main()      frag_data[0] = max(outColor, vec4(0));      frag_data[1] = vec4(0.0,0.0,0.0,-1.0);      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index 05922ecb1a..0894eff660 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -37,6 +37,8 @@ in vec3 vary_position;  uniform float minimum_alpha;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag); +  void main()  {      mirrorClip(vary_position); @@ -49,6 +51,6 @@ void main()      frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);      frag_data[1] = vec4(0,0,0,0);      vec3 nvn = normalize(vary_normal); -    frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); +    frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);      frag_data[3] = vec4(0);  } diff --git a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl index ac4ff50552..1d8a92bac7 100644 --- a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl +++ b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl @@ -64,6 +64,8 @@ in vec2 base_color_uv;  in vec2 emissive_uv;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag); +  vec3 linear_to_srgb(vec3 c);  vec3 srgb_to_linear(vec3 c);  // ================================== @@ -241,7 +243,7 @@ void main()  #else      frag_data[0] = max(vec4(basecolor.rgb, 0.0), vec4(0));      frag_data[1] = max(vec4(orm.rgb,0.0), vec4(0)); -    frag_data[2] = vec4(norm, GBUFFER_FLAG_HAS_PBR); +    frag_data[2] = encodeNormal(norm, GBUFFER_FLAG_HAS_PBR);      frag_data[3] = max(vec4(emissive,0), vec4(0));  #endif  #endif diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl index feb0947649..b3964c9215 100644 --- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl @@ -130,7 +130,7 @@ vec4 prefilterEnvMap(vec3 R)      float totalWeight = 0.0;      float envMapDim = float(textureSize(reflectionProbes, 0).s);      float roughness = mipLevel/max_probe_lod; -    int numSamples = max(int(PROBE_FILTER_SAMPLES*roughness), 1); +    uint numSamples = uint(max(PROBE_FILTER_SAMPLES*roughness, 1));      float numMips = max_probe_lod+1; diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index 26ab0406f6..3c13144299 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -51,6 +51,7 @@ uniform mat3 normal_matrix;  in vec3 vary_position;  void mirrorClip(vec3 pos); +vec4 encodeNormal(vec3 norm, float gbuffer_flag);  #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) @@ -414,7 +415,7 @@ void main()      frag_data[0] = max(vec4(diffcol.rgb, emissive), vec4(0));        // gbuffer is sRGB for legacy materials      frag_data[1] = max(vec4(spec.rgb, glossiness), vec4(0));           // XYZ = Specular color. W = Specular exponent. -    frag_data[2] = vec4(norm, flag);   // XY = Normal.  Z = Env. intensity. W = 1 skip atmos (mask off fog) +    frag_data[2] = encodeNormal(norm, flag);   // XY = Normal.  Z = Env. intensity. W = 1 skip atmos (mask off fog)      frag_data[3] = vec4(env, 0, 0, 0);  #endif diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl index 9ac389f926..dc135243a6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl @@ -81,7 +81,7 @@ void main()      vec4 collectedColor = vec4(0); -    float w = tapScreenSpaceReflection(4, tc, pos, norm.xyz, collectedColor, diffuseMap, 0); +    float w = tapScreenSpaceReflection(4, tc, pos, norm.xyz, collectedColor, diffuseMap, 0.f);      collectedColor.rgb *= specCol.rgb; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index ca88fe7482..a9b299cfd7 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -27,6 +27,8 @@  out vec4 frag_color; +vec4 decodeNormal(vec4 norm); +  uniform sampler2D diffuseRect;  uniform sampler2D specularRect;  uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 6390e43b7a..de04db9a64 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -79,7 +79,7 @@ RenderHeroProbeResolution	1	2048  RenderHeroProbeDistance		1	16  RenderHeroProbeUpdateRate	1	6  RenderHeroProbeConservativeUpdateMultiplier 1 16 -RenderDownScaleMethod       1   1 +RenderDownScaleMethod       1   0  RenderCASSharpness          1   1  RenderExposure				1   4  RenderTonemapType			1   1 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 9ba922c3ce..c6edf427eb 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 62 +version 63  // The version number above should be incremented IF AND ONLY IF some  // change has been made that is sufficiently important to justify  // resetting the graphics preferences of all users to the recommended @@ -68,8 +68,8 @@ RenderFSAASamples			1	3  RenderMaxTextureIndex		1	16  RenderGLContextCoreProfile         1   1  RenderGLMultiThreadedTextures      1   0 -RenderGLMultiThreadedMedia         1   1 -RenderAppleUseMultGL        1   1 +RenderGLMultiThreadedMedia         1   0 +RenderAppleUseMultGL        1   0  RenderReflectionsEnabled    1   1  RenderReflectionProbeDetail	1	2  RenderScreenSpaceReflections 1  1 @@ -408,8 +408,8 @@ RenderFSAASamples			1	0  // AppleGPU and NonAppleGPU can be thought of as Apple silicon vs Intel Mac  list AppleGPU -RenderGLMultiThreadedMedia  1   1 -RenderAppleUseMultGL        1   1 +RenderGLMultiThreadedMedia  1   0 +RenderAppleUseMultGL        1   0  list NonAppleGPU  RenderGLMultiThreadedMedia  1   0 diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 297661effd..3ccb363321 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2218,9 +2218,11 @@ bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)                  if (rigInfo.needsUpdate())                  {                      LLVOVolume* vo_volume = (LLVOVolume*)mVObjp.get(); -                    LLVOAvatar* avatar = mVObjp->getAvatar();                      const LLMeshSkinInfo* skin = vo_volume->getSkinInfo(); -                    LLSkinningUtil::updateRiggingInfo(skin, avatar, face); +                    if (skin) +                    { +                        LLSkinningUtil::updateRiggingInfo(skin, avatar, face); +                    }                  }                  // calculate the world space bounding box of the face by combining the bounding boxes of all the joints diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index b5d8f70c2e..ae520ca5cd 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -655,6 +655,24 @@ void LLFeatureManager::applyBaseMasks()      if (gGLManager.mIsIntel)      {          maskFeatures("Intel"); +        // check against 3.33 to avoid applying this fallback twice +        if (gGLManager.mGLVersion < 4.59f && gGLManager.mGLVersion > 3.33f) +        { +            // if we don't have OpenGL 4.6 on intel, set it to OpenGL 3.3 +            // we also want to trigger the GL3 fallbacks on these chipsets +            // this is expected to be mainly pre-Haswell Intel HD Graphics 4X00 and 5X00. +            // A lot of these chips claim 4.3 or 4.4 support, but don't seem to work. +            // https://code.blender.org/2019/04/supported-gpus-in-blender-2-80/ +            // https://docs.blender.org/manual/en/latest/troubleshooting/gpu/windows/intel.html#legacy-intel-hd-4000-5000 +            // https://www.intel.com/content/www/us/en/support/articles/000005524/graphics.html +            // this will disable things like reflection probes, HDR, FXAA and SMAA +            LL_INFOS("RenderInit") << "Applying Intel integrated pre-Haswell fallback.  Downgrading feature usage to OpenGL 3.3" << LL_ENDL; +            gGLManager.mGLVersion = llmin(gGLManager.mGLVersion, 3.33f); +            gGLManager.mGLVersionString += " 3.3 fallback";  // for ViewerStats reporting +            // and select GLSL version for OpenGL 3.2 +            gGLManager.mGLSLVersionMajor = 3; +            gGLManager.mGLSLVersionMinor = 20; +        }      }      if (gGLManager.mIsApple)      { diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index 634a4853b0..4a33b9f05f 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -31,10 +31,14 @@  #include "llviewertexture.h"  class LLGLSLShader; +class LLGLTFMaterialList; +class LLTerrainMaterials;  class LLFetchedGLTFMaterial: public LLGLTFMaterial  { -    friend class LLGLTFMaterialList; // for lifetime management +    // for lifetime management +    friend class LLGLTFMaterialList; +    friend class LLTerrainMaterials;  public:      LLFetchedGLTFMaterial();      virtual ~LLFetchedGLTFMaterial(); diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index dde238eddb..1e3a328464 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1976,21 +1976,21 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind          return;      } -    LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); -      if (index >= 0)      {          // Prespecified material +        LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");          me->loadMaterial(model_in, filename, index);      }      else if (model_in.materials.size() == 1)      { -        // Only one, just load it +        // Only one material, just load it +        LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");          me->loadMaterial(model_in, filename, 0);      }      else      { -        // Promt user to select material +        // Multiple materials, Promt user to select material          std::list<std::string> material_list;          std::vector<tinygltf::Material>::const_iterator mat_iter = model_in.materials.begin();          std::vector<tinygltf::Material>::const_iterator mat_end = model_in.materials.end(); @@ -2008,15 +2008,19 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind              }          } -        material_list.push_back(me->getString("material_batch_import_text")); +        material_list.push_back(LLTrans::getString("material_batch_import_text"));          LLFloaterComboOptions::showUI( -            [me, model_in, filename](const std::string& option, S32 index) +            [model_in, filename](const std::string& option, S32 index)          { -            me->loadMaterial(model_in, filename, index); +            if (index >= 0) // -1 on cancel +            { +                LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); +                me->loadMaterial(model_in, filename, index); +            }          }, -            me->getString("material_selection_title"), -            me->getString("material_selection_text"), +            LLTrans::getString("material_selection_title"), +            LLTrans::getString("material_selection_text"),              material_list              );      } diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 1e7da126b0..d61333c2cc 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -227,6 +227,8 @@ LLModelPreview::~LLModelPreview()      }      mBaseModel.clear();      mBaseScene.clear(); + +    LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList);  }  void LLModelPreview::updateDimentionsAndOffsets() @@ -553,7 +555,7 @@ void LLModelPreview::rebuildUploadData()                          {                              // in case user provided a missing file later                              texture->setIsMissingAsset(false); -                            texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, NULL, false); +                            texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, &mCallbackTextureList, false);                              texture->forceToSaveRawImage(0, F32_MAX);                              texture->updateFetch();                              if (mModelLoader) @@ -3130,8 +3132,6 @@ LLJoint* LLModelPreview::lookupJointByName(const std::string& str, void* opaque)  U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque)  { -    (void)opaque; -      if (material.mDiffuseMapFilename.size())      {          material.mOpaqueData = new LLPointer< LLViewerFetchedTexture >; @@ -3145,7 +3145,8 @@ U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque)          }          // Todo: might cause a crash if preview gets closed before we get the callback.          // Use a callback list or guard callback in some way -        tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, NULL, false); +        LLModelPreview* preview = (LLModelPreview*)opaque; +        tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, &preview->mCallbackTextureList, false);          tex->forceToSaveRawImage(0, F32_MAX);          material.setDiffuseMap(tex->getID()); // record tex ID          return 1; diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index c615070105..e236d7ced7 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -316,6 +316,7 @@ protected:      LLMeshUploadThread::instance_list mUploadData;      std::set<LLViewerFetchedTexture * > mTextureSet; +    LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList;      //map of vertex buffers to models (one vertex buffer in vector per face in model      std::map<LLModel*, std::vector<LLPointer<LLVertexBuffer> > > mVertexBuffer[LLModel::NUM_LODS + 1]; diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 72fb9464d8..b1d5cd9e16 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -55,8 +55,15 @@  static LLPanelInjector<LLOutfitGallery> t_outfit_gallery("outfit_gallery"); -#define MAX_OUTFIT_PHOTO_WIDTH 256 -#define MAX_OUTFIT_PHOTO_HEIGHT 256 +// The maximum resolution at which to load the outfit photo. If the given +// texture has a higher resolution, tell the texture streaming system to +// only load the resolution needed. An in-world object may request to load +// the texture at a higher resolution, but that won't affect textures +// loaded with LLViewerTexture::FETCHED_TEXTURE. (see +// LLOutfitGalleryItem::setImageAssetId and also +// LLViewerTexture::LOD_TEXTURE) +#define MAX_OUTFIT_PHOTO_LOAD_WIDTH 256 +#define MAX_OUTFIT_PHOTO_LOAD_HEIGHT 256  const S32 GALLERY_ITEMS_PER_ROW_MIN = 2; @@ -979,28 +986,18 @@ void LLOutfitGalleryItem::draw()      border.mRight = border.mRight + 1;      gl_rect_2d(border, border_color, false); -    // If the floater is focused, don't apply its alpha to the texture (STORM-677). -    const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();      if (mTexturep)      { -        if (mImageUpdatePending && mTexturep->getDiscardLevel() >= 0) -        { -            mImageUpdatePending = false; -            if (mTexturep->getOriginalWidth() > MAX_OUTFIT_PHOTO_WIDTH || mTexturep->getOriginalHeight() > MAX_OUTFIT_PHOTO_HEIGHT) -            { -                setDefaultImage(); -            } -        } -        else -        { -            LLRect interior = border; -            interior.stretch(-1); +        LLRect interior = border; +        interior.stretch(-1); -            gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); +        // Pump the priority +        const F32 stats = (F32)llmin(interior.getWidth() * interior.getHeight(), MAX_OUTFIT_PHOTO_LOAD_WIDTH * MAX_OUTFIT_PHOTO_LOAD_HEIGHT); +        mTexturep->addTextureStats(stats); -            // Pump the priority -            mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight())); -        } +        // If the floater is focused, don't apply its alpha to the texture (STORM-677). +        const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); +        gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);      }  } @@ -1128,14 +1125,18 @@ bool LLOutfitGalleryItem::openOutfitsContent()  bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id)  { -    LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); -    if (texture && texture->getOriginalWidth() <= MAX_OUTFIT_PHOTO_WIDTH && texture->getOriginalHeight() <= MAX_OUTFIT_PHOTO_HEIGHT) +    LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE); +    if (texture)      {          mImageAssetId = image_asset_id;          mTexturep = texture; +        // *TODO: There was previously logic which attempted to toggle +        // visibility of the preview icon based on certain conditions, +        // however these conditions either did not make sense or were not +        // applicable due to texture streaming. Maybe we should only hide +        // the preview icon if the texture has at least one mip loaded.          mPreviewIcon->setVisible(false);          mDefaultImage = false; -        mImageUpdatePending = (texture->getDiscardLevel() == -1);          return true;      }      return false; @@ -1152,7 +1153,6 @@ void LLOutfitGalleryItem::setDefaultImage()      mImageAssetId.setNull();      mPreviewIcon->setVisible(true);      mDefaultImage = true; -    mImageUpdatePending = false;  }  LLContextMenu* LLOutfitGalleryContextMenu::createMenu() diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index fa441ff209..541ea2f9d4 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -266,7 +266,6 @@ private:      bool     mSelected;      bool     mWorn;      bool     mDefaultImage; -    bool     mImageUpdatePending;      bool     mHidden;      std::string mOutfitName;  }; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index f083747bfe..dd13a4e8ea 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -463,6 +463,11 @@ void LLReflectionMapManager::update()  LLReflectionMap* LLReflectionMapManager::addProbe(LLSpatialGroup* group)  { +    if (gGLManager.mGLVersion < 4.05f) +    { +        return nullptr; +    } +      LLReflectionMap* probe = new LLReflectionMap();      probe->mGroup = group; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index ed91214bd0..dd1be028cd 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -537,7 +537,6 @@ private:      F32 mImagePriority; // should map to max virtual size      F32 mRequestedPriority;      S32 mDesiredDiscard; -    S32 mSimRequestedDiscard;      S32 mRequestedDiscard;      S32 mLoadedDiscard;      S32 mDecodedDiscard; @@ -870,7 +869,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,        mImagePriority(priority),        mRequestedPriority(0.f),        mDesiredDiscard(-1), -      mSimRequestedDiscard(-1),        mRequestedDiscard(-1),        mLoadedDiscard(-1),        mDecodedDiscard(-1), diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 9e1d86faac..d667fdbea8 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -402,7 +402,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,      LLViewerObject *objectp;      S32         num_objects; -    U32         local_id; +    U32         local_id = 0;      LLPCode     pcode = 0;      LLUUID      fullid;      S32         i; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d59dfb88a8..c21aeb1d57 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1303,12 +1303,15 @@ void LLViewerRegion::updateReflectionProbes(bool full_update)                  mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe();              } -            LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); -            probe_origin.mV[2] += hover_height; -            probe_origin += origin; +            if (mReflectionMaps[idx]) +            { +                LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); +                probe_origin.mV[2] += hover_height; +                probe_origin += origin; -            mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); -            mReflectionMaps[idx]->mRadius = probe_radius; +                mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); +                mReflectionMaps[idx]->mRadius = probe_radius; +            }          }      }  } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index d1201df157..cdebb08b18 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2493,7 +2493,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()          }      } -    if (success) +    if (success && gGLManager.mGLVersion > 4.05f)      {          gCASProgram.mName = "Contrast Adaptive Sharpening Shader";          gCASProgram.mFeatures.hasSrgb = true; @@ -2501,7 +2501,14 @@ bool LLViewerShaderMgr::loadShadersDeferred()          gCASProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));          gCASProgram.mShaderFiles.push_back(make_pair("deferred/CASF.glsl", GL_FRAGMENT_SHADER));          gCASProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; -        gCASProgram.createShader(); +        success = gCASProgram.createShader(); +        // llassert(success); +        if (!success) +        { +            LL_WARNS() << "Failed to create shader '" << gCASProgram.mName << "', disabling!" << LL_ENDL; +            // continue as if this shader never happened +            success = true; +        }      }      if (success) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 82fefde0a7..4a15b8624a 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -546,7 +546,9 @@ void LLViewerTexture::updateClass()          if (sEvaluationTimer.getElapsedTimeF32() > MEMORY_CHECK_WAIT_TIME)          {              static LLCachedControl<F32> low_mem_min_discard_increment(gSavedSettings, "RenderLowMemMinDiscardIncrement", .1f); -            sDesiredDiscardBias += (F32) low_mem_min_discard_increment * (F32) gFrameIntervalSeconds; + +            F32 increment = low_mem_min_discard_increment + llmax(over_pct, 0.f); +            sDesiredDiscardBias += increment * gFrameIntervalSeconds;          }      }      else @@ -605,7 +607,7 @@ void LLViewerTexture::updateClass()                  last_desired_discard_bias = sDesiredDiscardBias;                  was_backgrounded = true;              } -            sDesiredDiscardBias = 4.f; +            sDesiredDiscardBias = 5.f;          }      }      else @@ -619,7 +621,7 @@ void LLViewerTexture::updateClass()          }      } -    sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 4.f); +    sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 5.f);      LLViewerTexture::sFreezeImageUpdates = false;  } @@ -1555,8 +1557,8 @@ void LLViewerFetchedTexture::postCreateTexture()      if (!needsToSaveRawImage())      {          mNeedsAux = false; -        destroyRawImage();      } +    destroyRawImage(); // will save raw image if needed      mNeedsCreateTexture = false;  } @@ -2915,7 +2917,7 @@ void LLViewerLODTexture::processTextureStats()          mDesiredDiscardLevel = 0;      }      // Generate the request priority and render priority -    else if (mDontDiscard || !mUseMipMaps) +    else if (mDontDiscard || !mUseMipMaps || (getFTType() == FTT_MAP_TILE))      {          mDesiredDiscardLevel = 0;          if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 65fa633f81..1da8548573 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -410,6 +410,8 @@ public:      /*virtual*/bool  isActiveFetching() override; //is actively in fetching by the fetching pipeline. +    virtual bool scaleDown() { return false; }; +      bool mCreatePending = false;    // if true, this is in gTextureList.mCreateTextureList      mutable bool mDownScalePending = false; // if true, this is in gTextureList.mDownScaleQueue @@ -527,12 +529,12 @@ public:      LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), bool usemipmaps = true);      LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, bool usemipmaps = true); -    /*virtual*/ S8 getType() const; +    S8 getType() const override;      // Process image stats to determine priority/quality requirements. -    /*virtual*/ void processTextureStats(); +    void processTextureStats() override;      bool isUpdateFrozen() ; -    bool scaleDown(); +    bool scaleDown() override;  private:      void init(bool firstinit) ; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 0d609b8084..2dc0458d99 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1052,8 +1052,32 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)      LLTimer create_timer; +    while (!mCreateTextureList.empty()) +    { +        LLViewerFetchedTexture* imagep = mCreateTextureList.front(); +        llassert(imagep->mCreatePending); +        imagep->createTexture(); +        imagep->postCreateTexture(); +        imagep->mCreatePending = false; +        mCreateTextureList.pop(); + +        if (imagep->hasGLTexture() && imagep->getDiscardLevel() < imagep->getDesiredDiscardLevel()) +        { +            LL_WARNS_ONCE("Texture") << "Texture will be downscaled immediately after loading." << LL_ENDL; +            imagep->scaleDown(); +        } + +        if (create_timer.getElapsedTimeF32() > max_time) +        { +            break; +        } +    } +      if (!mDownScaleQueue.empty() && gPipeline.mDownResMap.isComplete())      { +        LLGLDisable blend(GL_BLEND); +        gGL.setColorMask(true, true); +          // just in case we downres textures, bind downresmap and copy program          gPipeline.mDownResMap.bindTarget();          gCopyProgram.bind(); @@ -1067,6 +1091,7 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)          // freeze.          S32 min_count = (S32)mCreateTextureList.size() / 20 + 5; +        create_timer.reset();          while (!mDownScaleQueue.empty())          {              LLViewerFetchedTexture* image = mDownScaleQueue.front(); @@ -1091,25 +1116,6 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)          gPipeline.mDownResMap.flush();      } -    // do at least 5 and make sure we don't get too far behind even if it violates -    // the time limit.  Textures pending creation have a copy of their texture data -    // in system memory, so we don't want to let them pile up. -    S32 min_count = (S32) mCreateTextureList.size() / 20 + 5; - -    while (!mCreateTextureList.empty()) -    { -        LLViewerFetchedTexture *imagep =  mCreateTextureList.front(); -        llassert(imagep->mCreatePending); -        imagep->createTexture(); -        imagep->postCreateTexture(); -        imagep->mCreatePending = false; -        mCreateTextureList.pop(); - -        if (create_timer.getElapsedTimeF32() > max_time && --min_count <= 0) -        { -            break; -        } -    }      return create_timer.getElapsedTimeF32();  } diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index 077e6e6cb1..3441e25c6a 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -102,14 +102,6 @@ namespace      }  }; -LLTerrainMaterials::LLTerrainMaterials() -{ -    for (S32 i = 0; i < ASSET_COUNT; ++i) -    { -        mMaterialTexturesSet[i] = false; -    } -} -  LLTerrainMaterials::~LLTerrainMaterials()  {      unboost(); @@ -199,7 +191,6 @@ void LLTerrainMaterials::setDetailAssetID(S32 asset, const LLUUID& id)      LLPointer<LLFetchedGLTFMaterial>& mat = mDetailMaterials[asset];      mat = id.isNull() ? nullptr : gGLTFMaterialList.getMaterial(id);      mDetailRenderMaterials[asset] = nullptr; -    mMaterialTexturesSet[asset] = false;  }  const LLGLTFMaterial* LLTerrainMaterials::getMaterialOverride(S32 asset) const @@ -262,11 +253,17 @@ bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict)          if (!material_asset_ready(mat)) { continue; }          LLPointer<LLFetchedGLTFMaterial>& render_mat = mDetailRenderMaterials[i]; +        // This will be mutated by materialTexturesReady, due to the way that +        // function is implemented. +        bool render_material_textures_set = bool(render_mat);          if (!render_mat)          {              render_mat = new LLFetchedGLTFMaterial();              *render_mat = *mat;              // This render_mat is effectively already loaded, because it gets its data from mat. +            // However, its textures may not be loaded yet. +            render_mat->materialBegin(); +            render_mat->materialComplete(true);              LLPointer<LLGLTFMaterial>& override_mat = mDetailMaterialOverrides[i];              if (override_mat) @@ -275,7 +272,8 @@ bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict)              }          } -        ready[i] = materialTexturesReady(render_mat, mMaterialTexturesSet[i], boost, strict); +        ready[i] = materialTexturesReady(render_mat, render_material_textures_set, boost, strict); +        llassert(render_material_textures_set);      }  #if 1 @@ -414,16 +412,6 @@ bool LLTerrainMaterials::materialTexturesReady(LLPointer<LLFetchedGLTFMaterial>&      return true;  } -// Boost the loading priority of every known texture in the material -// Return true when ready to use -// static -bool LLTerrainMaterials::makeMaterialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bool &textures_set, bool boost, bool strict) -{ -    if (!material_asset_ready(mat)) { return false; } - -    return materialTexturesReady(mat, textures_set, boost, strict); -} -  // static  const LLUUID (&LLVLComposition::getDefaultTextures())[ASSET_COUNT]  { diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h index f15f9bff6a..b7cba0a093 100644 --- a/indra/newview/llvlcomposition.h +++ b/indra/newview/llvlcomposition.h @@ -27,18 +27,17 @@  #ifndef LL_LLVLCOMPOSITION_H  #define LL_LLVLCOMPOSITION_H +#include "llfetchedgltfmaterial.h" +#include "llimage.h" +#include "llpointer.h" +#include "llterrainpaintmap.h"  #include "llviewerlayer.h"  #include "llviewershadermgr.h"  #include "llviewertexture.h" -#include "llpointer.h" - -#include "llimage.h"  class LLSurface;  class LLViewerFetchedTexture; -class LLGLTFMaterial; -class LLFetchedGLTFMaterial;  class LLModifyRegion  { @@ -52,7 +51,7 @@ class LLTerrainMaterials : public LLModifyRegion  public:      friend class LLDrawPoolTerrain; -    LLTerrainMaterials(); +    LLTerrainMaterials() {}      virtual ~LLTerrainMaterials();      void apply(const LLModifyRegion& other); @@ -93,15 +92,15 @@ protected:      static bool makeTextureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost);      // strict = true -> all materials must be sufficiently loaded      // strict = false -> at least one material must be loaded -    static bool makeMaterialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict); -    // *NOTE: Prefer calling makeMaterialReady if mat is known to be LLFetchedGLTFMaterial      static bool materialTexturesReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict);      LLPointer<LLViewerFetchedTexture> mDetailTextures[ASSET_COUNT]; +    // *NOTE: Unlike mDetailRenderMaterials, the textures in this are not +    // guaranteed to be set or loaded after a true return from +    // makeMaterialsReady.      LLPointer<LLFetchedGLTFMaterial> mDetailMaterials[ASSET_COUNT];      LLPointer<LLGLTFMaterial> mDetailMaterialOverrides[ASSET_COUNT];      LLPointer<LLFetchedGLTFMaterial> mDetailRenderMaterials[ASSET_COUNT]; -    bool mMaterialTexturesSet[ASSET_COUNT];      U32 mPaintType = TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE;      LLPointer<LLViewerTexture> mPaintMap; diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 1e934ade59..7d6ad743bd 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -2024,23 +2024,48 @@ bool LLVivoxVoiceClient::waitForChannel()                      llcoro::suspend();                      break;                  } -                sessionStatePtr_t joinSession = mNextAudioSession; -                mNextAudioSession.reset(); -                mIsProcessingChannels = true; -                if (!runSession(joinSession)) //suspends + +                try                  { -                    mIsProcessingChannels = false; -                    LL_DEBUGS("Voice") << "runSession returned false; leaving inner loop" << LL_ENDL; -                    break; +                    sessionStatePtr_t joinSession = mNextAudioSession; +                    mNextAudioSession.reset(); +                    mIsProcessingChannels = true; +                    if (!runSession(joinSession)) //suspends +                    { +                        mIsProcessingChannels = false; +                        LL_DEBUGS("Voice") << "runSession returned false; leaving inner loop" << LL_ENDL; +                        break; +                    } +                    else +                    { +                        mIsProcessingChannels = false; +                        LL_DEBUGS("Voice") +                            << "runSession returned true to inner loop" +                            << " RelogRequested=" << mRelogRequested +                            << " VoiceEnabled=" << mVoiceEnabled +                            << LL_ENDL; +                    }                  } -                else +                catch (const LLCoros::Stop&) +                { +                    LL_DEBUGS("LLVivoxVoiceClient") << "Received a shutdown exception" << LL_ENDL; +                } +                catch (const LLContinueError&) +                { +                    LOG_UNHANDLED_EXCEPTION("LLVivoxVoiceClient"); +                } +                catch (...)                  { -                    mIsProcessingChannels = false; -                    LL_DEBUGS("Voice") -                        << "runSession returned true to inner loop" -                        << " RelogRequested=" << mRelogRequested -                        << " VoiceEnabled=" << mVoiceEnabled +                    // Ideally for Windows need to log SEH exception instead or to set SEH +                    // handlers but bugsplat shows local variables for windows, which should +                    // be enough +                    LL_WARNS("Voice") << "voiceControlStateMachine crashed in state VOICE_CHANNEL_STATE_PROCESS_CHANNEL" +                        << " mRelogRequested " << mRelogRequested +                        << " mVoiceEnabled " << mVoiceEnabled +                        << " mIsProcessingChannels " << mIsProcessingChannels +                        << " mProcessChannels " << mProcessChannels                          << LL_ENDL; +                    throw;                  }              } diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 14b4273b02..cfb15b42c4 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -1167,9 +1167,15 @@ void LLVOTree::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)      pos.load3(center.mV);      mDrawable->setPositionGroup(pos); -    LLFace* facep = mDrawable->getFace(0); -    facep->mExtents[0] = newMin; -    facep->mExtents[1] = newMax; +    if (mDrawable->getNumFaces() > 0) +    { +        LLFace* facep = mDrawable->getFace(0); +        if (facep) +        { +            facep->mExtents[0] = newMin; +            facep->mExtents[1] = newMax; +        } +    }  }  bool LLVOTree::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32 *face_hitp, diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 595021ab5b..3ea91447cc 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5901,7 +5901,23 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)                              {                                  if (gltf_mat != nullptr)                                  { -                                    add_face(sPbrFaces, pbr_count, facep); +                                    // In theory, we should never actually get here with alpha blending. +                                    // How this is supposed to work is we check if the surface is alpha blended, and we assign it to the +                                    // alpha draw pool. For rigged meshes, this apparently may not happen consistently. For now, just +                                    // discard it here if the alpha is 0 (fully transparent) to achieve parity with blinn-phong materials in +                                    // function. +                                    bool should_render = true; +                                    if (gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND) +                                    { +                                        if (gltf_mat->mBaseColor.mV[3] == 0.0f) +                                        { +                                            should_render = false; +                                        } +                                    } +                                    if (should_render) +                                    { +                                        add_face(sPbrFaces, pbr_count, facep); +                                    }                                  }                                  else                                  { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3e66ed1ab2..6bef6b3438 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -345,10 +345,22 @@ void validate_framebuffer_object();  // target -- RenderTarget to add attachments to  bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)  { +    U32 orm = GL_RGBA; +    U32 norm = GL_RGBA16F; +    U32 emissive = GL_RGB16F; + +    bool hdr = gSavedSettings.getBOOL("RenderHDREnabled") && gGLManager.mGLVersion > 4.05f; + +    if (!hdr) +    { +        norm = GL_RGBA; +        emissive = GL_RGB; +    } +      bool valid = true -        && target.addColorAttachment(GL_RGBA) // frag-data[1] specular OR PBR ORM -        && target.addColorAttachment(GL_RGBA16F)                              // frag_data[2] normal+fogmask, See: class1\deferred\materialF.glsl & softenlight -        && target.addColorAttachment(GL_RGB16F);                  // frag_data[3] PBR emissive OR material env intensity +        && target.addColorAttachment(orm)       // frag-data[1] specular OR PBR ORM +        && target.addColorAttachment(norm)      // frag_data[2] normal+fogmask, See: class1\deferred\materialF.glsl & softenlight +        && target.addColorAttachment(emissive); // frag_data[3] PBR emissive OR material env intensity      return valid;  } @@ -785,6 +797,9 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)  bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + +    bool hdr = gGLManager.mGLVersion > 4.05f && gSavedSettings.getBOOL("RenderHDREnabled"); +      if (mRT == &mMainRT)      { // hacky -- allocate auxillary buffer @@ -830,7 +845,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)      if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, true)) return false;      if (!addDeferredAttachments(mRT->deferredScreen)) return false; -    GLuint screenFormat = GL_RGBA16F; +    GLuint screenFormat = hdr ? GL_RGBA16F : GL_RGBA;      if (!mRT->screen.allocate(resX, resY, screenFormat)) return false; @@ -838,7 +853,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)      if (shadow_detail > 0 || ssao || RenderDepthOfField)      { //only need mRT->deferredLight for shadows OR ssao OR dof -        if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false; +        if (!mRT->deferredLight.allocate(resX, resY, screenFormat)) return false;      }      else      { @@ -872,22 +887,22 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)          }          //water reflection texture (always needed as scratch space whether or not transparent water is enabled) -        mWaterDis.allocate(resX, resY, GL_RGBA16F, true); +        mWaterDis.allocate(resX, resY, screenFormat, true);          if(RenderScreenSpaceReflections)          { -            mSceneMap.allocate(resX, resY, GL_RGBA16F, true); +            mSceneMap.allocate(resX, resY, screenFormat, true);          }          else          {              mSceneMap.release();          } -        mPostMap.allocate(resX, resY, GL_RGBA16F); +        mPostMap.allocate(resX, resY, screenFormat);          // used to scale down textures          // See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown -        mDownResMap.allocate(4, 4, GL_RGBA); +        mDownResMap.allocate(1024, 1024, GL_RGBA);          mBakeMap.allocate(LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH, LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT, GL_RGBA);      } @@ -1421,15 +1436,24 @@ void LLPipeline::createLUTBuffers()      mPbrBrdfLut.allocate(512, 512, GL_RG16F);      mPbrBrdfLut.bindTarget(); -    gDeferredGenBrdfLutProgram.bind(); - -    gGL.begin(LLRender::TRIANGLE_STRIP); -    gGL.vertex2f(-1, -1); -    gGL.vertex2f(-1, 1); -    gGL.vertex2f(1, -1); -    gGL.vertex2f(1, 1); -    gGL.end(); -    gGL.flush(); + +    if (gDeferredGenBrdfLutProgram.isComplete()) +    { +        gDeferredGenBrdfLutProgram.bind(); +        llassert_always(LLGLSLShader::sCurBoundShaderPtr != nullptr); + +        gGL.begin(LLRender::TRIANGLE_STRIP); +        gGL.vertex2f(-1, -1); +        gGL.vertex2f(-1, 1); +        gGL.vertex2f(1, -1); +        gGL.vertex2f(1, 1); +        gGL.end(); +        gGL.flush(); +    } +    else +    { +        LL_WARNS("Brad") << gDeferredGenBrdfLutProgram.mName << " failed to load, cannot be used!" << LL_ENDL; +    }      gDeferredGenBrdfLutProgram.unbind();      mPbrBrdfLut.flush(); @@ -4073,6 +4097,13 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)          LLGLState::checkStates(GL_FALSE);      } +    // turn off atmospherics and water haze for low detail reflection probe +    static LLCachedControl<S32> probe_level(gSavedSettings, "RenderReflectionProbeLevel", 0); +    bool low_detail_probe = probe_level == 0 && gCubeSnapshot; +    done_atmospherics = done_atmospherics || low_detail_probe; +    done_water_haze   = done_water_haze || low_detail_probe; + +      while ( iter1 != mPools.end() )      {          LLDrawPool *poolp = *iter1; @@ -7853,15 +7884,20 @@ void LLPipeline::renderFinalize()      gGL.setColorMask(true, true);      glClearColor(0, 0, 0, 0); -    copyScreenSpaceReflections(&mRT->screen, &mSceneMap); +    bool hdr = gGLManager.mGLVersion > 4.05f && gSavedSettings.getBOOL("RenderHDREnabled"); -    generateLuminance(&mRT->screen, &mLuminanceMap); +    if (hdr) +    { +        copyScreenSpaceReflections(&mRT->screen, &mSceneMap); -    generateExposure(&mLuminanceMap, &mExposureMap); +        generateLuminance(&mRT->screen, &mLuminanceMap); -    tonemap(&mRT->screen, &mPostMap); +        generateExposure(&mLuminanceMap, &mExposureMap); -    applyCAS(&mPostMap, &mRT->screen); +        tonemap(&mRT->screen, &mPostMap); + +        applyCAS(&mPostMap, &mRT->screen); +    }      generateSMAABuffers(&mRT->screen); @@ -8463,8 +8499,9 @@ void LLPipeline::renderDeferredLighting()          }          static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256); +        static LLCachedControl<S32> probe_level(gSavedSettings, "RenderReflectionProbeLevel", 0); -        if (local_light_count > 0) +        if (local_light_count > 0 && (!gCubeSnapshot || probe_level > 0))          {              gGL.setSceneBlendType(LLRender::BT_ADD);              std::list<LLVector4>        fullscreen_lights; diff --git a/indra/newview/skins/default/xui/en/floater_material_editor.xml b/indra/newview/skins/default/xui/en/floater_material_editor.xml index a6a401f43e..21ceeafeea 100644 --- a/indra/newview/skins/default/xui/en/floater_material_editor.xml +++ b/indra/newview/skins/default/xui/en/floater_material_editor.xml @@ -13,9 +13,6 @@   title="[MATERIAL_NAME]">    <string name="no_upload_fee_string">no upload fee</string>    <string name="upload_fee_string">L$[FEE] upload fee</string> -  <string name="material_selection_title">Material selection</string> -  <string name="material_selection_text">Select material:</string> -  <string name="material_batch_import_text">--- Bulk Upload All ---</string>    <string name="material_override_title">Editing Material</string>    <scroll_container diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2d04b3e0fe..f0a26f9c56 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4312,6 +4312,9 @@ name="Command_360_Capture_Tooltip">Capture a 360 equirectangular image</string>    <!-- PBR Materials -->    <string name="Material Texture Name Header">Textures present this material: </string> +  <string name="material_selection_title">Material selection</string> +  <string name="material_selection_text">Select material:</string> +  <string name="material_batch_import_text">--- Bulk Upload All ---</string>    <!-- Conversation log messages -->    <string name="logging_calls_disabled_log_empty"> diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index b2f9654eb3..f9aaeabbfb 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -502,30 +502,34 @@ class Windows_x86_64_Manifest(ViewerManifest):          if self.is_packaging_viewer():              # Find secondlife-bin.exe in the 'configuration' dir, then rename it to the result of final_exe.              self.path(src='%s/secondlife-bin.exe' % self.args['configuration'], dst=self.final_exe()) -            # Emit the whole app image as one of the GitHub step outputs. We -            # want the whole app -- but NOT the extraneous build products that -            # get tossed into the same directory, such as the installer and -            # the symbols tarball, so add exclusions. When we feed -            # upload-artifact multiple absolute pathnames, even just for -            # exclusion, it ends up creating several extraneous directory -            # levels within the artifact -- so try using only relative paths. -            # One problem: as of right now, our current directory os.getcwd() -            # is not the same as the initial working directory for this job -            # step, meaning paths relative to our os.getcwd() won't work for -            # the subsequent upload-artifact step. We're a couple directory -            # levels down. Try adjusting for those when specifying the base -            # for self.relpath(). -            appbase = self.relpath( -                self.get_dst_prefix(), -                base=os.path.join(os.getcwd(), os.pardir, os.pardir)) -            self.set_github_output('viewer_app', appbase, -                                   # except for this stuff -                                   *(('!' + os.path.join(appbase, pattern)) -                                     for pattern in ( -                                             'secondlife-bin.*', -                                             '*_Setup.exe', -                                             '*.bat', -                                             '*.tar.xz'))) + +            GITHUB_OUTPUT = os.getenv('GITHUB_OUTPUT') +            if GITHUB_OUTPUT: +                # Emit the whole app image as one of the GitHub step outputs. We +                # want the whole app -- but NOT the extraneous build products that +                # get tossed into the same directory, such as the installer and +                # the symbols tarball, so add exclusions. When we feed +                # upload-artifact multiple absolute pathnames, even just for +                # exclusion, it ends up creating several extraneous directory +                # levels within the artifact -- so try using only relative paths. +                # One problem: as of right now, our current directory os.getcwd() +                # is not the same as the initial working directory for this job +                # step, meaning paths relative to our os.getcwd() won't work for +                # the subsequent upload-artifact step. We're a couple directory +                # levels down. Try adjusting for those when specifying the base +                # for self.relpath(). +                appbase = self.relpath( +                    self.get_dst_prefix(), +                    base=os.path.join(os.getcwd(), os.pardir, os.pardir), +                    symlink=True) +                self.set_github_output('viewer_app', appbase, +                                    # except for this stuff +                                    *(('!' + os.path.join(appbase, pattern)) +                                        for pattern in ( +                                                'secondlife-bin.*', +                                                '*_Setup.exe', +                                                '*.bat', +                                                '*.tar.xz')))              with self.prefix(src=os.path.join(pkgdir, "VMP")):                  # include the compiled launcher scripts so that it gets included in the file_list | 
