diff options
| author | Erik Kundiman <erik@megapahit.org> | 2024-12-01 18:56:45 +0800 | 
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2024-12-01 18:56:45 +0800 | 
| commit | fda6acb4be1145ac1dc6c33859d8a65dcfa8aecb (patch) | |
| tree | 3eefe5eaa1415dc32b78d3125754801400dd7212 /indra | |
| parent | 99337674245aca9b01a4346b7f6bd5822c119168 (diff) | |
| parent | c02baded8464781fcb208676610727e677ac6907 (diff) | |
Merge remote-tracking branch 'secondlife/release/2024.09-ExtraFPS' into 2024.09-ExtraFPS
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llinventory/llsettingssky.cpp | 8 | ||||
| -rw-r--r-- | indra/llinventory/llsettingssky.h | 1 | ||||
| -rw-r--r-- | indra/newview/llmodelpreview.cpp | 43 | ||||
| -rw-r--r-- | indra/newview/llmodelpreview.h | 4 | ||||
| -rw-r--r-- | indra/newview/llsettingsvo.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 2 | 
6 files changed, 46 insertions, 18 deletions
| diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a9b83657b7..45396ce9c7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -2065,6 +2065,14 @@ F32 LLSettingsSky::getTonemapMix() const      return mTonemapMix;  } +void LLSettingsSky::setTonemapMix(F32 mix) +{ +    if (mCanAutoAdjust) +        return; + +    mTonemapMix = mix; +} +  void LLSettingsSky::setGamma(F32 val)  {      mGamma = val; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 8d73c35ff3..4c635fd946 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -213,6 +213,7 @@ public:      F32 getHDRMax() const;      F32 getHDROffset() const;      F32 getTonemapMix() const; +    void setTonemapMix(F32 mix);      void setGamma(F32 val); diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index e04262715d..64ea1710f5 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -555,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, &mCallbackTextureList, false); +                            texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, new LLHandle<LLModelPreview>(getHandle()), &mCallbackTextureList, false);                              texture->forceToSaveRawImage(0, F32_MAX);                              texture->updateFetch();                              if (mModelLoader) @@ -784,6 +784,10 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable      std::map<std::string, std::string> joint_alias_map;      getJointAliases(joint_alias_map); +    LLHandle<LLModelPreview> preview_handle = getHandle(); +    auto load_textures_cb = +            [preview_handle](LLImportMaterial& material, void* opaque) { return LLModelPreview::loadTextures(material, preview_handle); }; +      // three possible file extensions, .dae .gltf .glb      // check for .dae and if not then assume one of the .gl??      std::string filename_lc(filename); @@ -795,7 +799,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable              lod,              &LLModelPreview::loadedCallback,              &LLModelPreview::lookupJointByName, -            &LLModelPreview::loadTextures, +            load_textures_cb,              &LLModelPreview::stateChangedCallback,              this,              mJointTransformMap, @@ -812,7 +816,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable              lod,              &LLModelPreview::loadedCallback,              &LLModelPreview::lookupJointByName, -            &LLModelPreview::loadTextures, +            load_textures_cb,              &LLModelPreview::stateChangedCallback,              this,              mJointTransformMap, @@ -3130,9 +3134,9 @@ LLJoint* LLModelPreview::lookupJointByName(const std::string& str, void* opaque)      return NULL;  } -U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque) +U32 LLModelPreview::loadTextures(LLImportMaterial& material, LLHandle<LLModelPreview> handle)  { -    if (material.mDiffuseMapFilename.size()) +    if (material.mDiffuseMapFilename.size() && !handle.isDead())      {          material.mOpaqueData = new LLPointer< LLViewerFetchedTexture >;          LLPointer< LLViewerFetchedTexture >& tex = (*reinterpret_cast< LLPointer< LLViewerFetchedTexture > * >(material.mOpaqueData)); @@ -3143,10 +3147,8 @@ U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque)              // file was loaded previosly, reload image to get potential changes              tex->clearFetchedResults();          } -        // Todo: might cause a crash if preview gets closed before we get the callback. -        // Use a callback list or guard callback in some way -        LLModelPreview* preview = (LLModelPreview*)opaque; -        tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, &preview->mCallbackTextureList, false); +        LLModelPreview* preview = (LLModelPreview*)handle.get(); +        tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, new LLHandle<LLModelPreview>(handle), &preview->mCallbackTextureList, false);          tex->forceToSaveRawImage(0, F32_MAX);          material.setDiffuseMap(tex->getID()); // record tex ID          return 1; @@ -4019,16 +4021,29 @@ void LLModelPreview::textureLoadedCallback(      bool final,      void* userdata)  { -    LLModelPreview* preview = (LLModelPreview*)userdata; -    preview->refresh(); +    if (!userdata) +        return; + +    LLHandle<LLModelPreview>* handle = (LLHandle<LLModelPreview>*)userdata; -    if (final && preview->mModelLoader) +    if (!handle->isDead())      { -        if (preview->mModelLoader->mNumOfFetchingTextures > 0) +        LLModelPreview* preview = static_cast<LLModelPreview*>(handle->get()); +        preview->refresh(); + +        if (final && preview->mModelLoader)          { -            preview->mModelLoader->mNumOfFetchingTextures--; +            if (preview->mModelLoader->mNumOfFetchingTextures > 0) +            { +                preview->mModelLoader->mNumOfFetchingTextures--; +            }          }      } + +    if (final || !success) +    { +        delete handle; +    }  }  // static diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index e236d7ced7..0873263587 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -111,7 +111,7 @@ static const std::string lod_label_name[NUM_LOD + 1] =      "I went off the end of the lod_label_name array.  Me so smart."  }; -class LLModelPreview : public LLViewerDynamicTexture, public LLMutex +class LLModelPreview : public LLViewerDynamicTexture, public LLMutex, public LLHandleProvider<LLModelPreview>  {      LOG_CLASS(LLModelPreview); @@ -211,7 +211,7 @@ protected:      static void         stateChangedCallback(U32 state, void* opaque);      static LLJoint* lookupJointByName(const std::string&, void* opaque); -    static U32          loadTextures(LLImportMaterial& material, void* opaque); +    static U32          loadTextures(LLImportMaterial& material, LLHandle<LLModelPreview> handle);      void lookupLODModelFiles(S32 lod); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index b1bef4c4d8..836b181623 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -804,10 +804,16 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)      static LLCachedControl<F32> sunlight_scale(gSavedSettings, "RenderSkySunlightScale", 1.5f);      static LLCachedControl<F32> sunlight_hdr_scale(gSavedSettings, "RenderHDRSkySunlightScale", 1.5f);      static LLCachedControl<F32> ambient_scale(gSavedSettings, "RenderSkyAmbientScale", 1.5f); +    static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f);      // sky is a "classic" sky following pre SL 7.0 shading      bool classic_mode = psky->canAutoAdjust(); +    if (!classic_mode) +    { +        psky->setTonemapMix(tonemap_mix_setting); +    } +      shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, hdr ? sunlight_hdr_scale : sunlight_scale);      shader->uniform1f(LLShaderMgr::SKY_AMBIENT_SCALE, ambient_scale);      shader->uniform1i(LLShaderMgr::CLASSIC_MODE, classic_mode); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0723f736b2..2b941bce5a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7192,8 +7192,6 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)          static LLCachedControl<U32> tonemap_type_setting(gSavedSettings, "RenderTonemapType", 0U);          shader.uniform1i(tonemap_type, tonemap_type_setting); - -        static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f);          shader.uniform1f(tonemap_mix, psky->getTonemapMix());          mScreenTriangleVB->setBuffer(); | 
