# Conflicts:
#	indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
master
Ansariel 2023-10-01 18:18:17 +02:00
commit c12c377c61
16 changed files with 78 additions and 52 deletions

View File

@ -833,7 +833,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data)
}
const LLSD& ds = data["ds"];
if (data.isBoolean())
if (ds.isBoolean())
{
mDoubleSided = ds.asBoolean();
mOverrideDoubleSided = true;

View File

@ -58,7 +58,7 @@ U32 wpo2(U32 i);
// texture memory accounting (for OS X)
static LLMutex sTexMemMutex;
static std::unordered_map<U32, U32> sTextureAllocs;
static std::unordered_map<U32, U64> sTextureAllocs;
static U64 sTextureBytes = 0;
// track a texture alloc on the currently bound texture.
@ -67,7 +67,7 @@ static void alloc_tex_image(U32 width, U32 height, U32 pixformat)
{
U32 texUnit = gGL.getCurrentTexUnitIndex();
U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture();
S32 size = LLImageGL::dataFormatBytes(pixformat, width, height);
U64 size = LLImageGL::dataFormatBytes(pixformat, width, height);
llassert(size >= 0);
@ -296,7 +296,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
}
//static
S32 LLImageGL::dataFormatBytes(S32 dataformat, S32 width, S32 height)
S64 LLImageGL::dataFormatBytes(S32 dataformat, S32 width, S32 height)
{
switch (dataformat)
{
@ -312,8 +312,8 @@ S32 LLImageGL::dataFormatBytes(S32 dataformat, S32 width, S32 height)
default:
break;
}
S32 bytes ((width*height*dataFormatBits(dataformat)+7)>>3);
S32 aligned = (bytes+3)&~3;
S64 bytes (((S64)width * (S64)height * (S64)dataFormatBits(dataformat)+7)>>3);
S64 aligned = (bytes+3)&~3;
return aligned;
}
@ -518,7 +518,7 @@ void LLImageGL::init(BOOL usemipmaps)
// so that it is obvious by visual inspection if we forgot to
// init a field.
mTextureMemory = (S32Bytes)0;
mTextureMemory = S64Bytes(0);
mLastBindTime = 0.f;
mPickMask = NULL;
@ -1744,7 +1744,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
}
mTextureMemory = (S32Bytes)getMipBytes(mCurrentDiscardLevel);
mTextureMemory = (S64Bytes)getMipBytes(mCurrentDiscardLevel);
mTexelsInGLTexture = getWidth() * getHeight();
// mark this as bound at this point, so we don't throw it out immediately
@ -1938,9 +1938,9 @@ void LLImageGL::destroyGLTexture()
if (mTexName != 0)
{
if(mTextureMemory != S32Bytes(0))
if(mTextureMemory != S64Bytes(0))
{
mTextureMemory = (S32Bytes)0;
mTextureMemory = (S64Bytes)0;
}
LLImageGL::deleteTextures(1, &mTexName);
@ -2036,7 +2036,7 @@ S32 LLImageGL::getWidth(S32 discard_level) const
return width;
}
S32 LLImageGL::getBytes(S32 discard_level) const
S64 LLImageGL::getBytes(S32 discard_level) const
{
if (discard_level < 0)
{
@ -2049,7 +2049,7 @@ S32 LLImageGL::getBytes(S32 discard_level) const
return dataFormatBytes(mFormatPrimary, w, h);
}
S32 LLImageGL::getMipBytes(S32 discard_level) const
S64 LLImageGL::getMipBytes(S32 discard_level) const
{
if (discard_level < 0)
{
@ -2057,7 +2057,7 @@ S32 LLImageGL::getMipBytes(S32 discard_level) const
}
S32 w = mWidth>>discard_level;
S32 h = mHeight>>discard_level;
S32 res = dataFormatBytes(mFormatPrimary, w, h);
S64 res = dataFormatBytes(mFormatPrimary, w, h);
if (mUseMipMaps)
{
while (w > 1 && h > 1)

View File

@ -65,7 +65,7 @@ public:
// Size calculation
static S32 dataFormatBits(S32 dataformat);
static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height);
static S64 dataFormatBytes(S32 dataformat, S32 width, S32 height);
static S32 dataFormatComponents(S32 dataformat);
BOOL updateBindStats() const ;
@ -145,8 +145,8 @@ public:
S32 getWidth(S32 discard_level = -1) const;
S32 getHeight(S32 discard_level = -1) const;
U8 getComponents() const { return mComponents; }
S32 getBytes(S32 discard_level = -1) const;
S32 getMipBytes(S32 discard_level = -1) const;
S64 getBytes(S32 discard_level = -1) const;
S64 getMipBytes(S32 discard_level = -1) const;
BOOL getBoundRecently() const;
BOOL isJustBound() const;
BOOL getHasExplicitFormat() const { return mHasExplicitFormat; }
@ -211,7 +211,7 @@ public:
public:
// Various GL/Rendering options
S32Bytes mTextureMemory;
S64Bytes mTextureMemory;
mutable F32 mLastBindTime; // last time this was bound, by discard level
private:

View File

@ -495,10 +495,12 @@ void LLFloaterEnvironmentAdjust::updateGammaLabel()
if (ambiance != 0.f)
{
childSetValue("scene_gamma_label", getString("hdr_string"));
getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->setToolTip(getString("hdr_tooltip"));
}
else
{
childSetValue("scene_gamma_label", getString("brightness_string"));
getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->setToolTip(std::string());
}
}

View File

@ -1191,6 +1191,9 @@ void LLFloaterTools::onClose(bool app_quitting)
// hide the advanced object weights floater
LLFloaterReg::hideInstance("object_weights");
// hide gltf material editor
LLFloaterReg::hideInstance("live_material_editor");
// prepare content for next call
mPanelContents->clearContents();

View File

@ -357,20 +357,25 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
const LLSD& tes = data["te"];
const LLSD& od = data["od"];
if (tes.isArray())
{
constexpr U32 MAX_TES = 45;
bool has_te[MAX_TES] = { false };
if (tes.isArray()) // NOTE: if no "te" array exists, this is a malformed message (null out all overrides will come in as an empty te array)
{
LLGLTFOverrideCacheEntry cache;
cache.mLocalId = local_id;
cache.mObjectId = id;
cache.mRegionHandle = region->getHandle();
for (int i = 0; i < tes.size(); ++i)
U32 count = llmin(tes.size(), MAX_TES);
for (U32 i = 0; i < count; ++i)
{
LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership
mat->applyOverrideLLSD(od[i]);
S32 te = tes[i].asInteger();
has_te[te] = true;
cache.mSides[te] = od[i];
cache.mGLTFMaterial[te] = mat;
@ -384,6 +389,20 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
}
}
if (obj)
{ // null out overrides on TEs that shouldn't have them
U32 count = llmin(obj->getNumTEs(), MAX_TES);
for (U32 i = 0; i < count; ++i)
{
LLTextureEntry* te = obj->getTE(i);
if (!has_te[i] && te && te->getGLTFMaterialOverride())
{
obj->setTEGLTFMaterialOverride(i, nullptr);
handle_gltf_override_message.doSelectionCallbacks(id, i);
}
}
}
region->cacheFullUpdateGLTFOverride(cache);
}

View File

@ -415,9 +415,6 @@ BOOL LLMaterialEditor::postBuild()
if (mIsOverride)
{
// Material override change success callback
LLGLTFMaterialList::addSelectionUpdateCallback(&LLMaterialEditor::updateLive);
// Live editing needs a recovery mechanism on cancel
mBaseColorTextureCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_BASE_COLOR_TEX_DIRTY));
mMetallicTextureCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY));
@ -545,12 +542,6 @@ void LLMaterialEditor::draw()
{
if (mIsOverride)
{
bool selection_empty = LLSelectMgr::getInstance()->getSelection()->isEmpty();
if (selection_empty && mHasSelection)
{
mSelectionNeedsUpdate = true;
}
if (mSelectionNeedsUpdate)
{
mSelectionNeedsUpdate = false;
@ -1793,22 +1784,6 @@ void LLMaterialEditor::updateLive()
mOverrideInProgress = false;
}
void LLMaterialEditor::updateLive(const LLUUID &object_id, S32 te)
{
if (mOverrideObjectId != object_id
|| mOverrideObjectTE != te)
{
// Ignore if waiting for override,
// if not waiting, mark selection dirty
mSelectionNeedsUpdate |= !mOverrideInProgress;
return;
}
// update for currently displayed object and face
mSelectionNeedsUpdate = true;
mOverrideInProgress = false;
}
void LLMaterialEditor::loadLive()
{
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("live_material_editor");
@ -2830,7 +2805,7 @@ public:
// something went wrong update selection
LLMaterialEditor::updateLive();
}
// else we will get updateLive(obj, id) from applied overrides
// else we will get updateLive() from panel face
}
bool getResult() { return mSuccess; }

View File

@ -110,7 +110,6 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener
void onSelectionChanged(); // live overrides selection changes
static void updateLive();
static void updateLive(const LLUUID &object_id, S32 te);
static void loadLive();
static bool canModifyObjectsMaterial();

View File

@ -342,10 +342,12 @@ void LLPanelSettingsSkyAtmosTab::updateGammaLabel(bool auto_adjust)
if (ambiance != 0.f)
{
childSetValue("scene_gamma_label", getString("hdr_string"));
getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->setToolTip(getString("hdr_tooltip"));
}
else
{
childSetValue("scene_gamma_label", getString("brightness_string"));
getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->setToolTip(std::string());
}
}

