Another port of a great patch from CoolViewer that lets users set the maximum number of actual visible avatars when impostors are on.

This commit is contained in:
Player Dagostino
2011-08-02 20:01:20 +02:00
parent 5009b0544e
commit 3b168065d5
7 changed files with 111 additions and 32 deletions

View File

@@ -47,27 +47,25 @@
#include "pipeline.h"
LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL;
BOOL LLFloaterHardwareSettings::sUseStreamVBOexists = FALSE;
LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater(std::string("Hardware Settings Floater"))
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml");
// load it up
initCallbacks();
}
LLFloaterHardwareSettings::~LLFloaterHardwareSettings()
{
}
void LLFloaterHardwareSettings::onClickHelp(void* data)
{
const char* xml_alert = "HardwareSettingsHelpButton";
LLNotifications::instance().add(xml_alert);
}
void LLFloaterHardwareSettings::initCallbacks(void)
void LLFloaterHardwareSettings::onCommitCheckBoxVBO(LLUICtrl* ctrl, void* user_data)
{
LLFloaterHardwareSettings* self = (LLFloaterHardwareSettings*)user_data;
if (self && sUseStreamVBOexists)
{
gSavedSettings.setBOOL("RenderUseStreamVBO", self->childGetValue("stream_vbo").asBoolean());
self->refreshEnabledState();
}
}
// menu maintenance functions
@@ -77,6 +75,10 @@ void LLFloaterHardwareSettings::refresh()
LLPanel::refresh();
mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable");
if (sUseStreamVBOexists)
{
mUseStreamVBO = gSavedSettings.getBOOL("RenderUseStreamVBO");
}
mUseFBO = gSavedSettings.getBOOL("RenderUseFBO");
mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic");
mFSAASamples = gSavedSettings.getU32("RenderFSAASamples");
@@ -96,6 +98,7 @@ void LLFloaterHardwareSettings::refreshEnabledState()
childSetMinValue("GrapicsCardTextureMemory", min_tex_mem);
childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem);
bool vbo_ok = true;
mLastVBOState = LLVertexBuffer::sEnableVBOs;
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") ||
!gGLManager.mHasVertexBufferObject)
@@ -103,6 +106,23 @@ void LLFloaterHardwareSettings::refreshEnabledState()
childSetEnabled("vbo", FALSE);
//Streaming VBOs -Shyotl
childSetEnabled("vbo_stream", FALSE);
vbo_ok = false;
}
if (sUseStreamVBOexists)
{
childSetVisible("stream_vbo", true);
childSetEnabled("stream_vbo", vbo_ok && childGetValue("vbo") &&
LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseStreamVBO"));
}
else
{
childSetVisible("stream_vbo", false);
}
if (!LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion"))
{
childSetEnabled("occlusion", false);
}
else
{
@@ -115,7 +135,7 @@ void LLFloaterHardwareSettings::refreshEnabledState()
childSetEnabled("gamma", !gPipeline.canUseWindLightShaders());
childSetEnabled("(brightness, lower is brighter)", !gPipeline.canUseWindLightShaders());
childSetEnabled("fog", !gPipeline.canUseWindLightShaders());
childSetVisible("note", gPipeline.canUseWindLightShaders());
}
// static instance of it
@@ -173,6 +193,13 @@ BOOL LLFloaterHardwareSettings::postBuild()
{
childSetAction("OK", onBtnOK, this);
sUseStreamVBOexists = gSavedSettings.controlExists("RenderUseStreamVBO");
if (sUseStreamVBOexists)
{
childSetCommitCallback("vbo", onCommitCheckBoxVBO, this);
childSetCommitCallback("stream_vbo", onCommitCheckBoxVBO, this);
}
refresh();
return TRUE;
@@ -202,6 +229,10 @@ void LLFloaterHardwareSettings::apply()
void LLFloaterHardwareSettings::cancel()
{
gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO);
if (sUseStreamVBOexists)
{
gSavedSettings.setBOOL("RenderUseStreamVBO", mUseStreamVBO);
}
gSavedSettings.setBOOL("RenderUseFBO", mUseFBO);
gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso);
gSavedSettings.setU32("RenderFSAASamples", mFSAASamples);

View File

@@ -49,14 +49,11 @@ public:
virtual BOOL postBuild();
/// initialize all the callbacks for the menu
void initCallbacks(void);
/// one and one instance only
static LLFloaterHardwareSettings* instance();
/// callback for the menus help button
static void onClickHelp(void* data);
/// callback for the VBO-related settings checkboxes
static void onCommitCheckBoxVBO(LLUICtrl* ctrl, void* user_data);
/// OK button
static void onBtnOK( void* userdata );
@@ -87,11 +84,12 @@ public:
/// refresh the enabled values
void refreshEnabledState();
protected:
private:
LLSliderCtrl* mCtrlVideoCardMem;
//Retained values for cancel/reset
BOOL mUseVBO;
BOOL mUseStreamVBO;
BOOL mUseFBO;
BOOL mUseAniso;
U32 mFSAASamples;
@@ -101,9 +99,9 @@ protected:
BOOL mProbeHardwareOnStartup;
bool mLastVBOState; //track changes to LLVertexBuffer::sEnableVBOs every frame. Bleh.
private:
// one instance on the inside
static LLFloaterHardwareSettings* sHardwareSettings;
static BOOL sUseStreamVBOexists;
};
#endif

View File

@@ -260,6 +260,9 @@ BOOL LLPanelDisplay::postBuild()
// Avatar Render Mode
mCtrlAvatarCloth = getChild<LLCheckBoxCtrl>("AvatarCloth");
mCtrlAvatarImpostors = getChild<LLCheckBoxCtrl>("AvatarImpostors");
mCtrlAvatarImpostors->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable);
mCtrlAvatarImpostors->setCallbackUserData(this);
mCtrlNonImpostors = getChild<LLSliderCtrl>("AvatarMaxVisible");
//----------------------------------------------------------------------------
// radio set for lighting detail
@@ -417,6 +420,7 @@ void LLPanelDisplay::refresh()
// avatar settings
mAvatarImpostors = gSavedSettings.getBOOL("RenderUseImpostors");
mNonImpostors = gSavedSettings.getS32("RenderAvatarMaxVisible");
mAvatarCloth = gSavedSettings.getBOOL("RenderAvatarCloth");
// Draw distance
@@ -514,6 +518,9 @@ void LLPanelDisplay::refreshEnabledState()
//GI won't do anything with shadows off, but disabling it here is less than intuitive. Ignore shadow setting for now.
mCtrlDeferredGI->setEnabled(mCtrlShadowDetail->getEnabled()/* && gSavedSettings.getS32("RenderShadowDetail") > 0*/);
// Disable max non-impostors slider if avatar impostors are off
mCtrlNonImpostors->setEnabled(gSavedSettings.getBOOL("RenderUseImpostors"));
// Vertex Shaders
// mCtrlShaderEnable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"));
// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0a
@@ -612,6 +619,7 @@ void LLPanelDisplay::disableUnavailableSettings()
{
mCtrlAvatarImpostors->setEnabled(FALSE);
mCtrlAvatarImpostors->setValue(FALSE);
mCtrlNonImpostors->setEnabled(FALSE);
}
// disabled deferred
if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred"))
@@ -654,6 +662,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden)
llassert(mCtrlAvatarVP != NULL);
llassert(mCtrlShaderEnable != NULL);
llassert(mCtrlAvatarImpostors != NULL);
llassert(mCtrlNonImpostors != NULL);
llassert(mCtrlAvatarCloth != NULL);
llassert(mRadioLightingDetail2 != NULL);
@@ -702,6 +711,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden)
mCtrlAvatarVP->setVisible(!isHidden);
mCtrlShaderEnable->setVisible(!isHidden);
mCtrlAvatarImpostors->setVisible(!isHidden);
mCtrlNonImpostors->setVisible(!isHidden);
mCtrlAvatarCloth->setVisible(!isHidden);
mRadioLightingDetail2->setVisible(!isHidden);
@@ -752,6 +762,7 @@ void LLPanelDisplay::cancel()
gSavedSettings.setS32("RenderShadowDetail", mShadowDetail);
gSavedSettings.setBOOL("RenderUseImpostors", mAvatarImpostors);
gSavedSettings.setS32("RenderAvatarMaxVisible", mNonImpostors);
gSavedSettings.setBOOL("RenderAvatarCloth", mAvatarCloth);
gSavedSettings.setBOOL("RenderLocalLights", mLocalLights);
@@ -994,6 +1005,11 @@ void LLPanelDisplay::onVertexShaderEnable(LLUICtrl* self, void* data)
void LLPanelDisplay::setHardwareDefaults(void* user_data)
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
LLControlVariable* controlp = gSavedSettings.getControl("RenderAvatarMaxVisible");
if (controlp)
{
controlp->resetToDefault(true);
}
LLFloaterPreference::refreshEnabledGraphics();
}

