summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml6
-rw-r--r--indra/newview/lldrawpoolwater.cpp8
-rw-r--r--indra/newview/lllegacyatmospherics.cpp27
-rw-r--r--indra/newview/lllegacyatmospherics.h6
-rw-r--r--indra/newview/llsettingsvo.cpp3
-rw-r--r--indra/newview/llviewercontrol.cpp7
-rw-r--r--indra/newview/llviewerwindow.cpp4
-rw-r--r--indra/newview/llviewerwindow.h2
-rw-r--r--indra/newview/llvosky.cpp61
-rw-r--r--indra/newview/llvosky.h17
-rw-r--r--indra/newview/llvowlsky.cpp81
-rw-r--r--indra/newview/llvowlsky.h13
-rw-r--r--indra/newview/pipeline.cpp33
-rw-r--r--indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml8
14 files changed, 138 insertions, 138 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 291f0f7d95..f15b5d0981 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -3352,16 +3352,16 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>DisableVerticalSync</key>
+ <key>RenderVSyncEnable</key>
<map>
<key>Comment</key>
- <string>Update frames as fast as possible (FALSE = update frames between display scans). Requires restart.</string>
+ <string>Update frames between display scans (FALSE = Update frames as fast as possible).</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
- <integer>0</integer>
+ <integer>1</integer>
</map>
<key>EnableGroupChatPopups</key>
<map>
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index aa426cd785..5f9e623b4c 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -337,7 +337,8 @@ void LLDrawPoolWater::render(S32 pass)
// for low end hardware
void LLDrawPoolWater::renderOpaqueLegacyWater()
{
- LLVOSky *voskyp = gSky.mVOSkyp;
+ LL_PROFILE_ZONE_SCOPED;
+ LLVOSky *voskyp = gSky.mVOSkyp;
LLGLSLShader* shader = NULL;
if (LLGLSLShader::sNoFixedFunction)
@@ -444,6 +445,7 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
void LLDrawPoolWater::renderReflection(LLFace* face)
{
+ LL_PROFILE_ZONE_SCOPED;
LLVOSky *voskyp = gSky.mVOSkyp;
if (!voskyp)
@@ -472,6 +474,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face)
void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& light_diffuse, const LLVector3& light_dir, F32 light_exp)
{
+ LL_PROFILE_ZONE_SCOPED;
F32 water_height = LLEnvironment::instance().getWaterHeight();
F32 camera_height = LLViewerCamera::getInstance()->getOrigin().mV[2];
F32 eyedepth = camera_height - water_height;
@@ -680,7 +683,8 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
void LLDrawPoolWater::shade()
{
- if (!deferred_render)
+ LL_PROFILE_ZONE_SCOPED;
+ if (!deferred_render)
{
gGL.setColorMask(true, true);
}
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index 9eda254b25..238e9fe0e1 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -202,14 +202,8 @@ void LLAtmospherics::init()
mInitialized = true;
}
-LLColor4 LLAtmospherics::calcSkyColorInDir(AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny)
-{
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- return calcSkyColorInDir(psky, vars, dir, isShiny);
-}
-
// This cubemap is used as "environmentMap" in indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
-LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny)
+LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny, bool low_end)
{
const F32 sky_saturation = 0.25f;
const F32 land_saturation = 0.1f;
@@ -227,7 +221,7 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm
}
F32 greyscale_sat = brightness * (1.0f - land_saturation);
desat_fog = desat_fog * land_saturation + smear(greyscale_sat);
- if (!gPipeline.canUseWindLightShaders())
+ if (low_end)
{
col = LLColor4(desat_fog, 0.f);
}
@@ -258,8 +252,7 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm
return LLColor4(sky_color, 0.0f);
}
- bool low_end = !gPipeline.canUseWindLightShaders();
- LLColor3 sky_color = low_end ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f);
+ LLColor3 sky_color = low_end ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f, vars.gamma);
return LLColor4(sky_color, 0.0f);
}
@@ -437,12 +430,16 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+ // NOTE: This is very similar to LLVOSky::cacheEnvironment()
+ // Differences:
+ // vars.sun_norm
+ // vars.sunlight
// invariants across whole sky tex process...
- vars.blue_density = psky->getBlueDensity();
+ vars.blue_density = psky->getBlueDensity();
vars.blue_horizon = psky->getBlueHorizon();
vars.haze_density = psky->getHazeDensity();
vars.haze_horizon = psky->getHazeHorizon();
- vars.density_multiplier = psky->getDensityMultiplier();
+ vars.density_multiplier = psky->getDensityMultiplier();
vars.distance_multiplier = psky->getDistanceMultiplier();
vars.max_y = psky->getMaxY();
vars.sun_norm = LLEnvironment::instance().getSunDirectionCFR();
@@ -457,9 +454,9 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
vars.total_density = psky->getTotalDensity();
vars.gamma = psky->getGamma();
- res_color[0] = calcSkyColorInDir(vars, tosun);
- res_color[1] = calcSkyColorInDir(vars, perp_tosun);
- res_color[2] = calcSkyColorInDir(vars, tosun_45);
+ res_color[0] = calcSkyColorInDir(psky, vars, tosun);
+ res_color[1] = calcSkyColorInDir(psky, vars, perp_tosun);
+ res_color[2] = calcSkyColorInDir(psky, vars, tosun_45);
sky_fog_color = color_norm(res_color[0] + res_color[1] + res_color[2]);
diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h
index 03c8efb91a..d48f3040c3 100644
--- a/indra/newview/lllegacyatmospherics.h
+++ b/indra/newview/lllegacyatmospherics.h
@@ -257,13 +257,11 @@ public:
void setCloudDensity(F32 cloud_density) { mCloudDensity = cloud_density; }
void setWind ( const LLVector3& wind ) { mWind = wind.length(); }
- LLColor4 calcSkyColorInDir(AtmosphericsVars& vars, const LLVector3& dir, bool isShiny = false);
- LLColor4 calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3& dir, bool isShiny = false);
+ LLColor4 calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3& dir, bool isShiny = false, const bool low_end = false);
-protected:
+protected:
void calcSkyColorWLVert(const LLSettingsSky::ptr_t &psky, LLVector3 & Pn, AtmosphericsVars& vars);
- LLColor3 getHazeColor(LLSettingsSky::ptr_t psky, AtmosphericsVars& vars, F32 costheta, F32 cloud_shadow);
LLHaze mHaze;
F32 mHazeConcentration;
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 6a88a8ef2c..0c59de5ea0 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -666,6 +666,7 @@ void LLSettingsVOSky::updateSettings()
void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
{
+ LL_PROFILE_ZONE_SCOPED
LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm();
LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_DEFAULT];
@@ -908,6 +909,8 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
//-------------------------------------------------------------------------
void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
{
+ LL_PROFILE_ZONE_SCOPED
+
LLEnvironment& env = LLEnvironment::instance();
auto group = LLGLSLShader::SG_WATER;
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 76dc9a6790..3e7459ee8a 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -241,6 +241,12 @@ static bool handleAnisotropicChanged(const LLSD& newvalue)
return true;
}
+static bool handleVSyncChanged(const LLSD& newvalue)
+{
+ gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean());
+ return true;
+}
+
static bool handleVolumeLODChanged(const LLSD& newvalue)
{
LLVOVolume::sLODFactor = llclamp((F32) newvalue.asReal(), 0.01f, MAX_LOD_FACTOR);
@@ -665,6 +671,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleRenderBumpChanged, _2));
gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
+ gSavedSettings.getControl("RenderVSyncEnable")->getSignal()->connect(boost::bind(&handleVSyncChanged, _2));
gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
gSavedSettings.getControl("RenderDebugGL")->getSignal()->connect(boost::bind(&handleRenderDebugGLChanged, _2));
gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2));
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 7dc7b33938..a35ad55cf7 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1903,7 +1903,7 @@ LLViewerWindow::LLViewerWindow(const Params& p)
p.title, p.name, p.x, p.y, p.width, p.height, 0,
p.fullscreen,
gHeadlessClient,
- gSavedSettings.getBOOL("DisableVerticalSync"),
+ gSavedSettings.getBOOL("RenderVSyncEnable"),
!gHeadlessClient,
p.ignore_pixel_depth,
gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
@@ -5569,7 +5569,7 @@ void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
}
}
-BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar)
+BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync, BOOL show_progress_bar)
{
//BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 8a6df613dc..93194b1884 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -424,7 +424,7 @@ public:
void requestResolutionUpdate();
void checkSettings();
void restartDisplay(BOOL show_progress_bar);
- BOOL changeDisplaySettings(LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar);
+ BOOL changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync, BOOL show_progress_bar);
BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; }
F32 getWorldViewAspectRatio() const;
const LLVector2& getDisplayScale() const { return mDisplayScale; }
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 1e546861b9..72ec8390a4 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -64,7 +64,7 @@ namespace
const S32 NUM_TILES_X = 8;
const S32 NUM_TILES_Y = 4;
const S32 NUM_TILES = NUM_TILES_X * NUM_TILES_Y;
- const S32 NUM_CUBEMAP_FACES = 6; // See sResolution for face dimensions
+ const S32 NUM_CUBEMAP_FACES = 6; // See SKYTEX_RESOLUTION for face dimensions
const S32 TOTAL_TILES = NUM_CUBEMAP_FACES * NUM_TILES;
const S32 MAX_TILES = TOTAL_TILES + 1;
@@ -87,8 +87,6 @@ namespace
SkyTex
***************************************/
-S32 LLSkyTex::sComponents = 4;
-S32 LLSkyTex::sResolution = 64;
S32 LLSkyTex::sCurrent = 0;
@@ -102,14 +100,14 @@ LLSkyTex::LLSkyTex() :
void LLSkyTex::init(bool isShiny)
{
mIsShiny = isShiny;
- mSkyData = new LLColor4[sResolution * sResolution];
- mSkyDirs = new LLVector3[sResolution * sResolution];
+ mSkyData = new LLColor4[SKYTEX_RESOLUTION * SKYTEX_RESOLUTION];
+ mSkyDirs = new LLVector3[SKYTEX_RESOLUTION * SKYTEX_RESOLUTION];
for (S32 i = 0; i < 2; ++i)
{
mTexture[i] = LLViewerTextureManager::getLocalTexture(FALSE);
mTexture[i]->setAddressMode(LLTexUnit::TAM_CLAMP);
- mImageRaw[i] = new LLImageRaw(sResolution, sResolution, sComponents);
+ mImageRaw[i] = new LLImageRaw(SKYTEX_RESOLUTION, SKYTEX_RESOLUTION, SKYTEX_COMPONENTS);
initEmpty(i);
}
@@ -141,7 +139,7 @@ LLSkyTex::~LLSkyTex()
S32 LLSkyTex::getResolution()
{
- return sResolution;
+ return SKYTEX_RESOLUTION;
}
S32 LLSkyTex::getCurrent()
@@ -169,12 +167,12 @@ S32 LLSkyTex::getWhich(const BOOL curr)
void LLSkyTex::initEmpty(const S32 tex)
{
U8* data = mImageRaw[tex]->getData();
- for (S32 i = 0; i < sResolution; ++i)
+ for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i)
{
- for (S32 j = 0; j < sResolution; ++j)
+ for (S32 j = 0; j < SKYTEX_RESOLUTION; ++j)
{
- const S32 basic_offset = (i * sResolution + j);
- S32 offset = basic_offset * sComponents;
+ const S32 basic_offset = (i * SKYTEX_RESOLUTION + j);
+ S32 offset = basic_offset * SKYTEX_COMPONENTS;
data[offset] = 0;
data[offset+1] = 0;
data[offset+2] = 0;
@@ -190,12 +188,12 @@ void LLSkyTex::initEmpty(const S32 tex)
void LLSkyTex::create()
{
U8* data = mImageRaw[sCurrent]->getData();
- for (S32 i = 0; i < sResolution; ++i)
+ for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i)
{
- for (S32 j = 0; j < sResolution; ++j)
+ for (S32 j = 0; j < SKYTEX_RESOLUTION; ++j)
{
- const S32 basic_offset = (i * sResolution + j);
- S32 offset = basic_offset * sComponents;
+ const S32 basic_offset = (i * SKYTEX_RESOLUTION + j);
+ S32 offset = basic_offset * SKYTEX_COMPONENTS;
U32* pix = (U32*)(data + offset);
LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
*pix = temp.asRGBA();
@@ -392,10 +390,8 @@ const LLVector3* LLHeavenBody::corners() const
Sky
***************************************/
-
-S32 LLVOSky::sResolution = LLSkyTex::getResolution();
-S32 LLVOSky::sTileResX = sResolution/NUM_TILES_X;
-S32 LLVOSky::sTileResY = sResolution/NUM_TILES_Y;
+const S32 SKYTEX_TILE_RES_X = SKYTEX_RESOLUTION / NUM_TILES_X;
+const S32 SKYTEX_TILE_RES_Y = SKYTEX_RESOLUTION / NUM_TILES_Y;
LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
: LLStaticViewerObject(id, pcode, regionp, TRUE),
@@ -490,6 +486,7 @@ void LLVOSky::init()
void LLVOSky::cacheEnvironment(LLSettingsSky::ptr_t psky,AtmosphericsVars& atmosphericsVars)
{
+ // NOTE: Also see: LLAtmospherics::updateFog()
// invariants across whole sky tex process...
atmosphericsVars.blue_density = psky->getBlueDensity();
atmosphericsVars.blue_horizon = psky->getBlueHorizon();
@@ -598,8 +595,8 @@ void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile)
S32 tile_x = tile % NUM_TILES_X;
S32 tile_y = tile / NUM_TILES_X;
- S32 tile_x_pos = tile_x * sTileResX;
- S32 tile_y_pos = tile_y * sTileResY;
+ S32 tile_x_pos = tile_x * SKYTEX_TILE_RES_X;
+ S32 tile_y_pos = tile_y * SKYTEX_TILE_RES_Y;
F32 coeff[3] = {0, 0, 0};
const S32 curr_coef = side >> 1; // 0/1 = Z axis, 2/3 = Y, 4/5 = X
@@ -609,11 +606,11 @@ void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile)
coeff[curr_coef] = (F32)side_dir;
- F32 inv_res = 1.f/sResolution;
+ F32 inv_res = 1.f/SKYTEX_RESOLUTION;
S32 x, y;
- for (y = tile_y_pos; y < (tile_y_pos + sTileResY); ++y)
+ for (y = tile_y_pos; y < (tile_y_pos + SKYTEX_TILE_RES_Y); ++y)
{
- for (x = tile_x_pos; x < (tile_x_pos + sTileResX); ++x)
+ for (x = tile_x_pos; x < (tile_x_pos + SKYTEX_TILE_RES_X); ++x)
{
coeff[x_coef] = F32((x<<1) + 1) * inv_res - 1.f;
coeff[y_coef] = F32((y<<1) + 1) * inv_res - 1.f;
@@ -625,21 +622,23 @@ void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile)
}
}
-void LLVOSky::createSkyTexture(LLSettingsSky::ptr_t psky, AtmosphericsVars& vars, const S32 side, const S32 tile)
+void LLVOSky::createSkyTexture(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const S32 side, const S32 tile)
{
+ const bool low_end = !gPipeline.canUseWindLightShaders();
+
S32 tile_x = tile % NUM_TILES_X;
S32 tile_y = tile / NUM_TILES_X;
- S32 tile_x_pos = tile_x * sTileResX;
- S32 tile_y_pos = tile_y * sTileResY;
+ S32 tile_x_pos = tile_x * SKYTEX_TILE_RES_X;
+ S32 tile_y_pos = tile_y * SKYTEX_TILE_RES_Y;
S32 x, y;
- for (y = tile_y_pos; y < (tile_y_pos + sTileResY); ++y)
+ for (y = tile_y_pos; y < (tile_y_pos + SKYTEX_TILE_RES_Y); ++y)
{
- for (x = tile_x_pos; x < (tile_x_pos + sTileResX); ++x)
+ for (x = tile_x_pos; x < (tile_x_pos + SKYTEX_TILE_RES_X); ++x)
{
- mSkyTex [side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mSkyTex [side].getDir(x, y), false), x, y);
- mShinyTex[side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mShinyTex[side].getDir(x, y), true ), x, y);
+ mSkyTex [side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mSkyTex [side].getDir(x, y), false, low_end), x, y);
+ mShinyTex[side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mShinyTex[side].getDir(x, y), true , low_end), x, y);
}
}
}
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 793dcf4cbf..5941ab6e3b 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -43,6 +43,9 @@ const F32 HEAVENLY_BODY_DIST = HORIZON_DIST - 20.f;
const F32 HEAVENLY_BODY_FACTOR = 0.1f;
const F32 HEAVENLY_BODY_SCALE = HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR;
+const F32 SKYTEX_COMPONENTS = 4;
+const F32 SKYTEX_RESOLUTION = 64;
+
class LLFace;
class LLHaze;
@@ -50,8 +53,6 @@ class LLSkyTex
{
friend class LLVOSky;
private:
- static S32 sResolution;
- static S32 sComponents;
LLPointer<LLViewerTexture> mTexture[2];
LLPointer<LLImageRaw> mImageRaw[2];
LLColor4 *mSkyData;
@@ -82,25 +83,25 @@ protected:
void setDir(const LLVector3 &dir, const S32 i, const S32 j)
{
- S32 offset = i * sResolution + j;
+ S32 offset = i * SKYTEX_RESOLUTION + j;
mSkyDirs[offset] = dir;
}
const LLVector3 &getDir(const S32 i, const S32 j) const
{
- S32 offset = i * sResolution + j;
+ S32 offset = i * SKYTEX_RESOLUTION + j;
return mSkyDirs[offset];
}
void setPixel(const LLColor4 &col, const S32 i, const S32 j)
{
- S32 offset = i * sResolution + j;
+ S32 offset = i * SKYTEX_RESOLUTION + j;
mSkyData[offset] = col;
}
void setPixel(const LLColor4U &col, const S32 i, const S32 j)
{
- S32 offset = (i * sResolution + j) * sComponents;
+ S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS;
U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
*pix = col.asRGBA();
}
@@ -108,7 +109,7 @@ protected:
LLColor4U getPixel(const S32 i, const S32 j)
{
LLColor4U col;
- S32 offset = (i * sResolution + j) * sComponents;
+ S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS;
U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
col.fromRGBA( *pix );
return col;
@@ -300,7 +301,7 @@ protected:
void updateDirections(LLSettingsSky::ptr_t psky);
void initSkyTextureDirs(const S32 side, const S32 tile);
- void createSkyTexture(LLSettingsSky::ptr_t psky, AtmosphericsVars& vars, const S32 side, const S32 tile);
+ void createSkyTexture(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const S32 side, const S32 tile);
LLPointer<LLViewerFetchedTexture> mSunTexturep[2];
LLPointer<LLViewerFetchedTexture> mMoonTexturep[2];
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 5a8126fa38..d1f584cbca 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -36,8 +36,8 @@
#include "llenvironment.h"
#include "llsettingssky.h"
-static const U32 MIN_SKY_DETAIL = 8;
-static const U32 MAX_SKY_DETAIL = 180;
+constexpr U32 MIN_SKY_DETAIL = 8;
+constexpr U32 MAX_SKY_DETAIL = 180;
inline U32 LLVOWLSky::getNumStacks(void)
{
@@ -97,13 +97,14 @@ LLDrawable * LLVOWLSky::createDrawable(LLPipeline * pipeline)
return mDrawable;
}
-inline F32 LLVOWLSky::calcPhi(U32 i)
+// a tiny helper function for controlling the sky dome tesselation.
+inline F32 calcPhi(const U32 &i, const F32 &reciprocal_num_stacks)
{
// Calc: PI/8 * 1-((1-t^4)*(1-t^4)) { 0<t<1 }
// Demos: \pi/8*\left(1-((1-x^{4})*(1-x^{4}))\right)\ \left\{0<x\le1\right\}
// i should range from [0..SKY_STACKS] so t will range from [0.f .. 1.f]
- F32 t = float(i) / float(getNumStacks());
+ F32 t = float(i) * reciprocal_num_stacks; //SL-16127: remove: / float(getNumStacks());
// ^4 the parameter of the tesselation to bias things toward 0 (the dome's apex)
t *= t;
@@ -187,6 +188,8 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
}
{
+ const F32 dome_radius = LLEnvironment::instance().getCurrentSky()->getDomeRadius();
+
const U32 max_buffer_bytes = gSavedSettings.getS32("RenderMaxVBOSize")*1024;
const U32 data_mask = LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK;
const U32 max_verts = max_buffer_bytes / LLVertexBuffer::calcVertexSize(data_mask);
@@ -202,12 +205,14 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
// round up to a whole number of segments
const U32 strips_segments = (total_stacks+stacks_per_seg-1) / stacks_per_seg;
- LL_INFOS() << "WL Skydome strips in " << strips_segments << " batches." << LL_ENDL;
-
mStripsVerts.resize(strips_segments, NULL);
+#if RELEASE_SHOW_DEBUG
+ LL_INFOS() << "WL Skydome strips in " << strips_segments << " batches." << LL_ENDL;
+
LLTimer timer;
timer.start();
+#endif
for (U32 i = 0; i < strips_segments ;++i)
{
@@ -232,34 +237,42 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
const U32 num_indices_this_seg = 1+num_stacks_this_seg*(2+2*verts_per_stack);
llassert(num_indices_this_seg * sizeof(U16) <= max_buffer_bytes);
- if (!segment->allocateBuffer(num_verts_this_seg, num_indices_this_seg, TRUE))
+ bool allocated = segment->allocateBuffer(num_verts_this_seg, num_indices_this_seg, TRUE);
+#if RELEASE_SHOW_WARNS
+ if( !allocated )
{
LL_WARNS() << "Failed to allocate Vertex Buffer on update to "
<< num_verts_this_seg << " vertices and "
<< num_indices_this_seg << " indices" << LL_ENDL;
}
+#else
+ (void) allocated;
+#endif
// lock the buffer
BOOL success = segment->getVertexStrider(vertices)
&& segment->getTexCoord0Strider(texCoords)
&& segment->getIndexStrider(indices);
- if(!success)
+#if RELEASE_SHOW_DEBUG
+ if(!success)
{
LL_ERRS() << "Failed updating WindLight sky geometry." << LL_ENDL;
}
-
- U32 vertex_count = 0;
- U32 index_count = 0;
+#else
+ (void) success;
+#endif
// fill it
- buildStripsBuffer(begin_stack, end_stack, vertex_count, index_count, vertices, texCoords, indices);
+ buildStripsBuffer(begin_stack, end_stack, vertices, texCoords, indices, dome_radius, verts_per_stack, total_stacks);
// and unlock the buffer
segment->flush();
}
+#if RELEASE_SHOW_DEBUG
LL_INFOS() << "completed in " << llformat("%.2f", timer.getElapsedTimeF32().value()) << "seconds" << LL_ENDL;
+#endif
}
updateStarColors();
@@ -364,23 +377,16 @@ void LLVOWLSky::initStars()
void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
U32 end_stack,
- U32& vertex_count,
- U32& index_count,
- LLStrider<LLVector3> & vertices,
- LLStrider<LLVector2> & texCoords,
- LLStrider<U16> & indices)
+ LLStrider<LLVector3> & vertices,
+ LLStrider<LLVector2> & texCoords,
+ LLStrider<U16> & indices,
+ const F32 dome_radius,
+ const U32& num_slices,
+ const U32& num_stacks)
{
- const F32 RADIUS = LLEnvironment::instance().getCurrentSky()->getDomeRadius();
-
- U32 i, j, num_slices, num_stacks;
+ U32 i, j;
F32 phi0, theta, x0, y0, z0;
-
- // paranoia checking for SL-55986/SL-55833
- U32 count_verts = 0;
- U32 count_indices = 0;
-
- num_slices = getNumSlices();
- num_stacks = getNumStacks();
+ const F32 reciprocal_num_stacks = 1.f / num_stacks;
llassert(end_stack <= num_stacks);
@@ -391,7 +397,7 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
for(i = begin_stack + 1; i <= end_stack+1; ++i)
#endif
{
- phi0 = calcPhi(i);
+ phi0 = calcPhi(i, reciprocal_num_stacks);
for(j = 0; j < num_slices; ++j)
{
@@ -404,24 +410,22 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
z0 = sin(phi0) * sin(theta);
#if NEW_TESS
- *vertices++ = LLVector3(x0 * RADIUS, y0 * RADIUS, z0 * RADIUS);
+ *vertices++ = LLVector3(x0 * dome_radius, y0 * dome_radius, z0 * dome_radius);
#else
if (i == num_stacks-2)
{
- *vertices++ = LLVector3(x0*RADIUS, y0*RADIUS-1024.f*2.f, z0*RADIUS);
+ *vertices++ = LLVector3(x0*dome_radius, y0*dome_radius-1024.f*2.f, z0*dome_radius);
}
else if (i == num_stacks-1)
{
- *vertices++ = LLVector3(0, y0*RADIUS-1024.f*2.f, 0);
+ *vertices++ = LLVector3(0, y0*dome_radius-1024.f*2.f, 0);
}
else
{
- *vertices++ = LLVector3(x0 * RADIUS, y0 * RADIUS, z0 * RADIUS);
+ *vertices++ = LLVector3(x0 * dome_radius, y0 * dome_radius, z0 * dome_radius);
}
#endif
- ++count_verts;
-
// generate planar uv coordinates
// note: x and z are transposed in order for things to animate
// correctly in the global coordinate system where +x is east and
@@ -432,12 +436,11 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
//build triangle strip...
*indices++ = 0 ;
- count_indices++ ;
+
S32 k = 0 ;
for(i = 1; i <= end_stack - begin_stack; ++i)
{
*indices++ = i * num_slices + k ;
- count_indices++ ;
k = (k+1) % num_slices ;
for(j = 0; j < num_slices ; ++j)
@@ -445,8 +448,6 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
*indices++ = (i-1) * num_slices + k ;
*indices++ = i * num_slices + k ;
- count_indices += 2 ;
-
k = (k+1) % num_slices ;
}
@@ -456,11 +457,7 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
}
*indices++ = i * num_slices + k ;
- count_indices++ ;
}
-
- vertex_count = count_verts;
- index_count = count_indices;
}
void LLVOWLSky::updateStarColors()
diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h
index 2b7ebe75dd..3853dd2c70 100644
--- a/indra/newview/llvowlsky.h
+++ b/indra/newview/llvowlsky.h
@@ -55,8 +55,6 @@ public:
void restoreGL();
private:
- // a tiny helper function for controlling the sky dome tesselation.
- static F32 calcPhi(U32 i);
// helper function for initializing the stars.
void initStars();
@@ -66,11 +64,12 @@ private:
// begin_stack is the first stack to be included, end_stack is the first
// stack not to be included.
static void buildStripsBuffer(U32 begin_stack, U32 end_stack,
- U32& vertex_count,
- U32& index_count,
- LLStrider<LLVector3> & vertices,
- LLStrider<LLVector2> & texCoords,
- LLStrider<U16> & indices);
+ LLStrider<LLVector3> & vertices,
+ LLStrider<LLVector2> & texCoords,
+ LLStrider<U16> & indices,
+ const F32 RADIUS,
+ const U32& num_slices,
+ const U32& num_stacks);
// helper function for updating the stars colors.
void updateStarColors();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 6ed6e20b03..71a438302a 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1231,7 +1231,8 @@ void LLPipeline::releaseShadowTargets()
void LLPipeline::createGLBuffers()
{
- stop_glerror();
+ LL_PROFILE_ZONE_SCOPED;
+ stop_glerror();
assertInitialized();
updateRenderDeferred();
@@ -1384,7 +1385,7 @@ void LLPipeline::restoreGL()
if (part)
{
part->restoreGL();
- }
+ }
}
}
}
@@ -2428,8 +2429,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
LLVOCachePartition* vo_part = region->getVOCachePartition();
if(vo_part)
{
- bool do_occlusion_cull = can_use_occlusion && use_occlusion && !gUseWireframe && 0 > water_clip /* && !gViewerWindow->getProgressView()->getVisible()*/;
- do_occlusion_cull &= !sReflectionRender;
+ bool do_occlusion_cull = can_use_occlusion && use_occlusion && !gUseWireframe; // && 0 > water_clip
vo_part->cull(camera, do_occlusion_cull);
}
}
@@ -2629,7 +2629,8 @@ void LLPipeline::doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderT
void LLPipeline::doOcclusion(LLCamera& camera)
{
- if (LLPipeline::sUseOcclusion > 1 && !LLSpatialPartition::sTeleportRequested &&
+ LL_PROFILE_ZONE_SCOPED;
+ if (LLPipeline::sUseOcclusion > 1 && !LLSpatialPartition::sTeleportRequested &&
(sCull->hasOcclusionGroups() || LLVOCachePartition::sNeedsOcclusionCheck))
{
LLVertexBuffer::unbind();
@@ -3422,7 +3423,8 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed)
{
- if (bridge->getSpatialGroup()->changeLOD() || fov_changed)
+ LL_PROFILE_ZONE_SCOPED;
+ if (bridge->getSpatialGroup()->changeLOD() || fov_changed)
{
bool force_update = false;
bridge->updateDistance(camera, force_update);
@@ -3431,7 +3433,8 @@ void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_c
void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
{
- if (!drawablep
+ LL_PROFILE_ZONE_SCOPED;
+ if (!drawablep
|| drawablep->isDead()
|| !hasRenderType(drawablep->getRenderType()))
{
@@ -4708,7 +4711,8 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
void LLPipeline::renderGeomShadow(LLCamera& camera)
{
- U32 cur_type = 0;
+ LL_PROFILE_ZONE_SCOPED;
+ U32 cur_type = 0;
LLGLEnable cull(GL_CULL_FACE);
@@ -8384,15 +8388,13 @@ LLVector4 pow4fsrgb(LLVector4 v, F32 f)
return v;
}
-static LLTrace::BlockTimerStatHandle FTM_DEFERRED_LIGHTING("Deferred Lighting");
-
void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
{
+ LL_PROFILE_ZONE_SCOPED;
if (!sCull)
{
return;
}
- LL_RECORD_BLOCK_TIME(FTM_DEFERRED_LIGHTING);
LLRenderTarget *deferred_target = &mDeferredScreen;
LLRenderTarget *deferred_depth_target = &mDeferredDepth;
@@ -9200,6 +9202,7 @@ inline float sgn(float a)
void LLPipeline::generateWaterReflection(LLCamera& camera_in)
{
+ LL_PROFILE_ZONE_SCOPED;
if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
{
bool skip_avatar_update = false;
@@ -9254,11 +9257,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
water_clip = -1;
}
- S32 occlusion = LLPipeline::sUseOcclusion;
-
- //disable occlusion culling for reflection map for now
- LLPipeline::sUseOcclusion = 0;
-
if (!camera_is_underwater)
{
//generate planar reflection map
@@ -9374,8 +9372,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
set_current_modelview(saved_modelview);
}
- //LLPipeline::sUseOcclusion = occlusion;
-
camera.setOrigin(camera_in.getOrigin());
//render distortion map
static bool last_update = true;
@@ -9470,7 +9466,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
gPipeline.popRenderTypeMask();
- LLPipeline::sUseOcclusion = occlusion;
LLPipeline::sUnderWaterRender = false;
LLPipeline::sReflectionRender = false;
diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
index 7786ba8a1c..cba75e8ea7 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
@@ -334,15 +334,15 @@
width="256" />
<check_box
- control_name="RenderVBOEnable"
+ control_name="RenderVSyncEnable"
height="16"
initial_value="true"
- label="Enable OpenGL Vertex Buffer Objects"
+ label="Enable VSync"
layout="topleft"
left="30"
top_delta="16"
- name="vbo"
- 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."
+ name="vsync"
+ tool_tip="Synchronizes the frame rate to the refresh rate of the monitor, which results in smooth performance."
width="315" />
<check_box