View File

@ -631,6 +631,7 @@ void LLPanelFace::draw()
if (sMaterialOverrideSelection.update())
{
setMaterialOverridesFromSelection();
LLMaterialEditor::updateLive();
}
}
@ -1179,6 +1180,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec);
static S32 selected_te = -1;
static LLUUID prev_obj_id;
if ((LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()) &&
!LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected())
{
@ -1193,7 +1195,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
}
}
if (new_selection != selected_te)
if ((new_selection != selected_te)
|| (prev_obj_id != objectp->getID()))
{
bool te_has_media = objectp->getTE(new_selection) && objectp->getTE(new_selection)->hasMedia();
bool te_has_pbr = objectp->getRenderMaterialID(new_selection).notNull();
@ -1211,6 +1214,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
}
selected_te = new_selection;
prev_obj_id = objectp->getID();
}
}

View File

@ -2286,8 +2286,16 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item)
return mDropCallback(this, item);
}
// no callback installed, so just set the image ids and carry on.
setImageAssetID( item->getAssetUUID() );
// no callback installed, so just set the image ids and carry on.
LLUUID asset_id = item->getAssetUUID();
if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL && asset_id.isNull())
{
// If an inventory material has a null asset, consider it a valid blank material(gltf)
asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID;
}
setImageAssetID(asset_id);
mImageItemID = item->getUUID();
return TRUE;
}

