From ab20e881ce1beee935516e8ee330401fcd59a92c Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 20 Apr 2011 20:08:42 -0500 Subject: [PATCH 1/7] Local-lights now display in deferred Fixed LLCachedControl caching invalid values --- indra/llxml/llcontrol.h | 10 ++- indra/newview/pipeline.cpp | 129 ++++++++++++++++++++++--------------- 2 files changed, 87 insertions(+), 52 deletions(-) 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/pipeline.cpp b/indra/newview/pipeline.cpp index c1299f3ac..ee9cb11da 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -490,22 +490,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 +516,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 +531,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 +545,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) } mScreen.setSampleBuffer(&mSampleBuffer); + stop_glerror(); } else if (LLPipeline::sRenderDeferred) @@ -616,6 +624,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 +636,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) { @@ -5315,7 +5319,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, @@ -5409,15 +5413,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); @@ -5454,19 +5458,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);//*2; + S32 kernel = glow_iters*2; + static const LLCachedControl glow_width("RenderGlowWidth",1.3f);// / glow_res; + F32 delta = glow_width/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); @@ -5774,6 +5780,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)) @@ -5829,6 +5841,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; @@ -5853,6 +5869,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); @@ -5871,22 +5890,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",.7); + 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; } @@ -5996,6 +6019,7 @@ void LLPipeline::renderDeferredLighting() gPipeline.popRenderTypeMask(); } + gGL.setSceneBlendType(LLRender::BT_ADD); std::list fullscreen_lights; std::list light_colors; @@ -6348,9 +6372,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 { @@ -6375,7 +6400,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); @@ -6552,7 +6577,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) @@ -6604,10 +6629,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(); @@ -6621,11 +6646,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); @@ -6666,7 +6694,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+j; LLVector3 left = lightDir%at; up = left%lightDir; up.normVec(); @@ -6874,12 +6901,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); From 98c2b7e11fe080a1e01d01adfa383f8616da7475 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 21 Apr 2011 23:36:41 -0500 Subject: [PATCH 2/7] Sorted out high-res snapshot issues. LL has since removed high-res snapshots using render targets. I find this change to be favorable, as rendertargets were very finicky to get working with anti-aliasing. Also, deferred rendering uses many rendertargets that depend on screen resolution. Changing resolution every screenshot is.. not very awesome. There is some deviation from LL's viewer. I've kept the old tiled glow pass enabled for non-deferred, as it fixes issues with tile edges truncating glow propogation. However, this does no work with deferred yet. I need to pin down why. I assume using binding one of the RenderTargets is required for deferred. Additionally, the usage of a RenderTarget for snapshots is what prevented me from fully enabling my supersampling settings. Now that that hurdle is gone, I consider including this new setting by default to be safe enough. And a note: Do not remove the 'tiling' variable when merging with v2 changes, as singu's glow pass is 'special'. There are other fixes absent from LL's viewer that require knowing if the render is tiled or not. (water reflections/cloud freezing) --- indra/newview/llviewerdisplay.cpp | 51 +++++++++++------------- indra/newview/llviewerdisplay.h | 7 +--- indra/newview/llviewermenufile.cpp | 2 +- indra/newview/llviewerwindow.cpp | 64 ++++++++++++++++-------------- indra/newview/pipeline.cpp | 15 +++---- indra/newview/pipeline.h | 2 +- 6 files changed, 66 insertions(+), 75 deletions(-) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 4998a7f9e..bd1ca2863 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -105,6 +105,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 @@ -114,7 +115,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(); @@ -167,11 +168,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? @@ -180,7 +177,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); @@ -188,7 +184,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; @@ -233,18 +228,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) { @@ -603,11 +606,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 @@ -680,7 +679,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"); @@ -703,7 +702,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 @@ -739,11 +738,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()); @@ -878,7 +873,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(); @@ -922,7 +917,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { gPipeline.mDeferredScreen.flush(); } - else + else if(!tiling) { gPipeline.mScreen.flush(); } @@ -1136,7 +1131,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(); @@ -1151,7 +1146,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 a706b02ab..fbbfb26aa 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -571,7 +571,7 @@ class LLFileTakeSnapshotToDisk : public view_listener_t 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; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 501126abd..d45ae4193 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; @@ -2130,6 +2130,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) return; } + gWindowResized = TRUE; glViewport(0, 0, width, height ); if (height > 0) @@ -4278,21 +4279,27 @@ 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 + //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 = 1.f; - static const LLCachedControl force_tile("SHHighResSnapshotForceTile",false); - if(force_tile) + //if(force_tile) { static const LLCachedControl super_sample_scale("SHHighResSnapshotSuperSample",1.f); internal_scale = llmax(super_sample_scale.get(),1.f); @@ -4313,10 +4320,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); @@ -4336,12 +4341,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. @@ -4351,9 +4357,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 { @@ -4418,20 +4424,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 = ( @@ -4451,7 +4453,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 @@ -4487,12 +4490,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; @@ -4528,7 +4531,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. @@ -4793,6 +4796,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) LLVOAvatar::restoreGL(); gResizeScreenTexture = TRUE; + gWindowResized = TRUE; if (gFloaterCustomize && gFloaterCustomize->getVisible()) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ee9cb11da..1394b592a 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; @@ -5300,7 +5296,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)) @@ -5352,7 +5348,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]); { @@ -5374,7 +5370,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); @@ -5462,10 +5457,10 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) const U32 glow_res = llmax(1, llmin(1024, 1 << glowResPow)); - static const LLCachedControl glow_iters("RenderGlowIterations",2);//*2; + static const LLCachedControl glow_iters("RenderGlowIterations",2); S32 kernel = glow_iters*2; - static const LLCachedControl glow_width("RenderGlowWidth",1.3f);// / glow_res; - F32 delta = glow_width/glow_res; + 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) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index a7b318c60..6d524e773 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(); From 0b1b7c6618da3813334f4bacacf44d783fca0b58 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 23 Apr 2011 00:58:27 -0500 Subject: [PATCH 3/7] Fixed issues with changing AA and AF... -AF change no longer reloads the window to apply. Doing such isn't needed anymore. -AA change no longer reloads the window to apply, IFF RenderUseFBO is true. -AA change, IFF RenderUseFBO is false, reloads window. Texture issues under this scenario should be resolved. -LLComboBox now updates control_name it's linked to, automatically. -New LLComboBox Behavor when paired with new AA/AF application changes renders LLFloaterHardwareSettings::apply() pointless, EXCEPT for when changing AA while FBOs are off. --- indra/llrender/llimagegl.cpp | 12 ++++++++- indra/llui/llcombobox.cpp | 2 ++ indra/newview/llfloaterhardwaresettings.cpp | 28 ++++++--------------- indra/newview/llviewercontrol.cpp | 17 +++++++++++++ 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 60c3582d8..b0660f9df 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -301,11 +301,13 @@ S32 LLImageGL::updateBoundTexMem()const //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++) @@ -320,18 +322,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++) { @@ -346,10 +354,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 @@ -1281,7 +1291,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 8f33e40fc..2e1167223 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/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 3b721c6ba..9a420a37b 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 8adbde0d5..9859a8883 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -121,6 +121,14 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue) static bool handleSetShaderChanged(const LLSD& newvalue) { + + // 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; } @@ -184,6 +192,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(); @@ -549,6 +564,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)); From f190644464a4503240e6faba7cf6acd67c8ae379 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 23 Apr 2011 00:59:20 -0500 Subject: [PATCH 4/7] LLDrawPoolWater::shade no longer binds diffuse texture if nonexistant or unused by shader. (was firing a warning upon bind) --- indra/newview/lldrawpoolwater.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 4b9f55946..d4e417284 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -552,7 +552,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; @@ -570,6 +571,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); } } From c694d12c93e976692a2ba5afecf121507e54c69a Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 23 Apr 2011 01:01:55 -0500 Subject: [PATCH 5/7] Bringing in-line with V2. mbstowcs->MultiByteToWideChar, ancient comment removal, fullscreen behavior check... --- indra/llwindow/llwindowwin32.cpp | 84 ++++---------------------------- indra/newview/llviewerwindow.cpp | 12 ++++- 2 files changed, 21 insertions(+), 75 deletions(-) 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/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d45ae4193..5f1c52ae3 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -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 "< Date: Sat, 23 Apr 2011 03:02:56 -0500 Subject: [PATCH 6/7] Nuking some glsl warnings, and fixing relwithdebug compile(and prolly gcc too) --- indra/newview/app_settings/shaders/class1/effects/glowF.glsl | 2 ++ indra/newview/app_settings/shaders/class2/effects/blurF.glsl | 2 ++ .../app_settings/shaders/class2/effects/colorFilterF.glsl | 2 ++ .../newview/app_settings/shaders/class2/effects/extractF.glsl | 2 ++ .../app_settings/shaders/class2/effects/gaussBlurF.glsl | 3 +++ .../app_settings/shaders/class2/effects/nightVisionF.glsl | 2 ++ indra/newview/app_settings/shaders/class2/effects/simpleF.glsl | 2 ++ indra/newview/pipeline.cpp | 2 +- 8 files changed, 16 insertions(+), 1 deletion(-) 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/pipeline.cpp b/indra/newview/pipeline.cpp index 1394b592a..5c69cb18c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -5892,7 +5892,7 @@ void LLPipeline::renderDeferredLighting() bindDeferredShader(gDeferredBlurLightProgram); static const LLCachedControl go("RenderShadowGaussian",LLVector3(2.f,2.f,0.f)); - static const LLCachedControl blur_size("RenderShadowBlurSize",.7); + 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; From f7a53949048a2dc9883ffa89237d1c8a8cf28000 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 23 Apr 2011 17:51:29 -0500 Subject: [PATCH 7/7] Super-sampling only to be done when taking a snapshot to disk in high-res mode. Clamping to 3x. Removed 'SHHighResSnapshotForceTile' setting, as tiling is now the only way snapshots can be done. --- indra/newview/app_settings/settings_sh.xml | 11 ----------- indra/newview/llviewermenufile.cpp | 8 +++++++- indra/newview/llviewerwindow.cpp | 9 ++------- indra/newview/llviewerwindow.h | 2 +- 4 files changed, 10 insertions(+), 20 deletions(-) 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/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index fbbfb26aa..3f87901dc 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 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 5f1c52ae3..5a468ef7f 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4259,7 +4259,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) { @@ -4308,12 +4308,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei static const LLCachedControl force_tile("SHHighResSnapshotForceTile",false);*/ #if 1//SHY_MOD // screenshot improvement - F32 internal_scale = 1.f; - //if(force_tile) - { - static const LLCachedControl super_sample_scale("SHHighResSnapshotSuperSample",1.f); - internal_scale = llmax(super_sample_scale.get(),1.f); - } + 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; 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(); }