View File

@@ -106,6 +106,7 @@ protected:
LLSliderCtrl *mCtrlSkyFactor; // LOD for terrain
LLSliderCtrl *mCtrlMaxParticle; // Max Particle
LLSliderCtrl *mCtrlPostProcess; // Max Particle
LLSliderCtrl *mCtrlNonImpostors; // Max non-impostors
LLCheckBoxCtrl *mCtrlBumpShiny;
LLCheckBoxCtrl *mCtrlWindLight;
@@ -162,6 +163,7 @@ protected:
S32 mShadowDetail;
BOOL mAvatarImpostors;
S32 mNonImpostors;
BOOL mAvatarCloth;
S32 mAvatarMode;
BOOL mLocalLights;

View File

@@ -1524,10 +1524,6 @@ void init_debug_rendering_menu(LLMenuGL* menu)
'R', MASK_CONTROL|MASK_SHIFT));
LLMenuItemCheckGL* item;
item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT);
item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion"));
menu->append(item);
item = new LLMenuItemCheckGL("Debug GL", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugGL");
menu->append(item);

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater bottom="-400" can_close="true" can_drag_on_left="false"
can_minimize="true" can_resize="false" height="224"
left="50" min_height="200" min_width="600" mouse_opaque="true"
can_minimize="true" can_resize="false" height="244"
left="50" min_height="244" min_width="500" mouse_opaque="true"
name="Hardware Settings Floater" title="Hardware Settings" width="500">
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-42" drop_shadow_visible="true" enabled="true" follows="left|top"
@@ -55,13 +55,34 @@
font="SansSerifSmall" h_pad="0" halign="left" height="12"
left="10" mouse_opaque="true" name="Enable VBO:" v_pad="0"
width="128">
Enable VBO:
Vertex Buffer Object:
</text>
<check_box bottom_delta="-5" control_name="RenderVBOEnable" enabled="true" follows="left|top"
font="SansSerifSmall" height="16" initial_value="true"
label="Enable OpenGL Vertex Buffer Objects" left="148"
mouse_opaque="true" name="vbo" radio_style="false"
tool_tip="Enabling this on modern hardware gives a performance gain. However, older hardware often has poor implementations of VBOs and you may get crashes when this is enabled."
width="220" />
<check_box bottom_delta="0" name="stream_vbo" enabled="true" follows="left|top"
font="SansSerifSmall" height="16" initial_value="true"
label="Stream VBO" left_delta="240"
mouse_opaque="true" radio_style="false"
tool_tip="This option is usually best kept off for ATI cards (watch your FPS rate and see how it fares)."
width="150" />
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-16" drop_shadow_visible="true" enabled="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="12"
left="10" mouse_opaque="true" name="Enable Occlusion" v_pad="0"
width="128">
Occlusion:
</text>
<check_box bottom_delta="-5" control_name="UseOcclusion" enabled="true" follows="left|top"
font="SansSerifSmall" height="16" initial_value="true"
label="Enable Object-Object Occlusion" left="148"
mouse_opaque="true" name="occlusion" radio_style="false"
tool_tip="Speeds up rendering on hardware supporting it."
width="315" />
<check_box bottom_delta="-18" control_name="ShyotlRenderUseStreamVBO" enabled="true" follows="left|top"
font="SansSerifSmall" height="16" initial_value="false"
@@ -94,6 +115,16 @@
follows="left|top" height="16" increment="0.1"
initial_val="4" label="Fog Distance Ratio:" label_width="138" left="10"
max_val="10" min_val="0.5" mouse_opaque="true" name="fog" width="202" />
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-50" drop_shadow_visible="true" enabled="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="40"
left="10" mouse_opaque="true" name="note" v_pad="0"
width="480">
Note: the Gamma and Fog Distance Ratio settings are unavailable (since useless) when the
Atmospheric Shaders are enabled.
</text>
<button bottom="10" enabled="true" follows="right|bottom" font="SansSerif"
halign="center" height="20" label="OK" label_selected="OK"
left="-110" mouse_opaque="true" name="OK" scale_image="true" width="90" />

View File

@@ -7,7 +7,7 @@
<check_box bottom="-23" enabled="true" follows="left|top" font="SansSerifSmall"
height="16" initial_value="false"
label="Run viewer in a window" left="10" mouse_opaque="true"
name="windowed mode" radio_style="false" width="100" />
name="windowed mode" radio_style="false" width="120" />
<text_editor type="string" length="1" allow_html="false" bg_readonly_color="0 0 0 0" bottom="-43"
embedded_items="false" enabled="false" follows="left|top"
font="SansSerifSmall" height="20" hide_border="true"
@@ -163,8 +163,8 @@
follows="left|top" font="SansSerifSmall" height="16"
initial_value="true" label="Custom" left="385" mouse_opaque="true"
name="CustomSettings" radio_style="false" width="256" />
<view_border bevel_style="none" border_thickness="1" bottom="-405" follows="top|left"
height="290" left="5" name="GraphicsBorder" width="485" />
<view_border bevel_style="none" border_thickness="1" bottom="-395" follows="top|left"
height="280" left="5" name="GraphicsBorder" width="485" />
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-130" drop_shadow_visible="true" enabled="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="12"
@@ -274,9 +274,14 @@
follows="left|top" font="SansSerifSmall" height="16" initial_value="true"
label="Avatar Impostors" left_delta="0" mouse_opaque="true"
name="AvatarImpostors" radio_style="false" width="256" />
<check_box bottom_delta="-17" control_name="RenderAvatarVP" enabled="true"
<slider bottom_delta="-17" can_edit_text="false" control_name="RenderAvatarMaxVisible"
decimal_digits="0" enabled="true" follows="left|top" height="16"
increment="1" initial_val="35" label="Max non-impostors"
label_width="100" left_delta="8" max_val="50" min_val="1" mouse_opaque="true"
name="AvatarMaxVisible" show_text="true" width="195" />
<check_box bottom_delta="-20" control_name="RenderAvatarVP" enabled="true"
follows="left|top" font="SansSerifSmall" height="16" initial_value="true"
label="Hardware Skinning" left_delta="0" mouse_opaque="true"
label="Hardware Skinning" left="10" mouse_opaque="true"
name="AvatarVertexProgram" radio_style="false" width="256" />
<check_box bottom_delta="-17" control_name="RenderAvatarCloth" enabled="true"
follows="left|top" font="SansSerifSmall" height="16" initial_value="true"
@@ -412,7 +417,7 @@
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-352" drop_shadow_visible="true" enabled="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="12"
left="210" mouse_opaque="true" name="LightingDetailText" v_pad="0"
left="215" mouse_opaque="true" name="LightingDetailText" v_pad="0"
width="128">
Lighting Detail:
</text>
@@ -430,7 +435,7 @@
</radio_group>
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-352" drop_shadow_visible="true" enabled="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="360"
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="370"
mouse_opaque="true" name="TerrainDetailText" v_pad="0" width="128">
Terrain Detail:
</text>