diff options
-rw-r--r-- | indra/cmake/00-Common.cmake | 6 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 52 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.h | 7 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltooltip.cpp | 32 | ||||
-rw-r--r-- | indra/llui/lltooltip.h | 18 | ||||
-rw-r--r-- | indra/newview/llnetmap.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llsidetray.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 31 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 21 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 2 |
12 files changed, 135 insertions, 45 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index db5495091e..b159092592 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -35,13 +35,13 @@ if (WINDOWS) # Don't build DLLs. set(BUILD_SHARED_LIBS OFF) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd" + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP" CACHE STRING "C++ compiler debug options" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD" + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP" CACHE STRING "C++ compiler release-with-debug options" FORCE) set(CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD" + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP" CACHE STRING "C++ compiler release options" FORCE) set(CMAKE_CXX_STANDARD_LIBRARIES "") diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index d9520b3bf6..f0df3bcf90 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -61,8 +61,11 @@ BOOL LLRenderTarget::sUseFBO = FALSE; LLRenderTarget::LLRenderTarget() : mResX(0), mResY(0), + mViewportWidth(0), + mViewportHeight(0), mTex(0), mFBO(0), + mColorFmt(0), mDepth(0), mStencil(0), mUseDepth(FALSE), @@ -86,13 +89,31 @@ void LLRenderTarget::setSampleBuffer(LLMultisampleBuffer* buffer) void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo) { + // only reallocate if something changed + if (mResX == resx + && mResY == resy + && mUseDepth == depth + && mStencil == stencil + && mUsage == usage + && (mFBO != 0) == ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) + && mColorFmt == color_fmt) + { + // nothing to do + return; + } + stop_glerror(); mResX = resx; mResY = resy; + // default viewport to entire texture + mViewportWidth = mResX; + mViewportHeight = mResY; mStencil = stencil; mUsage = usage; mUseDepth = depth; + mFBO = 0; + mColorFmt = color_fmt; release(); @@ -312,7 +333,7 @@ void LLRenderTarget::bindTarget() } } - glViewport(0, 0, mResX, mResY); + glViewport(0, 0, mViewportWidth, mViewportHeight); sBoundTarget = this; } @@ -515,12 +536,18 @@ BOOL LLRenderTarget::isComplete() const return (!mTex.empty() || mDepth) ? TRUE : FALSE; } +void LLRenderTarget::setViewport(U32 width, U32 height) +{ + mViewportWidth = llmin(width, mResX); + mViewportHeight = llmin(height, mResY); +} + void LLRenderTarget::getViewport(S32* viewport) { viewport[0] = 0; viewport[1] = 0; - viewport[2] = mResX; - viewport[3] = mResY; + viewport[2] = mViewportWidth; + viewport[3] = mViewportHeight; } //================================================== @@ -581,7 +608,7 @@ void LLMultisampleBuffer::bindTarget(LLRenderTarget* ref) check_framebuffer_status(); - glViewport(0, 0, mResX, mResY); + glViewport(0, 0, mViewportWidth, mViewportHeight); sBoundTarget = this; } @@ -593,13 +620,30 @@ void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo, U32 samples ) { + if (mResX == resx + && mResY == resy + && mUseDepth == depth + && mStencil == stencil + && mUsage == usage + && (mFBO != 0) == ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) + && mColorFmt == color_fmt + && mSamples == samples) + { + // nothing to do + return; + } + stop_glerror(); mResX = resx; mResY = resy; + mViewportWidth = mResX; + mViewportHeight = mResY; mUsage = usage; mUseDepth = depth; mStencil = stencil; + mFBO = 0; + mColorFmt = color_fmt; releaseSampleBuffer(); diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index b7ebfc8f7f..125747424c 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -107,6 +107,9 @@ public: //uses scissor rect if in copy-to-texture mode void clear(U32 mask = 0xFFFFFFFF); + // override default viewport to a smaller size + void setViewport(U32 width, U32 height); + //get applied viewport void getViewport(S32* viewport); @@ -150,12 +153,16 @@ protected: friend class LLMultisampleBuffer; U32 mResX; U32 mResY; + U32 mViewportWidth; + U32 mViewportHeight; std::vector<U32> mTex; U32 mFBO; + U32 mColorFmt; U32 mDepth; BOOL mStencil; BOOL mUseDepth; BOOL mRenderDepth; + LLTexUnit::eTextureType mUsage; U32 mSamples; LLMultisampleBuffer* mSampleBuffer; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 07c0f3ce84..89c4656297 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -512,6 +512,8 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu // add children using dimensions from referenced xml for consistent layout setShape(params.rect); LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance()); + + setXMLFilename(xml_filename); } // ask LLUICtrlFactory for filename, since xml_filename might be empty diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 8d36c9c616..c819ed4fec 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2369,7 +2369,9 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt height = mFontHeight; width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars); - return num_chars >= 1 && text[mStart + num_chars - 1] == '\n'; + // if last character is a newline, then return true, forcing line break + llwchar last_char = text[mStart + first_char + num_chars - 1]; + return num_chars >= 1 && last_char == '\n'; } S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 984a534da6..bb85177811 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -172,7 +172,6 @@ LLToolTip::Params::Params() LLToolTip::LLToolTip(const LLToolTip::Params& p) : LLPanel(p), - mMaxWidth(p.max_width), mHasClickCallback(p.click_callback.isProvided()), mPadding(p.padding), mTextBox(NULL), @@ -181,11 +180,9 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) mHomePageButton(NULL) { LLTextBox::Params params; - params.initial_value = "tip_text"; params.name = params.initial_value().asString(); // bake textbox padding into initial rect params.rect = LLRect (mPadding, mPadding + 1, mPadding + 1, mPadding); - params.follows.flags = FOLLOWS_ALL; params.h_pad = 0; params.v_pad = 0; params.mouse_opaque = false; @@ -210,7 +207,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16); icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE); icon_params.rect = icon_rect; - //icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM; icon_params.image_unselected(imagep); icon_params.image_selected(imagep); @@ -281,15 +277,30 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) } } -void LLToolTip::setValue(const LLSD& value) +void LLToolTip::initFromParams(const LLToolTip::Params& p) { + LLPanel::initFromParams(p); + + // do this *after* we've had our size set in LLPanel::initFromParams(); const S32 REALLY_LARGE_HEIGHT = 10000; - reshape(mMaxWidth, REALLY_LARGE_HEIGHT); + mTextBox->reshape(p.max_width, REALLY_LARGE_HEIGHT); - mTextBox->setValue(value); + if (p.styled_message.isProvided()) + { + for (LLInitParam::ParamIterator<LLToolTip::StyledText>::const_iterator text_it = p.styled_message().begin(); + text_it != p.styled_message().end(); + ++text_it) + { + mTextBox->appendText(text_it->text(), false, text_it->style); + } + } + else + { + mTextBox->setText(p.message()); + } LLRect text_contents_rect = mTextBox->getContentsRect(); - S32 text_width = llmin(mMaxWidth, text_contents_rect.getWidth()); + S32 text_width = llmin(p.max_width(), text_contents_rect.getWidth()); S32 text_height = text_contents_rect.getHeight(); mTextBox->reshape(text_width, text_height); @@ -300,7 +311,7 @@ void LLToolTip::setValue(const LLSD& value) tooltip_rect.mBottom = 0; tooltip_rect.mLeft = 0; - setRect(tooltip_rect); + setShape(tooltip_rect); } void LLToolTip::setVisible(BOOL visible) @@ -411,9 +422,8 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) } tooltip_params.rect = LLRect (0, 1, 1, 0); - mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params); - mToolTip->setValue(params.message()); + gToolTipView->addChild(mToolTip); if (params.pos.isProvided()) diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 774ca507c1..8c8fdf0a4c 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -37,6 +37,7 @@ #include "llsingleton.h" #include "llinitparam.h" #include "llpanel.h" +#include "llstyle.h" // // Classes @@ -65,11 +66,19 @@ public: class LLToolTip : public LLPanel { public: + + struct StyledText : public LLInitParam::Block<StyledText> + { + Mandatory<std::string> text; + Optional<LLStyle::Params> style; + }; + struct Params : public LLInitParam::Block<Params, LLPanel::Params> { typedef boost::function<void(void)> click_callback_t; - Mandatory<std::string> message; + Optional<std::string> message; + Multiple<StyledText> styled_message; Optional<LLCoordGL> pos; Optional<F32> delay_time, @@ -85,8 +94,8 @@ public: Optional<click_callback_t> click_callback, click_playmedia_callback, click_homepage_callback; - Optional<S32> max_width; - Optional<S32> padding; + Optional<S32> max_width, + padding; Optional<bool> wrap; Params(); @@ -94,7 +103,6 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ void setValue(const LLSD& value); /*virtual*/ void setVisible(BOOL visible); bool isFading(); @@ -102,6 +110,7 @@ public: bool hasClickCallback(); LLToolTip(const Params& p); + void initFromParams(const LLToolTip::Params& params); private: class LLTextBox* mTextBox; @@ -111,7 +120,6 @@ private: LLFrameTimer mFadeTimer; LLFrameTimer mVisibleTimer; - S32 mMaxWidth; bool mHasClickCallback; S32 mPadding; // pixels }; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 4286582cdc..6145588df2 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -155,11 +155,9 @@ void LLNetMap::draw() F32 rotation = 0; { - LLGLEnable scissor(GL_SCISSOR_TEST); - + LLLocalClipRect clip(getLocalRect()); { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLLocalClipRect clip(getLocalRect()); glMatrixMode(GL_MODELVIEW); diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 3d0b4de88a..34b3b00ff2 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -101,6 +101,7 @@ LLSideTray* LLSideTray::getInstance() if (!sInstance) { sInstance = LLUICtrlFactory::createFromFile<LLSideTray>("panel_side_tray.xml",NULL, LLRootView::child_registry_t::instance()); + sInstance->setXMLFilename("panel_side_tray.xml"); } return sInstance; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d69cc5999c..1054223dcf 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2302,13 +2302,13 @@ void LLViewerWindow::moveCursorToCenter() // Hover handlers // -void append_xui_tooltip(LLView* viewp, std::string& tool_tip_msg) +void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params) { if (viewp) { - if (!tool_tip_msg.empty()) + if (!params.styled_message().empty()) { - tool_tip_msg.append("\n---------\n"); + params.styled_message.add().text("\n---------\n"); } LLView::root_to_view_iterator_t end_tooltip_it = viewp->endRootToView(); // NOTE: we skip "root" since it is assumed @@ -2318,15 +2318,16 @@ void append_xui_tooltip(LLView* viewp, std::string& tool_tip_msg) { LLView* viewp = *tooltip_it; - tool_tip_msg.append(viewp->getName()); + params.styled_message.add().text(viewp->getName()); + LLPanel* panelp = dynamic_cast<LLPanel*>(viewp); if (panelp && !panelp->getXMLFilename().empty()) { - tool_tip_msg.append("("); - tool_tip_msg.append(panelp->getXMLFilename()); - tool_tip_msg.append(")"); + params.styled_message.add() + .text("(" + panelp->getXMLFilename() + ")") + .style.color(LLColor4(0.7f, 0.7f, 1.f, 1.f)); } - tool_tip_msg.append("/"); + params.styled_message.add().text("/"); } } } @@ -2567,6 +2568,8 @@ void LLViewerWindow::updateUI() if (gSavedSettings.getBOOL("DebugShowXUINames")) { + LLToolTip::Params params; + LLView* tooltip_view = mRootView; LLView::tree_iterator_t end_it = mRootView->endTreeDFS(); for (LLView::tree_iterator_t it = mRootView->beginTreeDFS(); it != end_it; ++it) @@ -2599,20 +2602,20 @@ void LLViewerWindow::updateUI() // NOTE: this emulates visiting only the leaf nodes that meet our criteria if (!viewp->hasAncestor(tooltip_view)) { - append_xui_tooltip(tooltip_view, tool_tip_msg); + append_xui_tooltip(tooltip_view, params); screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect()); } tooltip_view = viewp; } } - append_xui_tooltip(tooltip_view, tool_tip_msg); + append_xui_tooltip(tooltip_view, params); screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect()); - LLToolTipMgr::instance().show(LLToolTip::Params() - .message(tool_tip_msg) - .sticky_rect(screen_sticky_rect) - .max_width(400)); + params.sticky_rect = screen_sticky_rect; + params.max_width = 400; + + LLToolTipMgr::instance().show(params); } // if there is a mouse captor, nothing else gets a tooltip else if (mouse_captor) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1129e9ffd1..73a91bbbc0 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -514,14 +514,16 @@ void LLPipeline::resizeScreenTexture() { GLuint resX = gViewerWindow->getWorldViewWidthRaw(); GLuint resY = gViewerWindow->getWorldViewHeightRaw(); + GLuint view_width = gViewerWindow->getWorldViewWidth(); + GLuint view_height = gViewerWindow->getWorldViewHeight(); - allocateScreenBuffer(resX,resY); + allocateScreenBuffer(resX, resY, view_width, view_height); llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl; } } -void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) +void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height) { U32 samples = gSavedSettings.getU32("RenderFSAASamples"); @@ -542,18 +544,24 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) //allocate deferred rendering color buffers mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); + mDeferredScreen.setViewport(viewport_width, viewport_height); + mDeferredDepth.setViewport(viewport_width, viewport_height); addDeferredAttachments(mDeferredScreen); mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); mEdgeMap.allocate(resX, resY, GL_ALPHA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); + mScreen.setViewport(viewport_width, viewport_height); + mEdgeMap.setViewport(viewport_width, viewport_height); for (U32 i = 0; i < 3; i++) { mDeferredLight[i].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); + mDeferredLight[i].setViewport(viewport_width, viewport_height); } for (U32 i = 0; i < 2; i++) { mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); + mGIMapPost[i].setViewport(viewport_width, viewport_height); } F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale"); @@ -561,6 +569,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) for (U32 i = 0; i < 4; i++) { mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE); + mShadow[i].setViewport(viewport_width, viewport_height); } @@ -570,6 +579,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) for (U32 i = 4; i < 6; i++) { mShadow[i].allocate(width, height, 0, TRUE, FALSE); + mShadow[i].setViewport(viewport_width, viewport_height); } @@ -577,16 +587,19 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) width = nhpo2(resX)/2; height = nhpo2(resY)/2; mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE); + mLuminanceMap.setViewport(viewport_width, viewport_height); } else { mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); + mScreen.setViewport(viewport_width, viewport_height); } if (gGLManager.mHasFramebufferMultisample && samples > 1) { mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); + mSampleBuffer.setViewport(viewport_width, viewport_height); mScreen.setSampleBuffer(&mSampleBuffer); if (LLPipeline::sRenderDeferred) @@ -700,6 +713,8 @@ void LLPipeline::createGLBuffers() GLuint resX = gViewerWindow->getWorldViewWidthRaw(); GLuint resY = gViewerWindow->getWorldViewHeightRaw(); + GLuint viewport_width = gViewerWindow->getWorldViewWidth(); + GLuint viewport_height = gViewerWindow->getWorldViewHeight(); if (LLPipeline::sRenderGlow) { //screen space glow buffers @@ -711,7 +726,7 @@ void LLPipeline::createGLBuffers() mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); } - allocateScreenBuffer(resX,resY); + allocateScreenBuffer(resX,resY, viewport_width, viewport_height); } if (sRenderDeferred) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index ce50a37405..9193e19bb1 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -111,7 +111,7 @@ public: void resizeScreenTexture(); void releaseGLBuffers(); void createGLBuffers(); - void allocateScreenBuffer(U32 resX, U32 resY); + void allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height); void resetVertexBuffers(LLDrawable* drawable); void setUseVBO(BOOL use_vbo); |