View File

@ -563,9 +563,12 @@ void LLViewerTexture::updateClass()
static LLCachedControl<U32> max_vram_budget(gSavedSettings, "RenderMaxVRAMBudget", 0);
F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0;
F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 512.0;
// get an estimate of how much video memory we're using
// NOTE: our metrics miss about half the vram we use, so this biases high but turns out to typically be within 5% of the real number
F32 used = (LLImageGL::getTextureBytesAllocated() + LLVertexBuffer::getBytesAllocated()) / 1024 / 512;
F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc);
F32 budget = max_vram_budget == 0 ? gGLManager.mVRAM : max_vram_budget;

View File

@ -6,6 +6,9 @@
<string name="brightness_string">
Helligkeit:
</string>
<string name="hdr_tooltip">
Intensität von von Belichtungseffekten wie realistischer strahlender Himmel und dynamische Belichtung. 1.0 ist Standard, 0 ist aus, Werte zwuschen 0 und 1 mischen Umgebung mit HDR.
</string>
<layout_stack name="outer_stack">
<layout_panel name="env_controls">
<layout_stack name="settings_stack">
@ -49,6 +52,7 @@
<text name="reflection_probe_ambiance_label">
Reflexionstest Umgebung:
</text>
<slider name="probe_ambiance" tool_tip="Intensität von umgebungsbasierter indirekter Beleuchtung. Bei 0 HDR wird die Skala zu Helligkeit."/>
<text name="scene_gamma_label">
Helligkeit:
</text>

View File

@ -6,6 +6,9 @@
<string name="brightness_string">
Helligkeit:
</string>
<string name="hdr_tooltip">
Intensität von von Belichtungseffekten wie realistischer strahlender Himmel und dynamische Belichtung. 1.0 ist Standard, 0 ist aus, Werte zwuschen 0 und 1 mischen Umgebung mit HDR.
</string>
<layout_stack name="main_ls">
<layout_panel name="top_lp">
<text name="ambient_color_label">
@ -53,7 +56,7 @@
<text name="probe_ambiance_label" tool_tip="Strahlungsintensität. Aktiviert HDR-Beleuchtungsmodell, falls nicht 0." width="120">
Umgebung Reflexionstest (HDR):
</text>
<slider name="probe_ambiance" width="187"/>
<slider name="probe_ambiance" tool_tip="Intensität von umgebungsbasierter indirekter Beleuchtung. Bei 0 HDR wird die Skala zu Helligkeit." width="187"/>
<text name="scene_gamma_label" width="120">
Helligkeit:
</text>

View File

@ -12,6 +12,7 @@
can_resize="false">
<string name="hdr_string">HDR Scale:</string>
<string name="brightness_string">Brightness:</string>
<string name="hdr_tooltip">Intensity of lightning effects such as realistically bright skies and dynamic exposure. 1.0 is the default, 0 is off, values between 0 and 1 are mixing Ambient with HDR.</string>
<layout_stack name="outer_stack"
width="845"
height="275"
@ -264,6 +265,7 @@
min_val="0"
max_val="10"
name="probe_ambiance"
tool_tip="Intensity of environment based indirect lighting. At zero HDR scale becomes Brightness"
top_pad="5"
width="185"
can_edit_text="true"/>

View File

@ -9,6 +9,7 @@
top="0">
<string name="hdr_string">HDR Scale:</string>
<string name="brightness_string">Brightness:</string>
<string name="hdr_tooltip">Intensity of lightning effects such as realistically bright skies and dynamic exposure. 1.0 is the default, 0 is off, values between 0 and 1 are mixing Ambient with HDR.</string>
<layout_stack
name="main_ls"
follows="all"
@ -334,6 +335,7 @@
min_val="0"
max_val="10"
name="probe_ambiance"
tool_tip="Intensity of environment based indirect lighting. At zero HDR scale becomes Brightness"
top_delta="3"
width="219"
can_edit_text="true"/>