diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 6b3e6c64f..f20e0d6ad 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -289,11 +289,13 @@ S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 categ //static void LLImageGL::destroyGL(BOOL save_state) { + deleteDeadTextures(); //Dump unimportant textures. for (S32 stage = 0; stage < gGLManager.mNumTextureUnits; stage++) { gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE); } + int stored_count = 0; sAllowReadBackRaw = true ; for (std::set::iterator iter = sImageList.begin(); iter != sImageList.end(); iter++) @@ -308,18 +310,24 @@ void LLImageGL::destroyGL(BOOL save_state) { glimage->mSaveData = NULL ; } + else + stored_count++; } glimage->destroyGLTexture(); stop_glerror(); } } + llinfos << "Storing " << stored_count << " images..." << llendl; sAllowReadBackRaw = false ; + deleteDeadTextures();//Now, actually call glDeleteTextures for everything. } //static void LLImageGL::restoreGL() { + + int recovered_count = 0; for (std::set::iterator iter = sImageList.begin(); iter != sImageList.end(); iter++) { @@ -334,10 +342,12 @@ void LLImageGL::restoreGL() { glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData, 0, TRUE, glimage->getCategory()); stop_glerror(); + recovered_count++; } glimage->mSaveData = NULL; // deletes data } } + llinfos << "Restored " << recovered_count << " images" << llendl; } //static @@ -1250,7 +1260,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre llverify(gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName)); //debug code, leave it there commented. - //checkTexSize() ; + checkTexSize() ; LLGLint glwidth = 0; glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_WIDTH, (GLint*)&glwidth); diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 060b2c457..ce8bee216 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -248,6 +248,8 @@ void LLComboBox::onCommit() mTextEntry->setValue(getSimple()); mTextEntry->setTentative(FALSE); } + + setControlValue(getValue()); LLUICtrl::onCommit(); } diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index df769c444..8abbb9018 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2841,8 +2841,16 @@ void LLSplashScreenWin32::updateImpl(const std::string& mesg) { if (!mWindow) return; - WCHAR w_mesg[1024]; - mbstowcs(w_mesg, mesg.c_str(), 1024); + int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), mesg.length(), NULL, 0); + if( output_str_len>1024 ) + return; + + WCHAR w_mesg[1025];//big enought to keep null terminatos + + MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), mesg.length(), w_mesg, output_str_len); + + //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858 + w_mesg[output_str_len] = 0; SendDlgItemMessage(mWindow, 666, // HACK: text id @@ -2970,78 +2978,6 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) sei.lpFile = url_utf16.c_str(); ShellExecuteEx( &sei ); - //// TODO: LEAVING OLD CODE HERE SO I DON'T BONE OTHER MERGES - //// DELETE THIS ONCE THE MERGES ARE DONE - - // Figure out the user's default web browser - // HKEY_CLASSES_ROOT\http\shell\open\command - /* - std::string reg_path_str = gURLProtocolWhitelistHandler[i] + "\\shell\\open\\command"; - WCHAR reg_path_wstr[256]; - mbstowcs( reg_path_wstr, reg_path_str.c_str(), LL_ARRAY_SIZE(reg_path_wstr) ); - - HKEY key; - WCHAR browser_open_wstr[1024]; - DWORD buffer_length = 1024; - RegOpenKeyEx(HKEY_CLASSES_ROOT, reg_path_wstr, 0, KEY_QUERY_VALUE, &key); - RegQueryValueEx(key, NULL, NULL, NULL, (LPBYTE)browser_open_wstr, &buffer_length); - RegCloseKey(key); - - // Convert to STL string - LLWString browser_open_wstring = utf16str_to_wstring(browser_open_wstr); - - if (browser_open_wstring.length() < 2) - { - LL_WARNS("Window") << "Invalid browser executable in registry " << browser_open_wstring << LL_ENDL; - return; - } - - // Extract the process that's supposed to be launched - LLWString browser_executable; - if (browser_open_wstring[0] == '"') - { - // executable is quoted, find the matching quote - size_t quote_pos = browser_open_wstring.find('"', 1); - // copy out the string including both quotes - browser_executable = browser_open_wstring.substr(0, quote_pos+1); - } - else - { - // executable not quoted, find a space - size_t space_pos = browser_open_wstring.find(' ', 1); - browser_executable = browser_open_wstring.substr(0, space_pos); - } - - LL_DEBUGS("Window") << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << LL_ENDL; - LL_INFOS("Window") << "Browser executable: " << wstring_to_utf8str(browser_executable) << LL_ENDL; - - // Convert URL to wide string for Windows API - // Assume URL is UTF8, as can come from scripts - LLWString url_wstring = utf8str_to_wstring(escaped_url); - llutf16string url_utf16 = wstring_to_utf16str(url_wstring); - - // Convert executable and path to wide string for Windows API - llutf16string browser_exec_utf16 = wstring_to_utf16str(browser_executable); - - // ShellExecute returns HINSTANCE for backwards compatiblity. - // MS docs say to cast to int and compare to 32. - HWND our_window = NULL; - LPCWSTR directory_wstr = NULL; - int retval = (int) ShellExecute(our_window, // Flawfinder: ignore - L"open", - browser_exec_utf16.c_str(), - url_utf16.c_str(), - directory_wstr, - SW_SHOWNORMAL); - if (retval > 32) - { - LL_DEBUGS("Window") << "load_url success with " << retval << LL_ENDL; - } - else - { - LL_INFOS("Window") << "load_url failure with " << retval << LL_ENDL; - } - */ } diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 76dfa47ff..38c0be773 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -405,7 +405,15 @@ template <> inline void LLCachedControl::setValue(const LLSD& newvalue else this->mCachedValue = (const LLColor4 &)newvalue; } - +template <> inline void LLCachedControl::setValue(const LLSD& newvalue) +{ + if(mControl->isType(TYPE_U32) || mControl->isType(TYPE_S32)) //LLSD does not support U32 fully + mCachedValue = (U32)newvalue.asInteger(); + else if(this->mControl->isType(TYPE_F32)) + mCachedValue = (U32)newvalue.asReal(); + else + mCachedValue = (U32)0; //What to do... +} //Following is actually defined in newview/llviewercontrol.cpp, but extern access is fine (Unless GCC bites me) template <> eControlType get_control_type(const U32& in, LLSD& out); diff --git a/indra/newview/app_settings/settings_sh.xml b/indra/newview/app_settings/settings_sh.xml index 14e2a78be..a796d5a38 100644 --- a/indra/newview/app_settings/settings_sh.xml +++ b/indra/newview/app_settings/settings_sh.xml @@ -68,17 +68,6 @@ Value 2.0 - SHHighResSnapshotForceTile - - Comment - Force tiling of snapshots (enables AA and supersampling) - Persist - 1 - Type - Boolean - Value - 0 - SHHighResSnapshotSuperSample Comment diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl index f81867be6..817d6c1c5 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl @@ -5,6 +5,8 @@ * $License$ */ +#version 120 + uniform sampler2D diffuseMap; uniform float glowStrength; diff --git a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl index 7db969ef0..7edfebab2 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl @@ -5,6 +5,8 @@ * $License$ */ +#extension GL_ARB_texture_rectangle : enable + uniform sampler2DRect RenderTexture; uniform float bloomStrength; diff --git a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl index 4d5bf2538..729949a17 100644 --- a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl @@ -5,6 +5,8 @@ * $License$ */ +#extension GL_ARB_texture_rectangle : enable + uniform sampler2DRect RenderTexture; uniform float brightness; uniform float contrast; diff --git a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl index a1583b13e..f9eee5b89 100644 --- a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl @@ -5,6 +5,8 @@ * $License$ */ +#extension GL_ARB_texture_rectangle : enable + uniform sampler2DRect RenderTexture; uniform float extractLow; uniform float extractHigh; diff --git a/indra/newview/app_settings/shaders/class2/effects/gaussBlurF.glsl b/indra/newview/app_settings/shaders/class2/effects/gaussBlurF.glsl index 47c9f875b..f58622ab6 100644 --- a/indra/newview/app_settings/shaders/class2/effects/gaussBlurF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/gaussBlurF.glsl @@ -1,3 +1,6 @@ + +#extension GL_ARB_texture_rectangle : enable + uniform sampler2DRect RenderTexture; uniform int horizontalPass; diff --git a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl index 271d5cf8d..833ef7d30 100644 --- a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl @@ -4,6 +4,8 @@ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. * $License$ */ + +#extension GL_ARB_texture_rectangle : enable uniform sampler2DRect RenderTexture; uniform sampler2D NoiseTexture; diff --git a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl index e55d278b8..3a236846c 100644 --- a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl @@ -5,6 +5,8 @@ * $License$ */ +#extension GL_ARB_texture_rectangle : enable + uniform sampler2DRect RenderTexture; void main(void) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 38fdd1934..1d5ec98d0 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -554,7 +554,8 @@ void LLDrawPoolWater::shade() } LLVOWater* water = (LLVOWater*) face->getViewerObject(); - gGL.getTexUnit(diffTex)->bind(face->getTexture()); + if(diffTex > -1 && face->getTexture()->getHasGLTexture()) + gGL.getTexUnit(diffTex)->bind(face->getTexture()); sNeedsReflectionUpdate = TRUE; @@ -572,6 +573,8 @@ void LLDrawPoolWater::shade() LLGLSquashToFarClip far_clip(glh_get_current_projection()); face->renderIndexed(); } + if(diffTex > -1 && face->getTexture()->getHasGLTexture()) + gGL.getTexUnit(diffTex)->unbind(LLTexUnit::TT_TEXTURE); } } diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 9f7cac6a0..fd6bcca05 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -169,32 +169,20 @@ BOOL LLFloaterHardwareSettings::postBuild() } -void LLFloaterHardwareSettings::apply() +void LLFloaterHardwareSettings::apply() { - // Anisotropic rendering - BOOL old_anisotropic = LLImageGL::sGlobalUseAnisotropic; - LLImageGL::sGlobalUseAnisotropic = childGetValue("ani"); - - U32 fsaa = (U32) childGetValue("fsaa").asInteger(); - U32 old_fsaa = gSavedSettings.getU32("RenderFSAASamples"); - - BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); - - if (old_fsaa != fsaa) + //Still do a bit of voodoo here. V2 forces restart to change FSAA with FBOs off. + //Let's not do that, and instead do pre-V2 FSAA change handling for that particular case + if(!LLRenderTarget::sUseFBO && (mFSAASamples != (U32)childGetValue("fsaa").asInteger())) { - gSavedSettings.setU32("RenderFSAASamples", fsaa); + BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); LLWindow* window = gViewerWindow->getWindow(); LLCoordScreen size; window->getSize(&size); gViewerWindow->changeDisplaySettings(window->getFullscreen(), - size, - gSavedSettings.getBOOL("DisableVerticalSync"), - logged_in); - } - else if (old_anisotropic != LLImageGL::sGlobalUseAnisotropic) - { - LLImageGL::dirtyTexOptions(); - gViewerWindow->restartDisplay(logged_in); + size, + gSavedSettings.getBOOL("DisableVerticalSync"), + logged_in); } refresh(); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index c29bcbd4a..8af25724f 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -122,8 +122,17 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue) static bool handleSetShaderChanged(const LLSD& newvalue) { + // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache gBumpImageList.destroyGL(); gBumpImageList.restoreGL(); + + // Changing shader also changes the terrain detail to high, reflect that change here + if (newvalue.asBoolean()) + { + // shaders enabled, set terrain detail to high + gSavedSettings.setS32("RenderTerrainDetail", 1); + } + // else, leave terrain detail as is LLViewerShaderMgr::instance()->setShaders(); return true; } @@ -187,6 +196,13 @@ static bool handleReleaseGLBufferChanged(const LLSD& newvalue) return true; } +static bool handleAnisotropicChanged(const LLSD& newvalue) +{ + LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean(); + LLImageGL::dirtyTexOptions(); + return true; +} + static bool handleVolumeLODChanged(const LLSD& newvalue) { LLVOVolume::sLODFactor = (F32) newvalue.asReal(); @@ -552,6 +568,8 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); + gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); + gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _1)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 87654d11e..bd65bd999 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -103,6 +103,7 @@ BOOL gForceRenderLandFence = FALSE; BOOL gDisplaySwapBuffers = FALSE; BOOL gDepthDirty = FALSE; BOOL gResizeScreenTexture = FALSE; +BOOL gWindowResized = FALSE; BOOL gSnapshot = FALSE; U32 gRecentFrameCount = 0; // number of 'recent' frames @@ -112,7 +113,7 @@ LLFrameTimer gRecentMemoryTime; // Rendering stuff void pre_show_depth_buffer(); void post_show_depth_buffer(); -void render_ui(F32 zoom_factor = 1.f, int subfield = 0); +void render_ui(F32 zoom_factor = 1.f, int subfield = 0, bool tiling = false); void render_hud_attachments(); void render_ui_3d(); void render_ui_2d(); @@ -165,11 +166,7 @@ void display_startup() glClear(GL_DEPTH_BUFFER_BIT); } -#if SHY_MOD //screenshot improvement void display_update_camera(bool tiling=false) -#else //shy_mod -void display_update_camera() -#endif //ignore { llpushcallstacks ; // TODO: cut draw distance down if customizing avatar? @@ -178,7 +175,6 @@ void display_update_camera() // Cut draw distance in half when customizing avatar, // but on the viewer only. F32 final_far = gAgent.mDrawDistance; -#if SHY_MOD //screenshot improvement if(tiling) //Don't animate clouds and water if tiling! { LLViewerCamera::getInstance()->setFar(final_far); @@ -186,7 +182,6 @@ void display_update_camera() LLWorld::getInstance()->setLandFarClip(final_far); return; } -#endif //shy_mod if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode()) { final_far *= 0.5f; @@ -231,18 +226,26 @@ void display_stats() } // Paint the display! -#if SHY_MOD // screenshot improvement -void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, BOOL tiling) -#else //shy_mod -void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) -#endif //ignore +void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, bool tiling) { LLFastTimer t(LLFastTimer::FTM_RENDER); - if (LLPipeline::sRenderDeferred) + if (gWindowResized) + { //skip render on frames where window has been resized + gGL.flush(); + glClear(GL_COLOR_BUFFER_BIT); + gViewerWindow->mWindow->swapBuffers(); + gPipeline.resizeScreenTexture(); + gResizeScreenTexture = FALSE; + gWindowResized = FALSE; + return; + } + + //Nope + /*if (LLPipeline::sRenderDeferred) { //hack to make sky show up in deferred snapshots for_snapshot = FALSE; - } + }*/ if (LLPipeline::sRenderFrameTest) { @@ -601,11 +604,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLNamePool::upkeepPools(); stop_glerror(); -#if SHY_MOD //screenshot improvement display_update_camera(tiling); -#else //shy_mod - display_update_camera(); -#endif //ignore stop_glerror(); // *TODO: merge these two methods @@ -678,7 +677,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); - BOOL to_texture = gPipeline.canUseVertexShaders() && (LLPipeline::sRenderDeferred || (LLPipeline::sRenderGlow && !gSnapshot)); + BOOL to_texture = gPipeline.canUseVertexShaders() && LLPipeline::sRenderGlow; LLAppViewer::instance()->pingMainloopTimeout("Display:Swap"); @@ -701,7 +700,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); - if (!for_snapshot) + if (!for_snapshot || LLPipeline::sRenderDeferred) { if (gFrameCount > 1) { //for some reason, ATI 4800 series will error out if you @@ -737,11 +736,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } -#if SHY_MOD // screenshot improvement if (!for_snapshot || tiling) -#else //shy_mod - if (!for_snapshot) -#endif //ignore { LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); @@ -876,7 +871,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glClearColor(0,0,0,0); gPipeline.mDeferredScreen.clear(); } - else + else if(!tiling) { gPipeline.mScreen.bindTarget(); gPipeline.mScreen.clear(); @@ -920,7 +915,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { gPipeline.mDeferredScreen.flush(); } - else + else if(!tiling) { gPipeline.mScreen.flush(); } @@ -1134,7 +1129,7 @@ BOOL setup_hud_matrices(const LLRect& screen_region) } -void render_ui(F32 zoom_factor, int subfield) +void render_ui(F32 zoom_factor, int subfield, bool tiling) { LLGLState::checkStates(); @@ -1149,7 +1144,7 @@ void render_ui(F32 zoom_factor, int subfield) if (to_texture) { - gPipeline.renderBloom(gSnapshot, zoom_factor, subfield); + gPipeline.renderBloom(gSnapshot, zoom_factor, subfield, tiling); gPipeline.mScreen.flush(); //blit, etc. } /// We copy the frame buffer straight into a texture here, diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h index 5c46a07a9..50a006094 100644 --- a/indra/newview/llviewerdisplay.h +++ b/indra/newview/llviewerdisplay.h @@ -38,11 +38,7 @@ class LLPostProcess; void display_startup(); void display_cleanup(); -#if SHY_MOD // screenshot improvement -void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0, BOOL for_snapshot = FALSE, BOOL tiling = FALSE); -#else //shy_mod -void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0, BOOL for_snapshot = FALSE); -#endif //ignore +void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0, BOOL for_snapshot = FALSE, bool tiling = false); extern BOOL gDisplaySwapBuffers; extern BOOL gDepthDirty; @@ -50,6 +46,7 @@ extern BOOL gTeleportDisplay; extern LLFrameTimer gTeleportDisplayTimer; extern BOOL gForceRenderLandFence; extern BOOL gResizeScreenTexture; +extern BOOL gWindowResized; extern F32 gSavedDrawDistance; #endif // LL_LLVIEWERDISPLAY_H diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 3a7889267..7c156a6b1 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -569,12 +569,15 @@ class LLFileTakeSnapshotToDisk : public view_listener_t S32 width = gViewerWindow->getWindowDisplayWidth(); S32 height = gViewerWindow->getWindowDisplayHeight(); + F32 supersample = 1.f; if (gSavedSettings.getBOOL("HighResSnapshot")) { -#if SHY_MOD // screenshot improvement +#if 1//SHY_MOD // screenshot improvement const F32 mult = gSavedSettings.getF32("SHHighResSnapshotScale"); width *= mult; height *= mult; + static const LLCachedControl super_sample_scale("SHHighResSnapshotSuperSample",1.f); + supersample = super_sample_scale; #else //shy_mod width *= 2; height *= 2; @@ -587,7 +590,10 @@ class LLFileTakeSnapshotToDisk : public view_listener_t TRUE, FALSE, gSavedSettings.getBOOL("RenderUIInSnapshot"), - FALSE)) + FALSE, + LLViewerWindow::SNAPSHOT_TYPE_COLOR, + 6144, + supersample)) { gViewerWindow->playSnapshotAnimAndSound(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b27189247..bcd34fd7d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -200,7 +200,7 @@ // // Globals // -void render_ui(F32 zoom_factor = 1.f, int subfield = 0); +void render_ui(F32 zoom_factor = 1.f, int subfield = 0, bool tiling = false); LLBottomPanel* gBottomPanel = NULL; extern BOOL gDebugClicks; @@ -686,11 +686,12 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask llinfos << "Left Mouse Down not handled by view" << llendl; } + // Do not allow tool manager to handle mouseclicks if we have disconnected if (gDisconnected) { return FALSE; } - + if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) ) { // This is necessary to force clicks in the world to cause edit @@ -1499,6 +1500,15 @@ LLViewerWindow::LLViewerWindow( LL_WARNS("Window") << " Someone took over my signal/exception handler (post createWindow)!" << LL_ENDL; } + LLCoordScreen scr; + mWindow->getSize(&scr); + + if(fullscreen && ( scr.mX!=width || scr.mY!=height)) + { + llwarns << "Fullscreen has forced us in to a different resolution now using "< 0) @@ -4251,7 +4262,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p // Saves the image from the screen to the specified filename and path. BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, - BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL do_rebuild, ESnapshotType type, S32 max_size) + BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL do_rebuild, ESnapshotType type, S32 max_size, F32 supersample) { if (!raw) { @@ -4281,25 +4292,26 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei // Copy screen to a buffer // crop sides or top and bottom, if taking a snapshot of different aspect ratio // from window - S32 snapshot_width = mWindowRect.getWidth(); - S32 snapshot_height = mWindowRect.getHeight(); - // SNAPSHOT - S32 window_width = mWindowRect.getWidth(); - S32 window_height = mWindowRect.getHeight(); LLRect window_rect = mWindowRect; - BOOL use_fbo = FALSE; - LLRenderTarget target; + S32 snapshot_width = window_rect.getWidth(); + S32 snapshot_height = window_rect.getHeight(); + // SNAPSHOT + S32 window_width = snapshot_width; + S32 window_height = snapshot_height; + + F32 scale_factor = 1.0f ; + + bool is_tiling = false; -#if SHY_MOD // screenshot improvement - F32 internal_scale = 1.f; - static const LLCachedControl force_tile("SHHighResSnapshotForceTile",false); - if(force_tile) - { - static const LLCachedControl super_sample_scale("SHHighResSnapshotSuperSample",1.f); - internal_scale = llmax(super_sample_scale.get(),1.f); - } + //fbo method no longer supported. Good riddance + /*LLRenderTarget target; + bool use_fbo = false; + static const LLCachedControl force_tile("SHHighResSnapshotForceTile",false);*/ + +#if 1//SHY_MOD // screenshot improvement + F32 internal_scale = llmin(llmax(supersample,1.f),3.f); // render at specified internal resolution. >1 results in supersampling. image_height *= internal_scale; image_width *= internal_scale; @@ -4316,10 +4328,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei { if(image_width > window_width || image_height > window_height) //need to enlarge the scene { -#if SHY_MOD // screenshot improvement - if(!force_tile) -#endif //shy_mod - if (gGLManager.mHasFramebufferObject && !show_ui) + //Unsupported + /*if (!force_tile && gGLManager.mHasFramebufferObject && !show_ui) { GLint max_size = 0; glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &max_size); @@ -4339,12 +4349,13 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } } - if(!use_fbo) //no re-projection, so tiling the scene + if(!use_fbo) //no re-projection, so tiling the scene*/ { F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ; snapshot_width = (S32)(ratio * image_width) ; snapshot_height = (S32)(ratio * image_height) ; scale_factor = llmax(1.0f, 1.0f / ratio) ; + is_tiling = true; } } //else: keep the current scene scale, re-scale it if necessary after reading out. @@ -4354,9 +4365,9 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei S32 buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f); S32 image_buffer_x = llfloor(snapshot_width*scale_factor) ; - S32 image_buffer_y = llfloor(snapshot_height *scale_factor) ; -#if SHY_MOD // screenshot improvement - if(internal_scale > 1.f) //If supersampling... Don't care about max_size. + S32 image_buffer_y = llfloor(snapshot_height*scale_factor) ; +#if 1//SHY_MOD // screenshot improvement + if(internal_scale <= 1.f) //If supersampling... Don't care about max_size. #endif //shy_mod if(image_buffer_x > max_size || image_buffer_y > max_size) //boundary check to avoid memory overflow { @@ -4421,20 +4432,16 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei else { const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor)); -#if SHY_MOD // screenshot improvement - //tiling requires gPipeline.generateWaterReflection to be called in display(). CANNOT be done if using an fbo. - display(do_rebuild, scale_factor, subfield, TRUE, !use_fbo && (scale_factor > 1.0f)); -#else //shy_mod - display(do_rebuild, scale_factor, subfield, TRUE); -#endif + display(do_rebuild, scale_factor, subfield, TRUE, is_tiling); // Required for showing the GUI in snapshots? See DEV-16350 for details. JC - render_ui(scale_factor, subfield); + render_ui(scale_factor, subfield, is_tiling); } S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width); // handle fractional rows U32 read_width = llmax(0, (window_width - subimage_x_offset) - llmax(0, (window_width * (subimage_x + 1)) - (buffer_x_offset + raw->getWidth()))); + for(U32 out_y = 0; out_y < read_height ; out_y++) { S32 output_buffer_offset = ( @@ -4454,7 +4461,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei if (type == SNAPSHOT_TYPE_OBJECT_ID || type == SNAPSHOT_TYPE_COLOR) { glReadPixels( - subimage_x_offset, out_y + subimage_y_offset, + subimage_x_offset, + out_y + subimage_y_offset, read_width, 1, GL_RGB, GL_UNSIGNED_BYTE, raw->getData() + output_buffer_offset @@ -4490,12 +4498,12 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei output_buffer_offset_y += subimage_y_offset; } - if (use_fbo) + /*if (use_fbo) { mWindowRect = window_rect; target.flush(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } + }*/ gDisplaySwapBuffers = FALSE; gDepthDirty = TRUE; @@ -4531,7 +4539,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei ret = raw->scale( image_width, image_height, FALSE ); } -#if SHY_MOD // screenshot improvement +#if 1//SHY_MOD // screenshot improvement if(raw->isBufferInvalid()) //Just checking! return FALSE; if(internal_scale != 1.f) //Scale down our render to the desired dimensions. @@ -4796,6 +4804,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) LLVOAvatar::restoreGL(); gResizeScreenTexture = TRUE; + gWindowResized = TRUE; if (gFloaterCustomize && gFloaterCustomize->getVisible()) { diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 5de38390a..538a6f188 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -289,7 +289,7 @@ public: } ESnapshotType; BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR); BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE, - BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE ); + BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE, F32 supersample = 1.f ); BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ; BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); } void resetSnapshotLoc() const { sSnapshotDir.clear(); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 773299ad1..465285652 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -224,11 +224,7 @@ glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, return ret; } -#if SHY_MOD //screenshot improvement void display_update_camera(bool tiling=false); -#else //shy_mod -void display_update_camera(); -#endif //ignore //---------------------------------------- S32 LLPipeline::sCompiles = 0; @@ -490,22 +486,21 @@ void LLPipeline::resizeScreenTexture() GLuint resX = gViewerWindow->getWindowDisplayWidth(); GLuint resY = gViewerWindow->getWindowDisplayHeight(); - U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); - if (res_mod > 1 && res_mod < resX && res_mod < resY) - { - resX /= res_mod; - resY /= res_mod; - } - allocateScreenBuffer(resX,resY); - - llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl; } } void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { U32 samples = gSavedSettings.getU32("RenderFSAASamples"); + U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); + if (res_mod > 1 && res_mod < resX && res_mod < resY) + { + resX /= res_mod; + resY /= res_mod; + } + + if (LLPipeline::sRenderDeferred) { //allocate deferred rendering color buffers @@ -517,6 +512,14 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { mDeferredLight[i].allocate(resX, resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); } + + //HACK: make alpha masking work on ATI depth shadows (work around for ATI driver bug) + U32 shadow_fmt = 0;/*gGLManager.mIsATI ? GL_ALPHA : 0;*/ + + for (U32 i = 0; i < 4; i++) + { + mSunShadow[i].allocate(1024,1024, shadow_fmt, TRUE, FALSE); + } } else { @@ -524,7 +527,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) } - if (gGLManager.mHasFramebufferMultisample && samples > 1) + if (LLRenderTarget::sUseFBO && gGLManager.mHasFramebufferMultisample && samples > 1) { if (LLPipeline::sRenderDeferred) { @@ -538,6 +541,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) } mScreen.setSampleBuffer(&mSampleBuffer); + stop_glerror(); } else if (LLPipeline::sRenderDeferred) @@ -616,6 +620,9 @@ void LLPipeline::createGLBuffers() stop_glerror(); + GLuint resX = gViewerWindow->getWindowDisplayWidth(); + GLuint resY = gViewerWindow->getWindowDisplayHeight(); + if (LLPipeline::sRenderGlow) { //screen space glow buffers const U32 glow_res = llmax(1, @@ -625,19 +632,12 @@ void LLPipeline::createGLBuffers() { mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); } - } - GLuint resX = gViewerWindow->getWindowDisplayWidth(); - GLuint resY = gViewerWindow->getWindowDisplayHeight(); - - allocateScreenBuffer(resX,resY); + allocateScreenBuffer(resX,resY); + } if (sRenderDeferred) { - mSunShadow[0].allocate(1024,1024, 0, TRUE, FALSE); - mSunShadow[1].allocate(1024,1024, 0, TRUE, FALSE); - mSunShadow[2].allocate(1024,1024, 0, TRUE, FALSE); - mSunShadow[3].allocate(1024,1024, 0, TRUE, FALSE); if (!mNoiseMap) { @@ -5297,7 +5297,7 @@ void LLPipeline::bindScreenToTexture() } -void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) +void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield, bool tiling) { if (!(gPipeline.canUseVertexShaders() && sRenderGlow)) @@ -5316,7 +5316,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } - U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); + static const LLCachedControl res_mod("RenderResolutionDivisor",1); LLVector2 tc1(0,0); LLVector2 tc2((F32) gViewerWindow->getWindowDisplayWidth()*2, @@ -5349,7 +5349,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.setColorMask(true, true); glClearColor(0,0,0,0); - if (for_snapshot) + if (tiling && !LLPipeline::sRenderDeferred) //Need to coax this into working with deferred now that tiling is back. { gGL.getTexUnit(0)->bind(&mGlow[1]); { @@ -5371,7 +5371,6 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ADD); - gGL.begin(LLRender::TRIANGLE_STRIP); gGL.color4f(1,1,1,1); @@ -5410,15 +5409,15 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } gGlowExtractProgram.bind(); - F32 minLum = llmax(gSavedSettings.getF32("RenderGlowMinLuminance"), 0.0f); - F32 maxAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha"); - F32 warmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount"); - LLVector3 lumWeights = gSavedSettings.getVector3("RenderGlowLumWeights"); - LLVector3 warmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights"); - gGlowExtractProgram.uniform1f("minLuminance", minLum); + static const LLCachedControl minLum("RenderGlowMinLuminance",2.5); + static const LLCachedControl maxAlpha("RenderGlowMaxExtractAlpha",0.065f); + static const LLCachedControl warmthAmount("RenderGlowWarmthAmount",0.0f); + static const LLCachedControl lumWeights("RenderGlowLumWeights",LLVector3(.299f,.587f,.114f)); + static const LLCachedControl warmthWeights("RenderGlowWarmthWeights",LLVector3(1.f,.5f,.7f)); + gGlowExtractProgram.uniform1f("minLuminance", llmax(minLum.get(),0.0f)); gGlowExtractProgram.uniform1f("maxExtractAlpha", maxAlpha); - gGlowExtractProgram.uniform3f("lumWeights", lumWeights.mV[0], lumWeights.mV[1], lumWeights.mV[2]); - gGlowExtractProgram.uniform3f("warmthWeights", warmthWeights.mV[0], warmthWeights.mV[1], warmthWeights.mV[2]); + gGlowExtractProgram.uniform3f("lumWeights", lumWeights.get().mV[0], lumWeights.get().mV[1], lumWeights.get().mV[2]); + gGlowExtractProgram.uniform3f("warmthWeights", warmthWeights.get().mV[0], warmthWeights.get().mV[1], warmthWeights.get().mV[2]); gGlowExtractProgram.uniform1f("warmthAmount", warmthAmount); LLGLEnable blend_on(GL_BLEND); LLGLEnable test(GL_ALPHA_TEST); @@ -5455,19 +5454,21 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) // power of two between 1 and 1024 - U32 glowResPow = gSavedSettings.getS32("RenderGlowResolutionPow"); + static const LLCachedControl glowResPow("RenderGlowResolutionPow",9); const U32 glow_res = llmax(1, llmin(1024, 1 << glowResPow)); - S32 kernel = gSavedSettings.getS32("RenderGlowIterations")*2; - F32 delta = gSavedSettings.getF32("RenderGlowWidth") / glow_res; + static const LLCachedControl glow_iters("RenderGlowIterations",2); + S32 kernel = glow_iters*2; + static const LLCachedControl glow_width("RenderGlowWidth",1.3f); + F32 delta = glow_width*zoom_factor/glow_res; // Use half the glow width if we have the res set to less than 9 so that it looks // almost the same in either case. if (glowResPow < 9) { delta *= 0.5f; } - F32 strength = gSavedSettings.getF32("RenderGlowStrength"); + static const LLCachedControl strength("RenderGlowStrength",.35f); gGlowProgram.bind(); gGlowProgram.uniform1f("glowStrength", strength); @@ -5775,6 +5776,12 @@ void LLPipeline::renderDeferredLighting() } LLViewerCamera* camera = LLViewerCamera::getInstance(); + /*{ + LLGLDepthTest depth(GL_TRUE); + mDeferredDepth.copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), + 0, 0, mDeferredDepth.getWidth(), mDeferredDepth.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); + }*/ + LLGLEnable multisample(GL_MULTISAMPLE_ARB); if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) @@ -5830,6 +5837,10 @@ void LLPipeline::renderDeferredLighting() { bindDeferredShader(gDeferredSunProgram); + glClearColor(1,1,1,1); + mDeferredLight[0].clear(GL_COLOR_BUFFER_BIT); + glClearColor(0,0,0,0); + glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose(); const U32 slice = 32; @@ -5854,6 +5865,9 @@ void LLPipeline::renderDeferredLighting() { LLGLDisable blend(GL_BLEND); + //TO-DO: + //V2 changed to LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); + //Do this when multisample z-buffer issues are figured out LLGLDepthTest depth(GL_FALSE); stop_glerror(); glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); @@ -5872,22 +5886,26 @@ void LLPipeline::renderDeferredLighting() //mDeferredLight[1].copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), // 0, 0, mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); - + glClearColor(1,1,1,1); + mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT); + glClearColor(0,0,0,0); + bindDeferredShader(gDeferredBlurLightProgram); - LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian"); - U32 kern_length = llclamp(gSavedSettings.getU32("RenderShadowBlurSamples"), (U32) 1, (U32) 16)*2 - 1; - F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize"); + static const LLCachedControl go("RenderShadowGaussian",LLVector3(2.f,2.f,0.f)); + static const LLCachedControl blur_size("RenderShadowBlurSize",.7f); + static const LLCachedControl blur_samples("RenderShadowBlurSamples",(U32)5); + U32 kern_length = llclamp(blur_samples.get(), (U32) 1, (U32) 16)*2 - 1; - // sample symmetrically with the middle sample falling exactly on 0.0 + // sample symmetrically with the middle sample falling exactly on 0.0 F32 x = -(kern_length/2.0f) + 0.5f; LLVector3 gauss[32]; // xweight, yweight, offset for (U32 i = 0; i < kern_length; i++) { - gauss[i].mV[0] = llgaussian(x, go.mV[0]); - gauss[i].mV[1] = llgaussian(x, go.mV[1]); + gauss[i].mV[0] = llgaussian(x, go.get().mV[0]); + gauss[i].mV[1] = llgaussian(x, go.get().mV[1]); gauss[i].mV[2] = x; x += 1.f; } @@ -5997,6 +6015,7 @@ void LLPipeline::renderDeferredLighting() gPipeline.popRenderTypeMask(); } + gGL.setSceneBlendType(LLRender::BT_ADD); std::list fullscreen_lights; std::list light_colors; @@ -6349,9 +6368,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } - if (gSavedSettings.getBOOL("RenderWaterReflections")) + static const LLCachedControl water_reflections("RenderWaterReflections",false); + if (water_reflections) { //mask out selected geometry based on reflection detail - S32 detail = gSavedSettings.getS32("RenderReflectionDetail"); + static const LLCachedControl detail("RenderReflectionDetail",0); //if (detail > 0) { //mask out selected geometry based on reflection detail { @@ -6376,7 +6396,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS, LLPipeline::RENDER_TYPE_WL_CLOUDS, LLPipeline::END_RENDER_TYPES); - static LLCachedControl skip_distortion_updates("SkipReflectOcclusionUpdates",false); + static const LLCachedControl skip_distortion_updates("SkipReflectOcclusionUpdates",false); LLPipeline::sSkipUpdate = skip_distortion_updates; LLGLUserClipPlane clip_plane(plane, mat, projection); LLGLDisable cull(GL_CULL_FACE); @@ -6553,7 +6573,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) //temporary hack to disable shadows but keep local lights static BOOL clear = TRUE; - BOOL gen_shadow = gSavedSettings.getBOOL("RenderDeferredSunShadow"); + static const LLCachedControl gen_shadow("RenderDeferredSunShadow",false); if (!gen_shadow) { if (clear) @@ -6605,10 +6625,10 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLVector3 up; //clip contains parallel split distances for 3 splits - LLVector3 clip = gSavedSettings.getVector3("RenderShadowClipPlanes"); + static const LLCachedControl clip("RenderShadowClipPlanes",LLVector3(4.f,8.f,24.f)); //far clip on last split is minimum of camera view distance and 128 - mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]); + mSunClipPlanes = LLVector4(clip, clip.get().mV[2] * clip.get().mV[2]/clip.get().mV[1]); const LLPickInfo& pick_info = gViewerWindow->getLastPick(); @@ -6622,11 +6642,14 @@ void LLPipeline::generateSunShadow(LLCamera& camera) F32 dist[] = { 0.1f, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] }; //currently used for amount to extrude frusta corners for constructing shadow frusta - LLVector3 n = gSavedSettings.getVector3("RenderShadowNearDist"); - F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; + static const LLCachedControl n("RenderShadowNearDist",LLVector3(256,256,256)); + F32 nearDist[] = { n.get().mV[0], n.get().mV[1], n.get().mV[2], n.get().mV[2] }; for (S32 j = 0; j < 4; j++) { + + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+j; + //restore render matrices glh_set_current_modelview(saved_view); glh_set_current_projection(saved_proj); @@ -6667,7 +6690,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+j; LLVector3 left = lightDir%at; up = left%lightDir; up.normVec(); @@ -6875,12 +6897,12 @@ void LLPipeline::generateSunShadow(LLCamera& camera) glPopMatrix(); gGLLastMatrix = NULL; - LLPipeline::sUseOcclusion = occlude; - sMinRenderSize = 0.f; + sMinRenderSize = 0.f; mSunShadow[j].flush(); } - if (!gSavedSettings.getBOOL("CameraOffset")) + static const LLCachedControl camera_offset("CameraOffset",false); + if (!camera_offset) { glh_set_current_modelview(saved_view); glh_set_current_projection(saved_proj); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index dfba30c80..0b19e8860 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -99,7 +99,7 @@ public: void setDisableVBOMapping(BOOL no_vbo_mapping); void generateImpostor(LLVOAvatar* avatar); void bindScreenToTexture(); - void renderBloom(BOOL for_snapshot, F32 zoom_factor = 1.f, int subfield = 0); + void renderBloom(BOOL for_snapshot, F32 zoom_factor = 1.f, int subfield = 0, bool tiling = false); void init(); void cleanup();