diff options
Diffstat (limited to 'indra')
25 files changed, 1312 insertions, 1277 deletions
| diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index d058f50c97..9267c5cbda 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -88,7 +88,6 @@ extern thread_local bool gProfilerEnabled;      #endif -      #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY          #define LL_PROFILER_FRAME_END                   FrameMark          #define LL_PROFILER_SET_THREAD_NAME( name )     tracy::SetThreadName( name );    gProfilerEnabled = true; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index d0e268f08c..70993393ff 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1,4 +1,4 @@ -/** + /**   * @file llrender.cpp   * @brief LLRender implementation   * @@ -139,21 +139,21 @@ U32 LLTexUnit::getInternalType(eTextureType type)  void LLTexUnit::refreshState(void)  { -// We set dirty to true so that the tex unit knows to ignore caching -// and we reset the cached tex unit state +    // We set dirty to true so that the tex unit knows to ignore caching +    // and we reset the cached tex unit state -gGL.flush(); +    gGL.flush(); -glActiveTexture(GL_TEXTURE0 + mIndex); +    glActiveTexture(GL_TEXTURE0 + mIndex); -if (mCurrTexType != TT_NONE) -{ -    glBindTexture(sGLTextureType[mCurrTexType], mCurrTexture); -} -else -{ -    glBindTexture(GL_TEXTURE_2D, 0); -} +    if (mCurrTexType != TT_NONE) +    { +        glBindTexture(sGLTextureType[mCurrTexType], mCurrTexture); +    } +    else +    { +        glBindTexture(GL_TEXTURE_2D, 0); +    }  }  void LLTexUnit::activate(void) @@ -660,12 +660,12 @@ void LLTexUnit::debugTextureUnit(void)  LLLightState::LLLightState(S32 index)  : mIndex(index), -mEnabled(false), -mConstantAtten(1.f), -mLinearAtten(0.f), -mQuadraticAtten(0.f), -mSpotExponent(0.f), -mSpotCutoff(180.f) +  mEnabled(false), +  mConstantAtten(1.f), +  mLinearAtten(0.f), +  mQuadraticAtten(0.f), +  mSpotExponent(0.f), +  mSpotCutoff(180.f)  {      if (mIndex == 0)      { @@ -824,7 +824,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction)  }  LLRender::LLRender() -: mDirty(false), +  : mDirty(false),      mCount(0),      mMode(LLRender::TRIANGLES),      mCurrTextureUnitIndex(0) @@ -1455,7 +1455,7 @@ void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)  }  void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, -            eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor) +             eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor)  {      llassert(color_sfactor < BF_UNDEF);      llassert(color_dfactor < BF_UNDEF); @@ -1472,7 +1472,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,          flush();          glBlendFuncSeparate(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], -                        sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); +                           sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]);      }  } @@ -1611,8 +1611,8 @@ void LLRender::flush(std::string comment_)          {              if (mCount%3 != 0)              { -                count -= (mCount % 3); -                LL_WARNS() << "Incomplete triangle requested." << LL_ENDL; +            count -= (mCount % 3); +            LL_WARNS() << "Incomplete triangle requested." << LL_ENDL;              }          } @@ -1666,6 +1666,11 @@ void LLRender::flush(std::string comment_)      LOG_GLERROR("LLRender::flush() end " + comment_);  } +void LLRender::flush() +{ +    flush(""); +} +  LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count)  {      LLVertexBuffer *vb = nullptr; @@ -2129,9 +2134,9 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)  #if 1 // SIMD path results in strange crashes. Fall back to scalar for now.      const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];      return glm::vec3( -    (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w, -    (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w, -    (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w +       (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w, +       (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w, +       (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w      );  #else      LLVector4a x, y, z, s, t, p, q; diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index f0f9cd4364..a755ddd2b1 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -421,7 +421,8 @@ public:      LLVector3 getUITranslation();      LLVector3 getUIScale(); -    void flush(std::string comment_ = ""); +    void flush(std::string comment_); +    void flush();      // if list is set, will store buffers in list for later use, if list isn't set, will use cache      void beginList(std::list<LLVertexBufferData> *list); diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 0ee47dec6d..714df863cd 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -1801,10 +1801,12 @@ void LLRender2D::setLineWidth(F32 width)      // If outside the allowed range, glLineWidth fails with "invalid value".      // On Darwin, the range is [1, 1].      static GLfloat range[2]{0.0}; +#if GL_VERSION_1_2      if (range[1] == 0)      {          glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, range);      } +#endif      width *= lerp(LLRender::sUIGLScaleFactor.mV[VX], LLRender::sUIGLScaleFactor.mV[VY], 0.5f);      glLineWidth(llclamp(width, range[0], range[1]));  } diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 957c85b606..ddb2bf5df7 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -511,9 +511,10 @@ void LLRenderTarget::bindTarget(std::string name_, U32 mode_)                              GL_COLOR_ATTACHMENT3};      if (mTex.empty()) -    {   //no color buffer to draw to +    { //no color buffer to draw to          if(!mUseDepth) LL_WARNS() << mName << " HAS NO COLOR BUFFER AND NO DEPTH!!" << LL_ENDL; -        glDrawBuffer(GL_NONE); +        GLenum buffers[] = {GL_NONE}; +        glDrawBuffers(0, buffers);          glReadBuffer(GL_NONE);      }      else if(mMode == 0) @@ -532,7 +533,8 @@ void LLRenderTarget::bindTarget(std::string name_, U32 mode_)      }      else if(mMode == 2)      { -        glDrawBuffer(GL_NONE); +        GLenum buffers[] = {GL_NONE}; +        glDrawBuffers(0, buffers);          glReadBuffer(GL_COLOR_ATTACHMENT0);          LOG_GLERROR(mName+" read buffer");      } @@ -724,4 +726,4 @@ U32 LLRenderTarget::getTarget()      else if(mMode == 2) target = GL_READ_FRAMEBUFFER;      return target; -}
\ No newline at end of file +} diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 583d0054ac..ce3025f280 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -33,9 +33,9 @@  #include "llrender.h"  /* -Wrapper around OpenGL framebuffer objects for use in render-to-texture + Wrapper around OpenGL framebuffer objects for use in render-to-texture -SAMPLE USAGE: + SAMPLE USAGE:      LLRenderTarget target; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 3bc71a7413..6a3f88f9d3 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -451,7 +451,7 @@ void LLShaderMgr::dumpObjectLog(GLuint ret, bool warns, const std::string& filen          LL_SHADER_LOADING_WARNS() << "Shader loading from " << fname << LL_ENDL;          LL_SHADER_LOADING_WARNS() << "\n" << log << LL_ENDL;      } -} + }  GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map<std::string, std::string>* defines, S32 texture_index_channels)  { @@ -740,7 +740,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev      //copy file into memory      enum { -        flag_write_to_out_of_extra_block_area = 0x01 +          flag_write_to_out_of_extra_block_area = 0x01          , flag_extra_block_marker_was_found = 0x02      }; @@ -756,7 +756,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev  #endif      while(NULL != fgets((char *)buff, 1024, file) -        && shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text))) +          && shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text)))      {          file_lines_count++; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 2a0acab05a..43d780a383 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1675,7 +1675,9 @@ void LLVertexBuffer::setBuffer()      U32 data_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask;      // this Vertex Buffer must provide all necessary attributes for currently bound shader -    llassert_msg((data_mask & mTypeMask) == data_mask, "Attribute mask mismatch! mTypeMask should be a superset of data_mask.  data_mask: 0x" << std::hex << data_mask << " mTypeMask: 0x" << mTypeMask << " Missing: 0x" << (data_mask & ~mTypeMask) <<  std::dec); +    llassert_msg((data_mask & mTypeMask) == data_mask, +        "Attribute mask mismatch! mTypeMask should be a superset of data_mask.  data_mask: 0x" +                << std::hex << data_mask << " mTypeMask: 0x" << mTypeMask << " Missing: 0x" << (data_mask & ~mTypeMask) <<  std::dec);      if (sGLRenderBuffer != mGLBuffer)      { diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a614884cea..c93da4c576 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11565,6 +11565,17 @@        <key>Value</key>        <integer>75</integer>      </map> +    <key>SnapshotTimestamp</key> +    <map> +      <key>Comment</key> +      <string>Add timestamp to snapshot file names</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map>      <key>AbuseReportScreenshotDelay</key>      <map>        <key>Comment</key> diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 1618d91b98..ac052d35e4 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -403,7 +403,7 @@ void LLFastTimerView::draw()      legend_panel->localRectToOtherView(legend_panel->getLocalRect(), &mLegendRect, this);      // Draw the window background -    gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +            gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);      gl_rect_2d(getLocalRect(), LLColor4(0.f, 0.f, 0.f, 0.25f));      drawHelp(getRect().getHeight() - MARGIN); diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp index daa3d62efe..0b792efa1f 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.cpp +++ b/indra/newview/llgltfmaterialpreviewmgr.cpp @@ -527,9 +527,9 @@ bool LLGLTFPreviewTexture::render()      if (hdr)      { -        gPipeline.copyScreenSpaceReflections(&screen, &gPipeline.mSceneMap); -        gPipeline.generateLuminance(&screen, &gPipeline.mLuminanceMap); -        gPipeline.generateExposure(&gPipeline.mLuminanceMap, &gPipeline.mExposureMap, /*use_history = */ false); +    gPipeline.copyScreenSpaceReflections(&screen, &gPipeline.mSceneMap); +    gPipeline.generateLuminance(&screen, &gPipeline.mLuminanceMap); +    gPipeline.generateExposure(&gPipeline.mLuminanceMap, &gPipeline.mExposureMap, /*use_history = */ false);      }      U16 activeRT = 0; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 4d27e3d92e..01d4ccecdd 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3717,10 +3717,14 @@ bool LLModelPreview::render()                                      buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);                                      gGL.diffuseColor4fv(PREVIEW_PSYH_EDGE_COL.mV); +#if GL_VERSION_1_1                                      glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); +#endif                                      buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0); +#if GL_VERSION_1_1                                      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); +#endif                                      buffer->unmapBuffer();                                  } @@ -3732,7 +3736,9 @@ bool LLModelPreview::render()                      // only do this if mDegenerate was set in the preceding mesh checks [Check this if the ordering ever breaks]                      if (mHasDegenerate)                      { +#if GL_VERSION_1_1                          glPointSize(PREVIEW_DEG_POINT_SIZE); +#endif                          gPipeline.enableLightsFullbright();                          //show degenerate triangles                          LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); @@ -3802,7 +3808,9 @@ bool LLModelPreview::render()                              gGL.popMatrix();                          }                          //glLineWidth(1.f); +#if GL_VERSION_1_1                          glPointSize(1.f); +#endif                          gPipeline.enableLightsPreview();                          gGL.setSceneBlendType(LLRender::BT_ALPHA);                      } @@ -3924,9 +3932,13 @@ bool LLModelPreview::render()                                  gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);                                  gGL.diffuseColor4fv(PREVIEW_EDGE_COL.mV);                                  //glLineWidth(PREVIEW_EDGE_WIDTH); +#if GL_VERSION_1_1                                  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); +#endif                                  buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); +#if GL_VERSION_1_1                                  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); +#endif                              }                          }                      } diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 9f8a21694f..d247d3260e 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -445,18 +445,15 @@ void LLReflectionMapManager::update()              d.setSub(camera_pos, probe->mOrigin);              probe->mDistance = d.getLength3().getF32() - probe->mRadius;          } +        else if (mDefaultProbe->mComplete) +        { +            // make default probe have a distance of 64m for the purposes of prioritization (if it's already been generated once) +            probe->mDistance = 64.f; +        }          else          { -            if (mDefaultProbe->mComplete) -            { -                // make default probe have a distance of 64m for the purposes of prioritization (if it's already been generated once) -                probe->mDistance = 64.f; -            } -            else -            { -                probe->mNextUpdateTime = 0.f; -                probe->mDistance = -4096.f; //boost priority of default probe when it's not complete -            } +            probe->mNextUpdateTime = 0.f; +            probe->mDistance = -4096.f; //boost priority of default probe when it's not complete          }          if (probe->mComplete) @@ -487,7 +484,7 @@ void LLReflectionMapManager::update()                  (oldestProbe == nullptr ||                      check_priority(probe, oldestProbe)))              { -                oldestProbe = probe; +               oldestProbe = probe;              }          } @@ -541,7 +538,7 @@ void LLReflectionMapManager::update()      }      else if (sLevel > 0)      { // when probes are enabled don't update the default probe less often than the prescribed update period -        oldestProbe = mDefaultProbe; +      oldestProbe = mDefaultProbe;      }      // switch to updating the next oldest probe @@ -559,10 +556,10 @@ void LLReflectionMapManager::update()          if(shouldUpdate)          { -            probe->autoAdjustOrigin(); +        probe->autoAdjustOrigin(); -            sUpdateCount++; -            mUpdatingProbe = probe; +        sUpdateCount++; +        mUpdatingProbe = probe;              if(probe->mCompletedCount < 2)              { @@ -575,7 +572,7 @@ void LLReflectionMapManager::update()                  probe->mNextUpdateTime = gFrameTimeSeconds + fmax( (F32)sMPUpdatePeriod, 0.25);              } -            doProbeUpdate(); +        doProbeUpdate();          }      } @@ -815,11 +812,8 @@ void LLReflectionMapManager::doProbeUpdate()          {              mUpdatingProbe->mViewerObject->setDebugText(llformat("%.1f", (F32)gFrameTimeSeconds), LLColor4(1, 1, 1, 1));          } -          updateNeighbors(mUpdatingProbe); -          mUpdatingFace = 0; -          if (isRadiancePass())          {              mUpdatingProbe->mComplete = true; @@ -839,7 +833,7 @@ void LLReflectionMapManager::doProbeUpdate()          if (debug_updates)          { -            mUpdatingProbe->mViewerObject->setDebugText(llformat("%.1f", (F32)gFrameTimeSeconds), LLColor4(1, 1, 0, 1)); +        mUpdatingProbe->mViewerObject->setDebugText(llformat("%.1f", (F32)gFrameTimeSeconds), LLColor4(1, 1, 0, 1));          }      }  } @@ -899,7 +893,6 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face, b      LLGLDisable blend(GL_BLEND);      // downsample to placeholder map -      {          gGL.matrixMode(gGL.MM_MODELVIEW);          gGL.pushMatrix(); @@ -944,10 +937,10 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face, b              screen_rt->flush();          } +          S32 mips = (S32)(log2((F32)mProbeResolution) + 0.5f);          gReflectionMipProgram.bind(); -          S32 diffuseChannel = gReflectionMipProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_TEXTURE);          for (int i = 0; i < mMipChain.size(); ++i) @@ -966,6 +959,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face, b                  gGL.getTexUnit(diffuseChannel)->bind(&(mMipChain[i - 1]));              } +              gReflectionMipProgram.uniform1f(resScale, 1.f/(mProbeResolution*2));              gPipeline.mScreenTriangleVB->setBuffer(); @@ -1005,8 +999,8 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face, b          if(isRadiancePass()) updateProbeRadianceOnFace(probe, face, sourceIdx);      } -   // if(isRadiancePass()) updateProbeRadianceOnFace(probe, face, sourceIdx); -    //else updateProbeIrradianceOnFace(probe, face, sourceIdx); +    //  if(isRadiancePass()) updateProbeRadianceOnFace(probe, face, sourceIdx); +    //  else updateProbeIrradianceOnFace(probe, face, sourceIdx);  }  // ===================== IRRADIANCE ================================ @@ -1040,8 +1034,10 @@ void LLReflectionMapManager::updateProbeIrradiance(LLReflectionMap* probe)      gIrradianceGenProgram.bind(); +#if GL_VERSION_4_0      S32 channel = gIrradianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);      mTexture->bind(channel); +#endif      gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx);      gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD); @@ -1076,10 +1072,11 @@ void LLReflectionMapManager::updateProbeIrradiance(LLReflectionMap* probe)          mVertexBuffer->drawArrays(gGL.TRIANGLE_STRIP, 0, 4);          S32 res = mMipChain[i].getWidth(); - +#if GL_VERSION_4_0          mIrradianceMaps->bind(channel);          glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, i - start_mip, 0, 0, probe->mCubeIndex * 6 + cf, 0, 0, res, res);          mTexture->bind(channel); +#endif          //mMipChain[0].clear(0);      } @@ -1119,46 +1116,48 @@ void LLReflectionMapManager::updateProbeRadiance(LLReflectionMap* probe)      gRadianceGenProgram.bind();      mVertexBuffer->setBuffer(); -    S32 channel = gRadianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY); -    mTexture->bind(channel); - -    gRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx); -    gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD); -    gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, 1.f); -    gRadianceGenProgram.uniform1i(sWidth, mProbeResolution); +#if GL_VERSION_4_0 +            S32 channel = gRadianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY); +            mTexture->bind(channel); +#endif +            gRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx); +            gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD); +            gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, 1.f); +            gRadianceGenProgram.uniform1i(sWidth, mProbeResolution); -    U32 res = mMipChain[0].getWidth(); - -    for (int i = 0; i < mMipChain.size(); ++i) -    { -        glViewport(0, 0, res, res); +            U32 res = mMipChain[0].getWidth(); +            for (int i = 0; i < mMipChain.size(); ++i) +            { +                glViewport(0, 0, res, res); -        gRadianceGenProgram.uniform1f(sMipLevel, (GLfloat)i); -        gRadianceGenProgram.uniform1f(sRoughness, (F32)i / (F32)(mMipChain.size() - 1)); +                gRadianceGenProgram.uniform1f(sMipLevel, (GLfloat)i); +                gRadianceGenProgram.uniform1f(sRoughness, (F32)i / (F32)(mMipChain.size() - 1)); -        for (int cf = 0; cf < 6; ++cf) -        { -            LLCoordFrame frame; -            frame.lookAt(LLVector3(0, 0, 0), LLCubeMapArray::sClipToCubeLookVecs[cf], LLCubeMapArray::sClipToCubeUpVecs[cf]); +                for (int cf = 0; cf < 6; ++cf) +                { +                    LLCoordFrame frame; +                    frame.lookAt(LLVector3(0, 0, 0), LLCubeMapArray::sClipToCubeLookVecs[cf], LLCubeMapArray::sClipToCubeUpVecs[cf]); -            F32 mat[16]; -            frame.getOpenGLRotation(mat); -            gGL.loadMatrix(mat); +                    F32 mat[16]; +                    frame.getOpenGLRotation(mat); +                    gGL.loadMatrix(mat); -            mVertexBuffer->drawArrays(gGL.TRIANGLE_STRIP, 0, 4); +                    mVertexBuffer->drawArrays(gGL.TRIANGLE_STRIP, 0, 4); -            glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, i, 0, 0, probe->mCubeIndex * 6 + cf, 0, 0, res, res); -            LOG_GLERROR("glCopyTexSubImage3D"); -        } +#if GL_VERSION_4_0 +                    glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, i, 0, 0, probe->mCubeIndex * 6 + cf, 0, 0, res, res); +#endif +                    LOG_GLERROR("glCopyTexSubImage3D"); +                } -        if (i != mMipChain.size() - 1) -        { -            res /= 2; -        } +                if (i != mMipChain.size() - 1) +                { +                    res /= 2; +                }      } -    gRadianceGenProgram.unbind(); +            gRadianceGenProgram.unbind();      mMipChain[0].flush();      //mTexture->unbind();  } @@ -1185,48 +1184,52 @@ void LLReflectionMapManager::updateProbeIrradianceOnFace(LLReflectionMap* probe,      mMipChain[0].bindTarget("irradiance", 0);      //mMipChain[0].clear(); -    gIrradianceGenProgram.bind(); +            gIrradianceGenProgram.bind(); -    S32 channel = gIrradianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY); -    mTexture->bind(channel); +#if GL_VERSION_4_0 +            S32 channel = gIrradianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY); +            mTexture->bind(channel); +#endif -    gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx); -    gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD); +            gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx); +            gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD); -    mVertexBuffer->setBuffer(); +            mVertexBuffer->setBuffer(); +            int start_mip = 0; +            // find the mip target to start with based on irradiance map resolution +            for (start_mip = 0; start_mip < mMipChain.size(); ++start_mip) +            { +                if (mMipChain[start_mip].getWidth() == LL_IRRADIANCE_MAP_RESOLUTION) +                { +                    break; +                } +            } -    int start_mip = 0; -    // find the mip target to start with based on irradiance map resolution -    for (start_mip = 0; start_mip < mMipChain.size(); ++start_mip) -    { -        if (mMipChain[start_mip].getWidth() == LL_IRRADIANCE_MAP_RESOLUTION) -        { -            break; -        } -    } +                int i = start_mip; +                glViewport(0, 0, mMipChain[i].getWidth(), mMipChain[i].getHeight()); -    int i = start_mip; -    glViewport(0, 0, mMipChain[i].getWidth(), mMipChain[i].getHeight()); +            int cf = face; +            { +                    LLCoordFrame frame; +                    frame.lookAt(LLVector3(0, 0, 0), LLCubeMapArray::sClipToCubeLookVecs[cf], LLCubeMapArray::sClipToCubeUpVecs[cf]); -    int cf = face; -    { -        LLCoordFrame frame; -        frame.lookAt(LLVector3(0, 0, 0), LLCubeMapArray::sClipToCubeLookVecs[cf], LLCubeMapArray::sClipToCubeUpVecs[cf]); +                    F32 mat[16]; +                    frame.getOpenGLRotation(mat); +                    gGL.loadMatrix(mat); -        F32 mat[16]; -        frame.getOpenGLRotation(mat); -        gGL.loadMatrix(mat); +                    mVertexBuffer->drawArrays(gGL.TRIANGLE_STRIP, 0, 4); -        mVertexBuffer->drawArrays(gGL.TRIANGLE_STRIP, 0, 4); +#if GL_VERSION_4_0 +                    S32 res = mMipChain[i].getWidth(); +                    mIrradianceMaps->bind(channel); +                    glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, i - start_mip, 0, 0, probe->mCubeIndex * 6 + cf, 0, 0, res, res); +#endif +            } -        S32 res = mMipChain[i].getWidth(); -        mIrradianceMaps->bind(channel); -        glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, i - start_mip, 0, 0, probe->mCubeIndex * 6 + cf, 0, 0, res, res); -    } +        mMipChain[0].flush(); -    mMipChain[0].flush(); -    gIrradianceGenProgram.unbind(); -    mTexture->unbind(); +        gIrradianceGenProgram.unbind(); +        mTexture->unbind();  }  void LLReflectionMapManager::updateProbeRadianceOnFace(LLReflectionMap* probe, U32 face, S32 sourceIdx) @@ -1393,7 +1396,6 @@ void LLReflectionMapManager::updateUniforms()      LLSettingsSky::ptr_t psky = environment.getCurrentSky();      static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", false); -      F32 minimum_ambiance = psky->getReflectionProbeAmbiance(should_auto_adjust);      bool is_ambiance_pass = gCubeSnapshot && !isRadiancePass(); @@ -1745,9 +1747,11 @@ void LLReflectionMapManager::initReflectionMaps()              else              {                  mTexture = new LLCubeMapArray(); +                  // store mReflectionProbeCount+2 cube maps, final two cube maps are used for render target and radiance map generation                  // source)                  mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2, true, render_hdr); +                  mIrradianceMaps = new LLCubeMapArray();                  mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, false, render_hdr);              } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 183a9a9924..95474a8aaa 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6532,7 +6532,9 @@ void LLSelectMgr::renderSilhouettes(bool for_hud)          gGL.popMatrix();          //glLineWidth(1.f); +#if GL_VERSION_1_1          glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); +#endif          if (shader)          { diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index fb060307cd..ac0147002e 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1077,8 +1077,6 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)              LLSceneMonitor::getInstance()->capture();          } - -          // =========== RENDER UI =============          LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); @@ -1245,7 +1243,7 @@ void display_cube_face()      gGL.setColorMask(true, true); -    glClearColor(0, 0, 0, 0); +    glClearColor(0.f, 0.f, 0.f, 0.f);      //gPipeline.generateSunShadow(*LLViewerCamera::getInstance());      glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT); @@ -1539,7 +1537,6 @@ void render_ui(F32 zoom_factor, int subfield)          LL_PROFILE_ZONE_NAMED_CATEGORY_UI("HUD");          render_hud_elements();          LLGLState::checkStates(); -          render_hud_attachments();          LLGLState::checkStates(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 4d62adf3e2..753652f168 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -806,7 +806,7 @@ std::string LLViewerShaderMgr::loadBasicShaders()      if (shadow_detail >= 1)      { -    attribs["SUN_SHADOW"] = "1"; +        attribs["SUN_SHADOW"] = "1";          if (shadow_detail >= 2)          { @@ -906,9 +906,8 @@ bool LLViewerShaderMgr::loadShadersWater()      bool success = true;      bool terrainWaterSuccess = true; -    S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail");      bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 && -        shadow_detail > 0; +        gSavedSettings.getS32("RenderShadowDetail") > 0;      if (mShaderLevel[SHADER_WATER] == 0)      { @@ -2533,9 +2532,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()      if (success && gGLManager.mGLVersion > 3.9f)      {          std::vector<std::pair<std::string, std::string>> quality_levels = { {"12", "Low"}, -                                                                            {"23", "Medium"}, -                                                                            {"28", "High"}, -                                                                            {"39", "Ultra"} }; +                                                                             {"23", "Medium"}, +                                                                             {"28", "High"}, +                                                                             {"39", "Ultra"} };          int i = 0;          bool failed = false;          for (const auto& quality_pair : quality_levels) @@ -2586,9 +2585,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()      if (gGLManager.mGLVersion > 3.15f && success)      {          std::vector<std::pair<std::string, std::string>> quality_levels = { {"SMAA_PRESET_LOW", "Low"}, -                                                                            {"SMAA_PRESET_MEDIUM", "Medium"}, -                                                                            {"SMAA_PRESET_HIGH", "High"}, -                                                                        {"SMAA_PRESET_ULTRA", "Ultra"} }; +                                                                             {"SMAA_PRESET_MEDIUM", "Medium"}, +                                                                             {"SMAA_PRESET_HIGH", "High"}, +                                                                          {"SMAA_PRESET_ULTRA", "Ultra"} };          int i = 0;          bool failed = false;          for (const auto& smaa_pair : quality_levels) diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 89c4bb5605..4d16c12630 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -24,306 +24,305 @@   * $/LicenseInfo$   */ - #ifndef LL_VIEWER_SHADER_MGR_H - #define LL_VIEWER_SHADER_MGR_H - - #include "llshadermgr.h" - #include "llmaterial.h" - - #define LL_DEFERRED_MULTI_LIGHT_COUNT 16 - - class LLViewerShaderMgr: public LLShaderMgr - { - public: -     static bool sInitialized; -     static bool sSkipReload; - -     LLViewerShaderMgr(); -     /* virtual */ ~LLViewerShaderMgr(); - -     // Add shaders to mShaderList for later uniform propagation -     // Will assert on redundant shader entries in debug builds -     void finalizeShaderList(); - -     // singleton pattern implementation -     static LLViewerShaderMgr * instance(); -     static void releaseInstance(); - -     void initAttribsAndUniforms(void); -     void setShaders(); -     void unloadShaders(); -     S32  getShaderLevel(S32 type); - -     // loadBasicShaders in case of a failure returns -     // name of a file error happened at, otherwise -     // returns an empty string -     std::string loadBasicShaders(); -     bool loadShadersEffects(); -     bool loadShadersDeferred(); -     bool loadShadersObject(); -     bool loadShadersAvatar(); -     bool loadShadersWater(); -     bool loadShadersInterface(); - -     std::vector<S32> mShaderLevel; -     S32 mMaxAvatarShaderLevel; - -     enum EShaderClass -     { -         SHADER_LIGHTING, -         SHADER_OBJECT, -         SHADER_AVATAR, -         SHADER_ENVIRONMENT, -         SHADER_INTERFACE, -         SHADER_EFFECT, -         SHADER_WINDLIGHT, -         SHADER_WATER, -         SHADER_DEFERRED, -         SHADER_COUNT -     }; - -     // simple model of forward iterator -     // http://www.sgi.com/tech/stl/ForwardIterator.html -     class shader_iter -     { -     private: -         friend bool operator == (shader_iter const & a, shader_iter const & b); -         friend bool operator != (shader_iter const & a, shader_iter const & b); - -         typedef std::vector<LLGLSLShader *>::const_iterator base_iter_t; -     public: -         shader_iter() -         { -         } - -         shader_iter(base_iter_t iter) : mIter(iter) -         { -         } - -         LLGLSLShader & operator * () const -         { -             return **mIter; -         } - -         LLGLSLShader * operator -> () const -         { -             return *mIter; -         } - -         shader_iter & operator++ () -         { -             ++mIter; -             return *this; -         } - -         shader_iter operator++ (int) -         { -             return mIter++; -         } - -     private: -         base_iter_t mIter; -     }; - -     shader_iter beginShaders() const; -     shader_iter endShaders() const; - -     /* virtual */ std::string getShaderDirPrefix(void); - -     /* virtual */ void updateShaderUniforms(LLGLSLShader * shader); - - private: -     // the list of shaders we need to propagate parameters to. -     std::vector<LLGLSLShader *> mShaderList; - - }; //LLViewerShaderMgr - - inline bool operator == (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b) - { -     return a.mIter == b.mIter; - } - - inline bool operator != (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b) - { -     return a.mIter != b.mIter; - } - - extern LLVector4            gShinyOrigin; - - //utility shaders - extern LLGLSLShader         gOcclusionProgram; - extern LLGLSLShader         gOcclusionCubeProgram; - extern LLGLSLShader         gGlowCombineProgram; - extern LLGLSLShader         gReflectionMipProgram; - extern LLGLSLShader         gGaussianProgram; - extern LLGLSLShader         gRadianceGenProgram; - extern LLGLSLShader         gHeroRadianceGenProgram; - extern LLGLSLShader         gIrradianceGenProgram; - extern LLGLSLShader         gGlowCombineFXAAProgram; - extern LLGLSLShader         gDebugProgram; - enum NormalDebugShaderVariant : S32 - { -     NORMAL_DEBUG_SHADER_DEFAULT, -     NORMAL_DEBUG_SHADER_WITH_TANGENTS, -     NORMAL_DEBUG_SHADER_COUNT - }; - extern LLGLSLShader         gNormalDebugProgram[NORMAL_DEBUG_SHADER_COUNT]; - extern LLGLSLShader         gSkinnedNormalDebugProgram[NORMAL_DEBUG_SHADER_COUNT]; - extern LLGLSLShader         gClipProgram; - extern LLGLSLShader         gBenchmarkProgram; - extern LLGLSLShader         gReflectionProbeDisplayProgram; - extern LLGLSLShader         gCopyProgram; - extern LLGLSLShader         gCopyDepthProgram; - extern LLGLSLShader         gPBRTerrainBakeProgram; - extern LLGLSLShader         gDrawColorProgram; - - //output tex0[tc0] - tex1[tc1] - extern LLGLSLShader         gTwoTextureCompareProgram; - //discard some fragments based on user-set color tolerance - extern LLGLSLShader         gOneTextureFilterProgram; - - - //object shaders - extern LLGLSLShader     gObjectPreviewProgram; - extern LLGLSLShader        gPhysicsPreviewProgram; - extern LLGLSLShader     gObjectBumpProgram; - extern LLGLSLShader        gSkinnedObjectBumpProgram; - extern LLGLSLShader     gObjectAlphaMaskNoColorProgram; - - //environment shaders - extern LLGLSLShader         gWaterProgram; - extern LLGLSLShader         gUnderWaterProgram; - extern LLGLSLShader         gGlowProgram; - extern LLGLSLShader         gGlowExtractProgram; - - //interface shaders - extern LLGLSLShader         gHighlightProgram; - extern LLGLSLShader         gHighlightNormalProgram; - extern LLGLSLShader         gHighlightSpecularProgram; - - extern LLGLSLShader         gDeferredHighlightProgram; - - extern LLGLSLShader         gPathfindingProgram; - extern LLGLSLShader         gPathfindingNoNormalsProgram; - - // avatar shader handles - extern LLGLSLShader         gAvatarProgram; - extern LLGLSLShader         gAvatarEyeballProgram; - extern LLGLSLShader         gImpostorProgram; - - // Post Process Shaders - extern LLGLSLShader         gPostScreenSpaceReflectionProgram; - - // Deferred rendering shaders - extern LLGLSLShader         gDeferredImpostorProgram; - extern LLGLSLShader         gDeferredDiffuseProgram; - extern LLGLSLShader         gDeferredDiffuseAlphaMaskProgram; - extern LLGLSLShader         gDeferredNonIndexedDiffuseAlphaMaskProgram; - extern LLGLSLShader         gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram; - extern LLGLSLShader         gDeferredNonIndexedDiffuseProgram; - extern LLGLSLShader         gDeferredBumpProgram; - extern LLGLSLShader         gDeferredTerrainProgram; - extern LLGLSLShader         gDeferredTreeProgram; - extern LLGLSLShader         gDeferredTreeShadowProgram; - extern LLGLSLShader         gDeferredLightProgram; - extern LLGLSLShader         gDeferredMultiLightProgram[LL_DEFERRED_MULTI_LIGHT_COUNT]; - extern LLGLSLShader         gDeferredSpotLightProgram; - extern LLGLSLShader         gDeferredMultiSpotLightProgram; - extern LLGLSLShader         gDeferredSunProgram; - extern LLGLSLShader         gDeferredSunProbeProgram; - extern LLGLSLShader         gHazeProgram; - extern LLGLSLShader         gHazeWaterProgram; - extern LLGLSLShader         gDeferredBlurLightProgram; - extern LLGLSLShader         gDeferredAvatarProgram; - extern LLGLSLShader         gDeferredSoftenProgram; - extern LLGLSLShader         gDeferredShadowProgram; - extern LLGLSLShader         gDeferredShadowCubeProgram; - extern LLGLSLShader         gDeferredShadowAlphaMaskProgram; - extern LLGLSLShader         gDeferredShadowGLTFAlphaMaskProgram; - extern LLGLSLShader         gDeferredShadowGLTFAlphaBlendProgram; - extern LLGLSLShader         gDeferredShadowFullbrightAlphaMaskProgram; - extern LLGLSLShader         gDeferredPostProgram; - extern LLGLSLShader         gDeferredCoFProgram; - extern LLGLSLShader         gDeferredDoFCombineProgram; - extern LLGLSLShader         gFXAAProgram[4]; - extern LLGLSLShader         gSMAAEdgeDetectProgram[4]; - extern LLGLSLShader         gSMAABlendWeightsProgram[4]; - extern LLGLSLShader         gSMAANeighborhoodBlendProgram[4]; - extern LLGLSLShader         gCASProgram; - extern LLGLSLShader         gDeferredPostNoDoFProgram; - extern LLGLSLShader         gDeferredPostNoDoFNoiseProgram; - extern LLGLSLShader         gDeferredPostGammaCorrectProgram; - extern LLGLSLShader         gLegacyPostGammaCorrectProgram; - extern LLGLSLShader         gDeferredPostTonemapProgram; - extern LLGLSLShader         gNoPostTonemapProgram; - extern LLGLSLShader         gExposureProgram; - extern LLGLSLShader         gExposureProgramNoFade; - extern LLGLSLShader         gLuminanceProgram; - extern LLGLSLShader         gDeferredAvatarShadowProgram; - extern LLGLSLShader         gDeferredAvatarAlphaShadowProgram; - extern LLGLSLShader         gDeferredAvatarAlphaMaskShadowProgram; - extern LLGLSLShader         gDeferredAlphaProgram; - extern LLGLSLShader         gHUDAlphaProgram; - extern LLGLSLShader         gDeferredAlphaImpostorProgram; - extern LLGLSLShader         gDeferredFullbrightProgram; - extern LLGLSLShader         gHUDFullbrightProgram; - extern LLGLSLShader         gDeferredFullbrightAlphaMaskProgram; - extern LLGLSLShader         gHUDFullbrightAlphaMaskProgram; - extern LLGLSLShader         gDeferredFullbrightAlphaMaskAlphaProgram; - extern LLGLSLShader         gHUDFullbrightAlphaMaskAlphaProgram; - extern LLGLSLShader         gDeferredEmissiveProgram; - extern LLGLSLShader         gDeferredAvatarEyesProgram; - extern LLGLSLShader         gDeferredAvatarAlphaProgram; - extern LLGLSLShader         gEnvironmentMapProgram; - extern LLGLSLShader         gDeferredWLSkyProgram; - extern LLGLSLShader         gDeferredWLCloudProgram; - extern LLGLSLShader         gDeferredWLSunProgram; - extern LLGLSLShader         gDeferredWLMoonProgram; - extern LLGLSLShader         gDeferredStarProgram; - extern LLGLSLShader         gDeferredFullbrightShinyProgram; - extern LLGLSLShader         gHUDFullbrightShinyProgram; - extern LLGLSLShader         gNormalMapGenProgram; - extern LLGLSLShader         gDeferredGenBrdfLutProgram; - extern LLGLSLShader         gDeferredBufferVisualProgram; - - // Deferred materials shaders - extern LLGLSLShader         gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; - - extern LLGLSLShader         gHUDPBROpaqueProgram; - extern LLGLSLShader         gPBRGlowProgram; - extern LLGLSLShader         gDeferredPBROpaqueProgram; - extern LLGLSLShader         gDeferredPBRAlphaProgram; - extern LLGLSLShader         gHUDPBRAlphaProgram; - - // GLTF shaders - extern LLGLSLShader         gGLTFPBRMetallicRoughnessProgram; - - extern LLGLSLShader         gBloomExtractProgram; - extern LLGLSLShader         gBloomBlurProgram; - extern LLGLSLShader         gBloomCombineProgram; - - - // Encodes detail level for dropping textures, in accordance with the GLTF spec where possible - // 0 is highest detail, -1 drops emissive, etc - // Dropping metallic roughness is off-spec - Reserve for potato machines as needed - // https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#additional-textures - enum TerrainPBRDetail : S32 - { -     TERRAIN_PBR_DETAIL_MAX                = 0, -     TERRAIN_PBR_DETAIL_EMISSIVE           = 0, -     TERRAIN_PBR_DETAIL_OCCLUSION          = -1, -     TERRAIN_PBR_DETAIL_NORMAL             = -2, -     TERRAIN_PBR_DETAIL_METALLIC_ROUGHNESS = -3, -     TERRAIN_PBR_DETAIL_BASE_COLOR         = -4, -     TERRAIN_PBR_DETAIL_MIN                = -4, - }; - enum TerrainPaintType : U32 - { -     // Use LLVLComposition::mDatap (heightmap) generated by generateHeights, plus noise from TERRAIN_ALPHARAMP -     TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE = 0, -     // Use paint map if PBR terrain, otherwise fall back to TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE -     TERRAIN_PAINT_TYPE_PBR_PAINTMAP         = 1, -     TERRAIN_PAINT_TYPE_COUNT                = 2, - }; - extern LLGLSLShader         gDeferredPBRTerrainProgram[TERRAIN_PAINT_TYPE_COUNT]; - #endif +#ifndef LL_VIEWER_SHADER_MGR_H +#define LL_VIEWER_SHADER_MGR_H + +#include "llshadermgr.h" +#include "llmaterial.h" + +#define LL_DEFERRED_MULTI_LIGHT_COUNT 16 + +class LLViewerShaderMgr: public LLShaderMgr +{ +public: +    static bool sInitialized; +    static bool sSkipReload; + +    LLViewerShaderMgr(); +    /* virtual */ ~LLViewerShaderMgr(); + +    // Add shaders to mShaderList for later uniform propagation +    // Will assert on redundant shader entries in debug builds +    void finalizeShaderList(); + +    // singleton pattern implementation +    static LLViewerShaderMgr * instance(); +    static void releaseInstance(); + +    void initAttribsAndUniforms(void); +    void setShaders(); +    void unloadShaders(); +    S32  getShaderLevel(S32 type); + +    // loadBasicShaders in case of a failure returns +    // name of a file error happened at, otherwise +    // returns an empty string +    std::string loadBasicShaders(); +    bool loadShadersEffects(); +    bool loadShadersDeferred(); +    bool loadShadersObject(); +    bool loadShadersAvatar(); +    bool loadShadersWater(); +    bool loadShadersInterface(); + +    std::vector<S32> mShaderLevel; +    S32 mMaxAvatarShaderLevel; + +    enum EShaderClass +    { +        SHADER_LIGHTING, +        SHADER_OBJECT, +        SHADER_AVATAR, +        SHADER_ENVIRONMENT, +        SHADER_INTERFACE, +        SHADER_EFFECT, +        SHADER_WINDLIGHT, +        SHADER_WATER, +        SHADER_DEFERRED, +        SHADER_COUNT +    }; + +    // simple model of forward iterator +    // http://www.sgi.com/tech/stl/ForwardIterator.html +    class shader_iter +    { +    private: +        friend bool operator == (shader_iter const & a, shader_iter const & b); +        friend bool operator != (shader_iter const & a, shader_iter const & b); + +        typedef std::vector<LLGLSLShader *>::const_iterator base_iter_t; +    public: +        shader_iter() +        { +        } + +        shader_iter(base_iter_t iter) : mIter(iter) +        { +        } + +        LLGLSLShader & operator * () const +        { +            return **mIter; +        } + +        LLGLSLShader * operator -> () const +        { +            return *mIter; +        } + +        shader_iter & operator++ () +        { +            ++mIter; +            return *this; +        } + +        shader_iter operator++ (int) +        { +            return mIter++; +        } + +    private: +        base_iter_t mIter; +    }; + +    shader_iter beginShaders() const; +    shader_iter endShaders() const; + +    /* virtual */ std::string getShaderDirPrefix(void); + +    /* virtual */ void updateShaderUniforms(LLGLSLShader * shader); + +private: +    // the list of shaders we need to propagate parameters to. +    std::vector<LLGLSLShader *> mShaderList; + +}; //LLViewerShaderMgr + +inline bool operator == (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b) +{ +    return a.mIter == b.mIter; +} + +inline bool operator != (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b) +{ +    return a.mIter != b.mIter; +} + +extern LLVector4            gShinyOrigin; + +//utility shaders +extern LLGLSLShader         gOcclusionProgram; +extern LLGLSLShader         gOcclusionCubeProgram; +extern LLGLSLShader         gGlowCombineProgram; +extern LLGLSLShader         gReflectionMipProgram; +extern LLGLSLShader         gGaussianProgram; +extern LLGLSLShader         gRadianceGenProgram; +extern LLGLSLShader         gHeroRadianceGenProgram; +extern LLGLSLShader         gIrradianceGenProgram; +extern LLGLSLShader         gGlowCombineFXAAProgram; +extern LLGLSLShader         gDebugProgram; +enum NormalDebugShaderVariant : S32 +{ +    NORMAL_DEBUG_SHADER_DEFAULT, +    NORMAL_DEBUG_SHADER_WITH_TANGENTS, +    NORMAL_DEBUG_SHADER_COUNT +}; +extern LLGLSLShader         gNormalDebugProgram[NORMAL_DEBUG_SHADER_COUNT]; +extern LLGLSLShader         gSkinnedNormalDebugProgram[NORMAL_DEBUG_SHADER_COUNT]; +extern LLGLSLShader         gClipProgram; +extern LLGLSLShader         gBenchmarkProgram; +extern LLGLSLShader         gReflectionProbeDisplayProgram; +extern LLGLSLShader         gCopyProgram; +extern LLGLSLShader         gCopyDepthProgram; +extern LLGLSLShader         gPBRTerrainBakeProgram; +extern LLGLSLShader         gDrawColorProgram; + +//output tex0[tc0] - tex1[tc1] +extern LLGLSLShader         gTwoTextureCompareProgram; +//discard some fragments based on user-set color tolerance +extern LLGLSLShader         gOneTextureFilterProgram; + + +//object shaders +extern LLGLSLShader     gObjectPreviewProgram; +extern LLGLSLShader        gPhysicsPreviewProgram; +extern LLGLSLShader     gObjectBumpProgram; +extern LLGLSLShader        gSkinnedObjectBumpProgram; +extern LLGLSLShader     gObjectAlphaMaskNoColorProgram; + +//environment shaders +extern LLGLSLShader         gWaterProgram; +extern LLGLSLShader         gUnderWaterProgram; +extern LLGLSLShader         gGlowProgram; +extern LLGLSLShader         gGlowExtractProgram; + +//interface shaders +extern LLGLSLShader         gHighlightProgram; +extern LLGLSLShader         gHighlightNormalProgram; +extern LLGLSLShader         gHighlightSpecularProgram; + +extern LLGLSLShader         gDeferredHighlightProgram; + +extern LLGLSLShader         gPathfindingProgram; +extern LLGLSLShader         gPathfindingNoNormalsProgram; + +// avatar shader handles +extern LLGLSLShader         gAvatarProgram; +extern LLGLSLShader         gAvatarEyeballProgram; +extern LLGLSLShader         gImpostorProgram; + +// Post Process Shaders +extern LLGLSLShader         gPostScreenSpaceReflectionProgram; + +// Deferred rendering shaders +extern LLGLSLShader         gDeferredImpostorProgram; +extern LLGLSLShader         gDeferredDiffuseProgram; +extern LLGLSLShader         gDeferredDiffuseAlphaMaskProgram; +extern LLGLSLShader         gDeferredNonIndexedDiffuseAlphaMaskProgram; +extern LLGLSLShader         gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram; +extern LLGLSLShader         gDeferredNonIndexedDiffuseProgram; +extern LLGLSLShader         gDeferredBumpProgram; +extern LLGLSLShader         gDeferredTerrainProgram; +extern LLGLSLShader         gDeferredTreeProgram; +extern LLGLSLShader         gDeferredTreeShadowProgram; +extern LLGLSLShader         gDeferredLightProgram; +extern LLGLSLShader         gDeferredMultiLightProgram[LL_DEFERRED_MULTI_LIGHT_COUNT]; +extern LLGLSLShader         gDeferredSpotLightProgram; +extern LLGLSLShader         gDeferredMultiSpotLightProgram; +extern LLGLSLShader         gDeferredSunProgram; +extern LLGLSLShader         gDeferredSunProbeProgram; +extern LLGLSLShader         gHazeProgram; +extern LLGLSLShader         gHazeWaterProgram; +extern LLGLSLShader         gDeferredBlurLightProgram; +extern LLGLSLShader         gDeferredAvatarProgram; +extern LLGLSLShader         gDeferredSoftenProgram; +extern LLGLSLShader         gDeferredShadowProgram; +extern LLGLSLShader         gDeferredShadowCubeProgram; +extern LLGLSLShader         gDeferredShadowAlphaMaskProgram; +extern LLGLSLShader         gDeferredShadowGLTFAlphaMaskProgram; +extern LLGLSLShader         gDeferredShadowGLTFAlphaBlendProgram; +extern LLGLSLShader         gDeferredShadowFullbrightAlphaMaskProgram; +extern LLGLSLShader         gDeferredPostProgram; +extern LLGLSLShader         gDeferredCoFProgram; +extern LLGLSLShader         gDeferredDoFCombineProgram; +extern LLGLSLShader         gFXAAProgram[4]; +extern LLGLSLShader         gSMAAEdgeDetectProgram[4]; +extern LLGLSLShader         gSMAABlendWeightsProgram[4]; +extern LLGLSLShader         gSMAANeighborhoodBlendProgram[4]; +extern LLGLSLShader         gCASProgram; +extern LLGLSLShader         gDeferredPostNoDoFProgram; +extern LLGLSLShader         gDeferredPostNoDoFNoiseProgram; +extern LLGLSLShader         gDeferredPostGammaCorrectProgram; +extern LLGLSLShader         gLegacyPostGammaCorrectProgram; +extern LLGLSLShader         gDeferredPostTonemapProgram; +extern LLGLSLShader         gNoPostTonemapProgram; +extern LLGLSLShader         gExposureProgram; +extern LLGLSLShader         gExposureProgramNoFade; +extern LLGLSLShader         gLuminanceProgram; +extern LLGLSLShader         gDeferredAvatarShadowProgram; +extern LLGLSLShader         gDeferredAvatarAlphaShadowProgram; +extern LLGLSLShader         gDeferredAvatarAlphaMaskShadowProgram; +extern LLGLSLShader         gDeferredAlphaProgram; +extern LLGLSLShader         gHUDAlphaProgram; +extern LLGLSLShader         gDeferredAlphaImpostorProgram; +extern LLGLSLShader         gDeferredFullbrightProgram; +extern LLGLSLShader         gHUDFullbrightProgram; +extern LLGLSLShader         gDeferredFullbrightAlphaMaskProgram; +extern LLGLSLShader         gHUDFullbrightAlphaMaskProgram; +extern LLGLSLShader         gDeferredFullbrightAlphaMaskAlphaProgram; +extern LLGLSLShader         gHUDFullbrightAlphaMaskAlphaProgram; +extern LLGLSLShader         gDeferredEmissiveProgram; +extern LLGLSLShader         gDeferredAvatarEyesProgram; +extern LLGLSLShader         gDeferredAvatarAlphaProgram; +extern LLGLSLShader         gEnvironmentMapProgram; +extern LLGLSLShader         gDeferredWLSkyProgram; +extern LLGLSLShader         gDeferredWLCloudProgram; +extern LLGLSLShader         gDeferredWLSunProgram; +extern LLGLSLShader         gDeferredWLMoonProgram; +extern LLGLSLShader         gDeferredStarProgram; +extern LLGLSLShader         gDeferredFullbrightShinyProgram; +extern LLGLSLShader         gHUDFullbrightShinyProgram; +extern LLGLSLShader         gNormalMapGenProgram; +extern LLGLSLShader         gDeferredGenBrdfLutProgram; +extern LLGLSLShader         gDeferredBufferVisualProgram; + +// Deferred materials shaders +extern LLGLSLShader         gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; + +extern LLGLSLShader         gHUDPBROpaqueProgram; +extern LLGLSLShader         gPBRGlowProgram; +extern LLGLSLShader         gDeferredPBROpaqueProgram; +extern LLGLSLShader         gDeferredPBRAlphaProgram; +extern LLGLSLShader         gHUDPBRAlphaProgram; + +// GLTF shaders +extern LLGLSLShader         gGLTFPBRMetallicRoughnessProgram; + +extern LLGLSLShader         gBloomExtractProgram; +extern LLGLSLShader         gBloomBlurProgram; +extern LLGLSLShader         gBloomCombineProgram; + +// Encodes detail level for dropping textures, in accordance with the GLTF spec where possible +// 0 is highest detail, -1 drops emissive, etc +// Dropping metallic roughness is off-spec - Reserve for potato machines as needed +// https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#additional-textures +enum TerrainPBRDetail : S32 +{ +    TERRAIN_PBR_DETAIL_MAX                = 0, +    TERRAIN_PBR_DETAIL_EMISSIVE           = 0, +    TERRAIN_PBR_DETAIL_OCCLUSION          = -1, +    TERRAIN_PBR_DETAIL_NORMAL             = -2, +    TERRAIN_PBR_DETAIL_METALLIC_ROUGHNESS = -3, +    TERRAIN_PBR_DETAIL_BASE_COLOR         = -4, +    TERRAIN_PBR_DETAIL_MIN                = -4, +}; +enum TerrainPaintType : U32 +{ +    // Use LLVLComposition::mDatap (heightmap) generated by generateHeights, plus noise from TERRAIN_ALPHARAMP +    TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE = 0, +    // Use paint map if PBR terrain, otherwise fall back to TERRAIN_PAINT_TYPE_HEIGHTMAP_WITH_NOISE +    TERRAIN_PAINT_TYPE_PBR_PAINTMAP         = 1, +    TERRAIN_PAINT_TYPE_COUNT                = 2, +}; +extern LLGLSLShader         gDeferredPBRTerrainProgram[TERRAIN_PAINT_TYPE_COUNT]; +#endif diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 924efde89b..b373532aa0 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1,28 +1,28 @@  /** -* @file pipeline.cpp -* @brief Rendering pipeline. -* -* $LicenseInfo:firstyear=2005&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA -* $/LicenseInfo$ -*/ + * @file pipeline.cpp + * @brief Rendering pipeline. + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */  #include "llviewerprecompiledheaders.h" @@ -1557,7 +1557,7 @@ void LLPipeline::restoreGL()              if (part)              {                  part->restoreGL(); -            } +        }          }      }  } @@ -2093,7 +2093,7 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)  {      LL_PROFILE_ZONE_SCOPED;      for (LLDrawable::drawable_vector_t::iterator iter = moved_list.begin(); -        iter != moved_list.end(); ) +         iter != moved_list.end(); )      {          LLDrawable::drawable_vector_t::iterator curiter = iter++;          LLDrawable *drawablep = *curiter; @@ -2759,7 +2759,7 @@ void LLPipeline::clearRebuildGroups()      mGroupQ1Locked = true;      // Iterate through all drawables on the priority build queue,      for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin(); -        iter != mGroupQ1.end(); ++iter) +         iter != mGroupQ1.end(); ++iter)      {          LLSpatialGroup* group = *iter; @@ -2787,7 +2787,7 @@ void LLPipeline::clearRebuildDrawables()  {      // Clear all drawables on the priority build queue,      for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin(); -        iter != mBuildQ1.end(); ++iter) +         iter != mBuildQ1.end(); ++iter)      {          LLDrawable* drawablep = *iter;          if (drawablep && !drawablep->isDead()) @@ -2799,7 +2799,7 @@ void LLPipeline::clearRebuildDrawables()      //clear all moving bridges      for (LLDrawable::drawable_vector_t::iterator iter = mMovedBridge.begin(); -        iter != mMovedBridge.end(); ++iter) +         iter != mMovedBridge.end(); ++iter)      {          LLDrawable *drawablep = *iter;          drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD); @@ -2808,7 +2808,7 @@ void LLPipeline::clearRebuildDrawables()      //clear all moving drawables      for (LLDrawable::drawable_vector_t::iterator iter = mMovedList.begin(); -        iter != mMovedList.end(); ++iter) +         iter != mMovedList.end(); ++iter)      {          LLDrawable *drawablep = *iter;          drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD); @@ -2837,7 +2837,7 @@ void LLPipeline::rebuildPriorityGroups()      mGroupQ1Locked = true;      // Iterate through all drawables on the priority build queue,      for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin(); -        iter != mGroupQ1.end(); ++iter) +         iter != mGroupQ1.end(); ++iter)      {          LLSpatialGroup* group = *iter;          group->rebuildGeom(); @@ -2869,7 +2869,7 @@ void LLPipeline::updateGeom(F32 max_dtime)      // Iterate through all drawables on the priority build queue,      for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin(); -        iter != mBuildQ1.end();) +         iter != mBuildQ1.end();)      {          LLDrawable::drawable_list_t::iterator curiter = iter++;          LLDrawable* drawablep = *curiter; @@ -2919,8 +2919,8 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)                          LLVOAvatar* av = vobj->asAvatar();                          if (av &&                              ((!sImpostorRender && av->isImpostor()) //ignore impostor flag during impostor pass -                            || av->isInMuteList() -                            || (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) )) +                             || av->isInMuteList() +                             || (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) ))                          {                              return;                          } @@ -3137,13 +3137,13 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)      LL_PROFILE_GPU_ZONE("stateSort");      if (hasAnyRenderType(LLPipeline::RENDER_TYPE_AVATAR, -                    LLPipeline::RENDER_TYPE_CONTROL_AV, -                    LLPipeline::RENDER_TYPE_TERRAIN, -                    LLPipeline::RENDER_TYPE_TREE, -                    LLPipeline::RENDER_TYPE_SKY, -                    LLPipeline::RENDER_TYPE_VOIDWATER, -                    LLPipeline::RENDER_TYPE_WATER, -                    LLPipeline::END_RENDER_TYPES)) +                      LLPipeline::RENDER_TYPE_CONTROL_AV, +                      LLPipeline::RENDER_TYPE_TERRAIN, +                      LLPipeline::RENDER_TYPE_TREE, +                      LLPipeline::RENDER_TYPE_SKY, +                      LLPipeline::RENDER_TYPE_VOIDWATER, +                      LLPipeline::RENDER_TYPE_WATER, +                      LLPipeline::END_RENDER_TYPES))      {          //clear faces from face pools          gPipeline.resetDrawOrders(); @@ -3241,7 +3241,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)      {          LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWABLE("stateSort"); // LL_RECORD_BLOCK_TIME(FTM_STATESORT_DRAWABLE);          for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); -            iter != sCull->endVisibleList(); ++iter) +             iter != sCull->endVisibleList(); ++iter)          {              LLDrawable *drawablep = *iter;              if (!drawablep->isDead()) @@ -3376,8 +3376,8 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)  void forAllDrawables(LLCullResult::sg_iterator begin, -                    LLCullResult::sg_iterator end, -                    void (*func)(LLDrawable*)) +                     LLCullResult::sg_iterator end, +                     void (*func)(LLDrawable*))  {      for (LLCullResult::sg_iterator i = begin; i != end; ++i)      { @@ -3440,7 +3440,7 @@ void renderScriptedTouchBeacons(LLDrawable *drawablep)          if (gPipeline.sRenderBeacons)          {              gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), -                                    LLPipeline::DebugBeaconLineWidth); +                                       LLPipeline::DebugBeaconLineWidth);          }          if (gPipeline.sRenderHighlight) @@ -3470,7 +3470,7 @@ void renderPhysicalBeacons(LLDrawable *drawablep)          if (gPipeline.sRenderBeacons)          {              gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), -                                    LLPipeline::DebugBeaconLineWidth); +                                       LLPipeline::DebugBeaconLineWidth);          }          if (gPipeline.sRenderHighlight) @@ -3511,7 +3511,7 @@ void renderMOAPBeacons(LLDrawable *drawablep)          if (gPipeline.sRenderBeacons)          {              gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), -                                    LLPipeline::DebugBeaconLineWidth); +                                       LLPipeline::DebugBeaconLineWidth);          }          if (gPipeline.sRenderHighlight) @@ -3540,7 +3540,7 @@ void renderParticleBeacons(LLDrawable *drawablep)          {              LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f);              gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), -                                    LLPipeline::DebugBeaconLineWidth); +                                       LLPipeline::DebugBeaconLineWidth);          }          if (gPipeline.sRenderHighlight) @@ -3625,7 +3625,7 @@ void LLPipeline::postSort(LLCamera &camera)          if ((sUseOcclusion && group->isOcclusionState(LLSpatialGroup::OCCLUDED)) ||              (RenderAutoHideSurfaceAreaLimit > 0.f && -            group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit * llmax(group->mObjectBoxSize, 10.f))) +             group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit * llmax(group->mObjectBoxSize, 10.f)))          {              continue;          } @@ -4592,7 +4592,6 @@ void LLPipeline::renderDebug()                              LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0);                              gGL.flush(); -                              glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );                              //get rid of some z-fighting @@ -5608,8 +5607,8 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)              LLDrawable* drawable = light->drawable;              const LLViewerObject *vobj = light->drawable->getVObj();              if(vobj && vobj->getAvatar() -            && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlow()) -            ) +               && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlow()) +               )              {                  drawable->clearState(LLDrawable::NEARBY_LIGHT);                  continue; @@ -5670,7 +5669,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)          // FIND NEW LIGHTS THAT ARE IN RANGE          light_set_t new_nearby_lights;          for (LLDrawable::ordered_drawable_set_t::iterator iter = mLights.begin(); -            iter != mLights.end(); ++iter) +             iter != mLights.end(); ++iter)          {              LLDrawable* drawable = *iter;              LLVOVolume* light = drawable->getVOVolume(); @@ -5708,7 +5707,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)          // INSERT ANY NEW LIGHTS          for (light_set_t::iterator iter = new_nearby_lights.begin(); -            iter != new_nearby_lights.end(); iter++) +             iter != new_nearby_lights.end(); iter++)          {              const Light* light = &(*iter);              if (LLPipeline::sRenderDeferred || mNearbyLights.size() < (U32)MAX_LOCAL_LIGHTS) @@ -5750,7 +5749,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)          //mark nearby lights not-removable.          for (light_set_t::iterator iter = mNearbyLights.begin(); -            iter != mNearbyLights.end(); iter++) +             iter != mNearbyLights.end(); iter++)          {              const Light* light = &(*iter);              ((LLViewerOctreeEntryData*) light->drawable)->setVisible(); @@ -5854,7 +5853,7 @@ void LLPipeline::setupHWLights()      if (local_light_count >= 1)      {          for (light_set_t::iterator iter = mNearbyLights.begin(); -            iter != mNearbyLights.end(); ++iter) +             iter != mNearbyLights.end(); ++iter)          {              LLDrawable* drawable = iter->drawable;              LLVOVolume* light = drawable->getVOVolume(); @@ -6698,7 +6697,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,                          !drawable->getVObj()->isAttachment() ||                          delta.getLength3().getF32() > ATTACHMENT_OVERRIDE_DIST)                      { //avatar overrides if previously hit drawable is not an attachment or -                    //attachment is far enough away from detected intersection +                      //attachment is far enough away from detected intersection                          drawable = hit;                          local_end = position;                      } @@ -6768,12 +6767,12 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,  }  LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end, -                                                    bool pick_transparent, -                                                    S32* face_hit, -                                                    LLVector4a* intersection,         // return the intersection point -                                                    LLVector2* tex_coord,            // return the texture coordinates of the intersection point -                                                    LLVector4a* normal,               // return the surface normal at the intersection point -                                                    LLVector4a* tangent               // return the surface tangent at the intersection point +                                                      bool pick_transparent, +                                                      S32* face_hit, +                                                      LLVector4a* intersection,         // return the intersection point +                                                      LLVector2* tex_coord,            // return the texture coordinates of the intersection point +                                                      LLVector4a* normal,               // return the surface normal at the intersection point +                                                      LLVector4a* tangent               // return the surface tangent at the intersection point      )  {      LLDrawable* drawable = NULL; @@ -7393,8 +7392,8 @@ void LLPipeline::generateGlow(LLRenderTarget* src)                  gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);              }              gGlowExtractProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, -                                        (GLfloat)mGlow[2].getWidth(), -                                        (GLfloat)mGlow[2].getHeight()); +                                          (GLfloat)mGlow[2].getWidth(), +                                          (GLfloat)mGlow[2].getHeight());          }          { @@ -7518,91 +7517,95 @@ bool LLPipeline::applyCAS(LLRenderTarget* src, LLRenderTarget* dst)  bool LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)  { -    llassert(!gCubeSnapshot); -    bool multisample = RenderFSAAType == 1 && gFXAAProgram[0].isComplete() && mFXAAMap.isComplete(); +    { +        llassert(!gCubeSnapshot); +        bool multisample = RenderFSAAType == 1 && gFXAAProgram[0].isComplete() && mFXAAMap.isComplete(); -    if(!multisample) return false; +        if(!multisample) return false; -    LL_PROFILE_GPU_ZONE("aa"); -    S32 width = dst->getWidth(); -    S32 height = dst->getHeight(); +        { +            LL_PROFILE_GPU_ZONE("aa"); +            S32 width = dst->getWidth(); +            S32 height = dst->getHeight(); -    //LL_WARNS() << "dst width=" << width << LL_ENDL; +            //LL_WARNS() << "dst width=" << width << LL_ENDL; -    // bake out texture2D with RGBL for FXAA shader -    mFXAAMap.bindTarget("applyFXAA", 1); -    mFXAAMap.clear(GL_COLOR_BUFFER_BIT); +            // bake out texture2D with RGBL for FXAA shader +            mFXAAMap.bindTarget("applyFXAA", 1); +            mFXAAMap.clear(GL_COLOR_BUFFER_BIT); -    LLGLSLShader* shader = &gGlowCombineFXAAProgram; -    shader->bind(); +            LLGLSLShader* shader = &gGlowCombineFXAAProgram; +            shader->bind(); -    S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); -    if (channel > -1) -    { -        src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR); -    } +            S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); +            if (channel > -1) +            { +                src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR); +            } -    { -        LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS); -        renderTriangle(); -    } +            { +                LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS); +                renderTriangle(); +            } -    shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); -    shader->unbind(); +            shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); +            shader->unbind(); -    mFXAAMap.flush(); +            mFXAAMap.flush(); -    dst->bindTarget("applyFXAA", 1); -    dst->clear(); +            dst->bindTarget("applyFXAA", 1); +            dst->clear(); -    static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U); -    U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U); +            static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U); +            U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U); -    shader = &gFXAAProgram[fsaa_quality]; -    shader->bind(); +            shader = &gFXAAProgram[fsaa_quality]; +            shader->bind(); -    channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAAMap.getUsage()); -    if (channel > -1) -    { -        mFXAAMap.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR); -    } +            channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAAMap.getUsage()); +            if (channel > -1) +            { +                mFXAAMap.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR); +            } -    /* -    gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft; -    gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom; -    gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth(); -    gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight(); +/* +            gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft; +            gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom; +            gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth(); +            gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight(); -    glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); +            glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);  */ -    F32 scale_x = (F32)width / mFXAAMap.getWidth(); -    F32 scale_y = (F32)height / mFXAAMap.getHeight(); +            F32 scale_x = (F32)width / mFXAAMap.getWidth(); +            F32 scale_y = (F32)height / mFXAAMap.getHeight(); -    //LL_WARNS() << "vp width=" << gGLViewport[2] << " scale=" << scale_x << LL_ENDL; +            //LL_WARNS() << "vp width=" << gGLViewport[2] << " scale=" << scale_x << LL_ENDL; -    shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y); -    shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y); -    shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y, -        0.5f / width * scale_x, 0.5f / height * scale_y); -    shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f / width * scale_x, -2.f / height * scale_y, -        2.f / width * scale_x, 2.f / height * scale_y); +            shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y); +            shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y); +            shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y, +                0.5f / width * scale_x, 0.5f / height * scale_y); +            shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f / width * scale_x, -2.f / height * scale_y, +                2.f / width * scale_x, 2.f / height * scale_y); -    { -        LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS); -        S32 depth_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DEPTH); -        gGL.getTexUnit(depth_channel)->bind(&mRT->deferredScreen, true); +            { +                LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS); +                S32 depth_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DEPTH); +                gGL.getTexUnit(depth_channel)->bind(&mRT->deferredScreen, true); -        renderTriangle(); -    } +                renderTriangle(); +            } -    if (channel > -1) -    { -        shader->unbindTexture(channel); -    } +            if (channel > -1) +            { +                shader->unbindTexture(channel); +            } -    shader->unbind(); -    dst->flush(); +            shader->unbind(); +            dst->flush(); +        } +    }      return true;  } @@ -7720,10 +7723,8 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src)              //{              //    glStencilFunc(GL_ALWAYS, 0, 0xFF);              //} -              blend_weights_shader.unbind();              dest.flush(); -              gGL.getTexUnit(edge_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);              gGL.getTexUnit(area_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);              gGL.getTexUnit(search_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE); @@ -7745,56 +7746,57 @@ bool LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst)      if(!multisample) return false; -    LL_PROFILE_GPU_ZONE("aa"); - -    generateSMAABuffers(src); +    { +        LL_PROFILE_GPU_ZONE("aa"); +        generateSMAABuffers(src); -    static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U); -    U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U); +        static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U); +        U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U); -    S32 width = src->getWidth(); -    S32 height = src->getHeight(); +        S32 width = src->getWidth(); +        S32 height = src->getHeight(); -    float rt_metrics[] = { 1.f / width, 1.f / height, (float)width, (float)height }; +        float rt_metrics[] = { 1.f / width, 1.f / height, (float)width, (float)height }; -    LLGLDepthTest    depth(GL_FALSE, GL_FALSE); +        LLGLDepthTest    depth(GL_FALSE, GL_FALSE); -    static LLCachedControl<bool> use_sample(gSavedSettings, "RenderSMAAUseSample", false); -    //static LLCachedControl<bool> use_stencil(gSavedSettings, "RenderSMAAUseStencil", true); +        static LLCachedControl<bool> use_sample(gSavedSettings, "RenderSMAAUseSample", false); +        //static LLCachedControl<bool> use_stencil(gSavedSettings, "RenderSMAAUseStencil", true); -    { -        //LLGLDisable stencil(GL_STENCIL_TEST); +        { +            //LLGLDisable stencil(GL_STENCIL_TEST); -        // Bind setup: -        LLRenderTarget* bound_target = dst; -        LLGLSLShader& blend_shader = gSMAANeighborhoodBlendProgram[fsaa_quality]; +            // Bind setup: +            LLRenderTarget* bound_target = dst; +            LLGLSLShader& blend_shader = gSMAANeighborhoodBlendProgram[fsaa_quality]; -        bound_target->bindTarget("applySMAA", 1); -        bound_target->clear(GL_COLOR_BUFFER_BIT); +            bound_target->bindTarget("applySMAA", 1); +            bound_target->clear(GL_COLOR_BUFFER_BIT); -        blend_shader.bind(); -        blend_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); +            blend_shader.bind(); +            blend_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); -        S32 diffuse_channel = blend_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE); -        if(diffuse_channel > -1) -        { -            src->bindTexture(0, diffuse_channel, LLTexUnit::TFO_BILINEAR); -            gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); -        } +            S32 diffuse_channel = blend_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE); +            if(diffuse_channel > -1) +            { +                src->bindTexture(0, diffuse_channel, LLTexUnit::TFO_BILINEAR); +                gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); +            } -        S32 blend_channel = blend_shader.enableTexture(LLShaderMgr::SMAA_BLEND_TEX); -        if (blend_channel > -1) -        { -            mSMAABlendBuffer.bindTexture(0, blend_channel, LLTexUnit::TFO_BILINEAR); -        } +            S32 blend_channel = blend_shader.enableTexture(LLShaderMgr::SMAA_BLEND_TEX); +            if (blend_channel > -1) +            { +                mSMAABlendBuffer.bindTexture(0, blend_channel, LLTexUnit::TFO_BILINEAR); +            } -        renderTriangle(); +            renderTriangle(); -        bound_target->flush(); -        blend_shader.unbind(); -        gGL.getTexUnit(diffuse_channel)->unbindFast(LLTexUnit::TT_TEXTURE); -        gGL.getTexUnit(blend_channel)->unbindFast(LLTexUnit::TT_TEXTURE); +            bound_target->flush(); +            blend_shader.unbind(); +            gGL.getTexUnit(diffuse_channel)->unbindFast(LLTexUnit::TT_TEXTURE); +            gGL.getTexUnit(blend_channel)->unbindFast(LLTexUnit::TT_TEXTURE); +        }      }      LOG_GLERROR("LLPipeline::applySMAA()"); @@ -7803,6 +7805,7 @@ bool LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst)  void LLPipeline::copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst)  { +      LL_PROFILE_GPU_ZONE("copyRenderTarget");      dst->bindTarget("copyRenderTarget", 1);      dst->clear(GL_COLOR_BUFFER_BIT); @@ -7825,6 +7828,7 @@ void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst)      dst->bindTarget("combineGlow", 1);      { +          gGlowCombineProgram.bind();          gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src); @@ -7839,188 +7843,190 @@ void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst)  bool LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)  { -    bool dof_enabled = +    { +        bool dof_enabled =              (RenderDepthOfFieldInEditMode || !LLToolMgr::getInstance()->inBuildMode()) &&              RenderDepthOfField &&              !gCubeSnapshot;      if(!dof_enabled) return false; -    gViewerWindow->setup3DViewport(); +        gViewerWindow->setup3DViewport(); -    if (dof_enabled) -    { -        LL_PROFILE_GPU_ZONE("dof"); -        LLGLDisable blend(GL_BLEND); +        if (dof_enabled) +        { +            LL_PROFILE_GPU_ZONE("dof"); +            LLGLDisable blend(GL_BLEND); -        // depth of field focal plane calculations -        static F32 current_distance = 16.f; -        static F32 start_distance = 16.f; -        static F32 transition_time = 1.f; +            // depth of field focal plane calculations +            static F32 current_distance = 16.f; +            static F32 start_distance = 16.f; +            static F32 transition_time = 1.f; -        LLVector3 focus_point; +            LLVector3 focus_point; -        LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject(); -        if (obj && obj->mDrawable && obj->isSelected()) -        { // focus on selected media object -            S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace(); -            if (obj && obj->mDrawable) -            { -                LLFace* face = obj->mDrawable->getFace(face_idx); -                if (face) +            LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject(); +            if (obj && obj->mDrawable && obj->isSelected()) +            { // focus on selected media object +                S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace(); +                if (obj && obj->mDrawable)                  { -                    focus_point = face->getPositionAgent(); +                    LLFace* face = obj->mDrawable->getFace(face_idx); +                    if (face) +                    { +                        focus_point = face->getPositionAgent(); +                    }                  }              } -        } -        if (focus_point.isExactlyZero()) -        { -            if (LLViewerJoystick::getInstance()->getOverrideCamera()) -            { // focus on point under cursor -                focus_point.set(gDebugRaycastIntersection.getF32ptr()); -            } -            else if (gAgentCamera.cameraMouselook()) -            { // focus on point under mouselook crosshairs -                LLVector4a result; -                result.clear(); +            if (focus_point.isExactlyZero()) +            { +                if (LLViewerJoystick::getInstance()->getOverrideCamera()) +                { // focus on point under cursor +                    focus_point.set(gDebugRaycastIntersection.getF32ptr()); +                } +                else if (gAgentCamera.cameraMouselook()) +                { // focus on point under mouselook crosshairs +                    LLVector4a result; +                    result.clear(); -                gViewerWindow->cursorIntersect(-1, -1, 512.f, nullptr, -1, false, false, true, true, nullptr, nullptr, nullptr, &result); +                    gViewerWindow->cursorIntersect(-1, -1, 512.f, nullptr, -1, false, false, true, true, nullptr, nullptr, nullptr, &result); -                focus_point.set(result.getF32ptr()); -            } -            else -            { -                // focus on alt-zoom target -                LLViewerRegion* region = gAgent.getRegion(); -                if (region) +                    focus_point.set(result.getF32ptr()); +                } +                else                  { -                    focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal()); +                    // focus on alt-zoom target +                    LLViewerRegion* region = gAgent.getRegion(); +                    if (region) +                    { +                        focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal()); +                    }                  }              } -        } -        LLVector3 eye = LLViewerCamera::getInstance()->getOrigin(); -        F32 target_distance = 16.f; -        if (!focus_point.isExactlyZero()) -        { -            target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point - eye); -        } +            LLVector3 eye = LLViewerCamera::getInstance()->getOrigin(); +            F32 target_distance = 16.f; +            if (!focus_point.isExactlyZero()) +            { +                target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point - eye); +            } -        if (transition_time >= 1.f && fabsf(current_distance - target_distance) / current_distance > 0.01f) -        { // large shift happened, interpolate smoothly to new target distance -            transition_time = 0.f; -            start_distance = current_distance; -        } -        else if (transition_time < 1.f) -        { // currently in a transition, continue interpolating -            transition_time += 1.f / CameraFocusTransitionTime * gFrameIntervalSeconds.value(); -            transition_time = llmin(transition_time, 1.f); +            if (transition_time >= 1.f && fabsf(current_distance - target_distance) / current_distance > 0.01f) +            { // large shift happened, interpolate smoothly to new target distance +                transition_time = 0.f; +                start_distance = current_distance; +            } +            else if (transition_time < 1.f) +            { // currently in a transition, continue interpolating +                transition_time += 1.f / CameraFocusTransitionTime * gFrameIntervalSeconds.value(); +                transition_time = llmin(transition_time, 1.f); -            F32 t = cosf(transition_time * F_PI + F_PI) * 0.5f + 0.5f; -            current_distance = start_distance + (target_distance - start_distance) * t; -        } -        else -        { // small or no change, just snap to target distance -            current_distance = target_distance; -        } +                F32 t = cosf(transition_time * F_PI + F_PI) * 0.5f + 0.5f; +                current_distance = start_distance + (target_distance - start_distance) * t; +            } +            else +            { // small or no change, just snap to target distance +                current_distance = target_distance; +            } -        // convert to mm -        F32 subject_distance = current_distance * 1000.f; -        F32 fnumber = CameraFNumber; -        F32 default_focal_length = CameraFocalLength; +            // convert to mm +            F32 subject_distance = current_distance * 1000.f; +            F32 fnumber = CameraFNumber; +            F32 default_focal_length = CameraFocalLength; -        F32 fov = LLViewerCamera::getInstance()->getView(); +            F32 fov = LLViewerCamera::getInstance()->getView(); -        const F32 default_fov = CameraFieldOfView * F_PI / 180.f; +            const F32 default_fov = CameraFieldOfView * F_PI / 180.f; -        // F32 aspect_ratio = (F32) mRT->screen.getWidth()/(F32)mRT->screen.getHeight(); +            // F32 aspect_ratio = (F32) mRT->screen.getWidth()/(F32)mRT->screen.getHeight(); -        F32 dv = 2.f * default_focal_length * tanf(default_fov / 2.f); +            F32 dv = 2.f * default_focal_length * tanf(default_fov / 2.f); -        F32 focal_length = dv / (2 * tanf(fov / 2.f)); +            F32 focal_length = dv / (2 * tanf(fov / 2.f)); -        // F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle); +            // F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle); -        // from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f)) -        // where     N = fnumber -        //           s2 = dot distance -        //           s1 = subject distance -        //           f = focal length -        // +            // from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f)) +            // where     N = fnumber +            //           s2 = dot distance +            //           s1 = subject distance +            //           f = focal length +            // -        F32 blur_constant = focal_length * focal_length / (fnumber * (subject_distance - focal_length)); -        blur_constant /= 1000.f; // convert to meters for shader -        F32 magnification = focal_length / (subject_distance - focal_length); +            F32 blur_constant = focal_length * focal_length / (fnumber * (subject_distance - focal_length)); +            blur_constant /= 1000.f; // convert to meters for shader +            F32 magnification = focal_length / (subject_distance - focal_length); -        { // build diffuse+bloom+CoF -            mRT->deferredLight.bindTarget("renderDOF", 1); +            { // build diffuse+bloom+CoF +                mRT->deferredLight.bindTarget("renderDOF", 1); -            gDeferredCoFProgram.bind(); +                gDeferredCoFProgram.bind(); -            gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT); -            gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true); +                gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT); +                gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); -            gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f / LLDrawable::sCurPixelAngle)); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); -            gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); +                gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f / LLDrawable::sCurPixelAngle)); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); +                gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); -            renderTriangle(); +                renderTriangle(); -            gDeferredCoFProgram.unbind(); -            mRT->deferredLight.flush(); -        } +                gDeferredCoFProgram.unbind(); +                mRT->deferredLight.flush(); +            } -        U32 dof_width = (U32)(mRT->screen.getWidth() * CameraDoFResScale); -        U32 dof_height = (U32)(mRT->screen.getHeight() * CameraDoFResScale); +            U32 dof_width = (U32)(mRT->screen.getWidth() * CameraDoFResScale); +            U32 dof_height = (U32)(mRT->screen.getHeight() * CameraDoFResScale); -        { // perform DoF sampling at half-res (preserve alpha channel) -            src->bindTarget("DoF sampling", 1); -            glViewport(0, 0, dof_width, dof_height); +            { // perform DoF sampling at half-res (preserve alpha channel) +                src->bindTarget("DoF sampling", 1); +                glViewport(0, 0, dof_width, dof_height); -            gGL.setColorMask(true, false); +                gGL.setColorMask(true, false); -            gDeferredPostProgram.bind(); -            gDeferredPostProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mRT->deferredLight, LLTexUnit::TFO_POINT); +                gDeferredPostProgram.bind(); +                gDeferredPostProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mRT->deferredLight, LLTexUnit::TFO_POINT); -            gDeferredPostProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); -            gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); -            gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); +                gDeferredPostProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); +                gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); +                gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); -            renderTriangle(); +                renderTriangle(); -            gDeferredPostProgram.unbind(); +                gDeferredPostProgram.unbind(); -            src->flush(); -            gGL.setColorMask(true, true); -        } +                src->flush(); +                gGL.setColorMask(true, true); +            } -        { // combine result based on alpha +            { // combine result based on alpha -            dst->bindTarget("DoF combine", 1); -            glViewport(0, 0, dst->getWidth(), dst->getHeight()); +                dst->bindTarget("DoF combine", 1); +                glViewport(0, 0, dst->getWidth(), dst->getHeight()); -            gDeferredDoFCombineProgram.bind(); -            gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT); -            gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_LIGHT, &mRT->deferredLight, LLTexUnit::TFO_POINT); +                gDeferredDoFCombineProgram.bind(); +                gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT); +                gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_LIGHT, &mRT->deferredLight, LLTexUnit::TFO_POINT); -            gDeferredDoFCombineProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); -            gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); -            gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); -            gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_WIDTH, (dof_width - 1) / (F32)src->getWidth()); -            gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_HEIGHT, (dof_height - 1) / (F32)src->getHeight()); +                gDeferredDoFCombineProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); +                gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); +                gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); +                gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_WIDTH, (dof_width - 1) / (F32)src->getWidth()); +                gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_HEIGHT, (dof_height - 1) / (F32)src->getHeight()); -            renderTriangle(); +                renderTriangle(); -            gDeferredDoFCombineProgram.unbind(); -            dst->flush(); +                gDeferredDoFCombineProgram.unbind(); +                dst->flush(); +            }          }      } @@ -8306,8 +8312,8 @@ void LLPipeline::renderFinalize()      /*if (LLRenderTarget::sUseFBO && !gCubeSnapshot)      { // copy depth buffer from mRT->screen to framebuffer          LLRenderTarget::copyContentsToFramebuffer(mRT->screen, 0, 0, mRT->screen.getWidth(), mRT->screen.getHeight(), 0, 0, -                                                mRT->screen.getWidth(), mRT->screen.getHeight(), -                                                GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); +                                                  mRT->screen.getWidth(), mRT->screen.getHeight(), +                                                  GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST);      }*/      LLVertexBuffer::unbind(); @@ -8513,8 +8519,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_              F32* m = gGLModelView;              F32 mat[] = { m[0], m[1], m[2], -                        m[4], m[5], m[6], -                        m[8], m[9], m[10] }; +                          m[4], m[5], m[6], +                          m[8], m[9], m[10] };              shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, true, mat);          } @@ -8708,8 +8714,8 @@ void LLPipeline::renderDeferredLighting()                  glClearColor(0, 0, 0, 0);                  sun_shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, -                                            (GLfloat)deferred_light_target->getWidth(), -                                            (GLfloat)deferred_light_target->getHeight()); +                                              (GLfloat)deferred_light_target->getWidth(), +                                              (GLfloat)deferred_light_target->getHeight());                  {                      LLGLDisable   blend(GL_BLEND); @@ -8788,8 +8794,7 @@ void LLPipeline::renderDeferredLighting()          screen_target->clear(GL_COLOR_BUFFER_BIT);          if (RenderDeferredAtmospheric) -        { -            // apply sunlight contribution +        {  // apply sunlight contribution              LLGLSLShader &soften_shader = gDeferredSoftenProgram;              LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - atmospherics"); @@ -9086,35 +9091,35 @@ void LLPipeline::renderDeferredLighting()          pushRenderTypeMask();          andRenderTypeMask(LLPipeline::RENDER_TYPE_ALPHA, -                        LLPipeline::RENDER_TYPE_ALPHA_PRE_WATER, -                        LLPipeline::RENDER_TYPE_ALPHA_POST_WATER, -                        LLPipeline::RENDER_TYPE_FULLBRIGHT, -                        LLPipeline::RENDER_TYPE_VOLUME, -                        LLPipeline::RENDER_TYPE_GLOW, -                        LLPipeline::RENDER_TYPE_BUMP, -                        LLPipeline::RENDER_TYPE_GLTF_PBR, -                        LLPipeline::RENDER_TYPE_PASS_SIMPLE, -                        LLPipeline::RENDER_TYPE_PASS_ALPHA, -                        LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK, -                        LLPipeline::RENDER_TYPE_PASS_BUMP, -                        LLPipeline::RENDER_TYPE_PASS_POST_BUMP, -                        LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT, -                        LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK, -                        LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY, -                        LLPipeline::RENDER_TYPE_PASS_GLOW, -                        LLPipeline::RENDER_TYPE_PASS_GLTF_GLOW, -                        LLPipeline::RENDER_TYPE_PASS_GRASS, -                        LLPipeline::RENDER_TYPE_PASS_SHINY, -                        LLPipeline::RENDER_TYPE_PASS_INVISIBLE, -                        LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY, -                        LLPipeline::RENDER_TYPE_AVATAR, -                        LLPipeline::RENDER_TYPE_CONTROL_AV, -                        LLPipeline::RENDER_TYPE_ALPHA_MASK, -                        LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK, -                        LLPipeline::RENDER_TYPE_TERRAIN, -                        LLPipeline::RENDER_TYPE_WATER, -                        LLPipeline::RENDER_TYPE_WATEREXCLUSION, -                        END_RENDER_TYPES); +                          LLPipeline::RENDER_TYPE_ALPHA_PRE_WATER, +                          LLPipeline::RENDER_TYPE_ALPHA_POST_WATER, +                          LLPipeline::RENDER_TYPE_FULLBRIGHT, +                          LLPipeline::RENDER_TYPE_VOLUME, +                          LLPipeline::RENDER_TYPE_GLOW, +                          LLPipeline::RENDER_TYPE_BUMP, +                          LLPipeline::RENDER_TYPE_GLTF_PBR, +                          LLPipeline::RENDER_TYPE_PASS_SIMPLE, +                          LLPipeline::RENDER_TYPE_PASS_ALPHA, +                          LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK, +                          LLPipeline::RENDER_TYPE_PASS_BUMP, +                          LLPipeline::RENDER_TYPE_PASS_POST_BUMP, +                          LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT, +                          LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK, +                          LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY, +                          LLPipeline::RENDER_TYPE_PASS_GLOW, +                          LLPipeline::RENDER_TYPE_PASS_GLTF_GLOW, +                          LLPipeline::RENDER_TYPE_PASS_GRASS, +                          LLPipeline::RENDER_TYPE_PASS_SHINY, +                          LLPipeline::RENDER_TYPE_PASS_INVISIBLE, +                          LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY, +                          LLPipeline::RENDER_TYPE_AVATAR, +                          LLPipeline::RENDER_TYPE_CONTROL_AV, +                          LLPipeline::RENDER_TYPE_ALPHA_MASK, +                          LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK, +                          LLPipeline::RENDER_TYPE_TERRAIN, +                          LLPipeline::RENDER_TYPE_WATER, +                          LLPipeline::RENDER_TYPE_WATEREXCLUSION, +                          END_RENDER_TYPES);          renderGeomPostDeferred(*LLViewerCamera::getInstance());          popRenderTypeMask(); @@ -9222,7 +9227,6 @@ void LLPipeline::doWaterHaze()              LLRenderTarget& dst = gPipeline.mWaterDis;              mRT->screen.flush(); -              dst.bindTarget("water haze copy depth", 1);              gCopyDepthProgram.bind(); @@ -9281,6 +9285,7 @@ void LLPipeline::doWaterHaze()          unbindDeferredShader(haze_shader); +          gGL.setSceneBlendType(LLRender::BT_ALPHA);      } @@ -9523,7 +9528,6 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)      S32 channel = shader.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);      bool bound = false; -      if (channel > -1 && mReflectionMapManager.mTexture.notNull())      {          mReflectionMapManager.mTexture->bind(channel); @@ -9561,32 +9565,34 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)      //{          //LL_WARNS() << "binding SSR to reflection maps" << LL_ENDL; -        channel = shader.enableTexture(LLShaderMgr::SCENE_MAP); -        if (channel > -1) -        { -            gGL.getTexUnit(channel)->bind(&mSceneMap); -        } +    channel = shader.enableTexture(LLShaderMgr::SCENE_MAP); +    if (channel > -1) +    { +        gGL.getTexUnit(channel)->bind(&mSceneMap); +    } -        shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ITR_COUNT, (GLfloat)RenderScreenSpaceReflectionIterations); -        shader.uniform1f(LLShaderMgr::DEFERRED_SSR_DIST_BIAS, RenderScreenSpaceReflectionDistanceBias); -        shader.uniform1f(LLShaderMgr::DEFERRED_SSR_RAY_STEP, RenderScreenSpaceReflectionRayStep); -        shader.uniform1f(LLShaderMgr::DEFERRED_SSR_GLOSSY_SAMPLES, (GLfloat)RenderScreenSpaceReflectionGlossySamples); -        shader.uniform1f(LLShaderMgr::DEFERRED_SSR_REJECT_BIAS, RenderScreenSpaceReflectionDepthRejectBias); -        mPoissonOffset++; -        if (mPoissonOffset > 128 - RenderScreenSpaceReflectionGlossySamples) -            mPoissonOffset = 0; +    shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ITR_COUNT, (GLfloat)RenderScreenSpaceReflectionIterations); +    shader.uniform1f(LLShaderMgr::DEFERRED_SSR_DIST_BIAS, RenderScreenSpaceReflectionDistanceBias); +    shader.uniform1f(LLShaderMgr::DEFERRED_SSR_RAY_STEP, RenderScreenSpaceReflectionRayStep); +    shader.uniform1f(LLShaderMgr::DEFERRED_SSR_GLOSSY_SAMPLES, (GLfloat)RenderScreenSpaceReflectionGlossySamples); +    shader.uniform1f(LLShaderMgr::DEFERRED_SSR_REJECT_BIAS, RenderScreenSpaceReflectionDepthRejectBias); +    mPoissonOffset++; -        shader.uniform1f(LLShaderMgr::DEFERRED_SSR_NOISE_SINE, (GLfloat)mPoissonOffset); -        shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ADAPTIVE_STEP_MULT, RenderScreenSpaceReflectionAdaptiveStepMultiplier); +    if (mPoissonOffset > 128 - RenderScreenSpaceReflectionGlossySamples) +        mPoissonOffset = 0; -        channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH); -        if (channel > -1) -        { -            gGL.getTexUnit(channel)->bind(&mSceneMap, true); -        } +    shader.uniform1f(LLShaderMgr::DEFERRED_SSR_NOISE_SINE, (GLfloat)mPoissonOffset); +    shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ADAPTIVE_STEP_MULT, RenderScreenSpaceReflectionAdaptiveStepMultiplier); + +    channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH); +    if (channel > -1) +    { +        gGL.getTexUnit(channel)->bind(&mSceneMap, true); +    }      //} +      LOG_GLERROR("bindReflectionProbes() end");  } @@ -9728,6 +9734,7 @@ void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCa          }      }; +      LLVertexBuffer::unbind();      for (int j = 0; j < 2; ++j) // 0 -- static, 1 -- rigged      { @@ -9772,67 +9779,69 @@ void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCa          renderGeomShadow(shadow_cam);      } -    LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha"); -    LL_PROFILE_GPU_ZONE("shadow alpha"); -    LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA); - -    const S32 sun_up = LLEnvironment::instance().getIsSunUp() ? 1 : 0; -    U32 target_width = LLRenderTarget::sCurResX; - -    for (int i = 0; i < 2; ++i)      { -        bool rigged = i == 1; - -        { -            LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha masked"); -            LL_PROFILE_GPU_ZONE("shadow alpha masked"); -            LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_MASKED); -            gDeferredShadowAlphaMaskProgram.bind(rigged); -            LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); -            LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); -            renderMaskedObjects(LLRenderPass::PASS_ALPHA_MASK, true, true, rigged); -        } +        LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha"); +        LL_PROFILE_GPU_ZONE("shadow alpha"); +        LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA); -        { -            LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha blend"); -            LL_PROFILE_GPU_ZONE("shadow alpha blend"); -            LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_BLEND); -            renderAlphaObjects(rigged); -        } +        const S32 sun_up = LLEnvironment::instance().getIsSunUp() ? 1 : 0; +        U32 target_width = LLRenderTarget::sCurResX; +        for (int i = 0; i < 2; ++i)          { -            LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow fullbright alpha masked"); -            LL_PROFILE_GPU_ZONE("shadow alpha masked"); -            LL_RECORD_BLOCK_TIME(FTM_SHADOW_FULLBRIGHT_ALPHA_MASKED); - -            gDeferredShadowFullbrightAlphaMaskProgram.bind(rigged); -            LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); -            LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); -            renderFullbrightMaskedObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true, rigged); -        } +            bool rigged = i == 1; -        { -            LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha grass"); -            LL_PROFILE_GPU_ZONE("shadow alpha grass"); -            LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_GRASS); +            { +                LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha masked"); +                LL_PROFILE_GPU_ZONE("shadow alpha masked"); +                LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_MASKED); +                gDeferredShadowAlphaMaskProgram.bind(rigged); +                LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); +                LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); +                renderMaskedObjects(LLRenderPass::PASS_ALPHA_MASK, true, true, rigged); +            } -            gDeferredTreeShadowProgram.bind(rigged); -            LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF); +            { +                LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha blend"); +                LL_PROFILE_GPU_ZONE("shadow alpha blend"); +                LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_BLEND); +                renderAlphaObjects(rigged); +            } -            if (i == 0)              { -                renderObjects(LLRenderPass::PASS_GRASS, true); +                LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow fullbright alpha masked"); +                LL_PROFILE_GPU_ZONE("shadow alpha masked"); +                LL_RECORD_BLOCK_TIME(FTM_SHADOW_FULLBRIGHT_ALPHA_MASKED); + +                gDeferredShadowFullbrightAlphaMaskProgram.bind(rigged); +                LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); +                LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); +                renderFullbrightMaskedObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true, rigged);              }              { -                LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha material"); -                LL_PROFILE_GPU_ZONE("shadow alpha material"); -                LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_MATERIAL); +                LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha grass"); +                LL_PROFILE_GPU_ZONE("shadow alpha grass"); +                LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_GRASS); + +                gDeferredTreeShadowProgram.bind(rigged); +                LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF); + +                if (i == 0) +                { +                    renderObjects(LLRenderPass::PASS_GRASS, true); +                } -                renderMaskedObjects(LLRenderPass::PASS_NORMSPEC_MASK, true, false, rigged); -                renderMaskedObjects(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, true, false, rigged); -                renderMaskedObjects(LLRenderPass::PASS_SPECMAP_MASK, true, false, rigged); -                renderMaskedObjects(LLRenderPass::PASS_NORMMAP_MASK, true, false, rigged); +                { +                    LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha material"); +                    LL_PROFILE_GPU_ZONE("shadow alpha material"); +                    LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_MATERIAL); + +                    renderMaskedObjects(LLRenderPass::PASS_NORMSPEC_MASK, true, false, rigged); +                    renderMaskedObjects(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, true, false, rigged); +                    renderMaskedObjects(LLRenderPass::PASS_SPECMAP_MASK, true, false, rigged); +                    renderMaskedObjects(LLRenderPass::PASS_NORMMAP_MASK, true, false, rigged); +                }              }          } @@ -11041,12 +11050,12 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool      // previews can't be muted or impostered      bool visually_muted = !for_profile && !preview_avatar && avatar->isVisuallyMuted();      LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID() -                            << " is " << ( visually_muted ? "" : "not ") << "visually muted" -                            << LL_ENDL; +                              << " is " << ( visually_muted ? "" : "not ") << "visually muted" +                              << LL_ENDL;      bool too_complex = !for_profile && !preview_avatar && avatar->isTooComplex();      LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID() -                            << " is " << ( too_complex ? "" : "not ") << "too complex" -                            << LL_ENDL; +                              << " is " << ( too_complex ? "" : "not ") << "too complex" +                              << LL_ENDL;      pushRenderTypeMask(); @@ -11076,7 +11085,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool              RENDER_TYPE_CLOUDS,              RENDER_TYPE_HUD_PARTICLES,              END_RENDER_TYPES -        ); +         );      }      if (specific_attachment && specific_attachment->isHUDAttachment()) @@ -11668,7 +11677,7 @@ void LLPipeline::hideDrawable( LLDrawable *pDrawable )      //hide the children      LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();      for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); -        iter != child_list.end(); iter++ ) +          iter != child_list.end(); iter++ )      {          LLViewerObject* child = *iter;          LLDrawable* drawable = child->mDrawable; @@ -11686,7 +11695,7 @@ void LLPipeline::unhideDrawable( LLDrawable *pDrawable )      //restore children      LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();      for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); -        iter != child_list.end(); iter++) +          iter != child_list.end(); iter++)      {          LLViewerObject* child = *iter;          LLDrawable* drawable = child->mDrawable; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index c56e181d2d..fd94f1428c 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -232,12 +232,12 @@ public:      LLViewerObject* lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end, -                                            bool pick_transparent, -                                            S32* face_hit,                          // return the face hit -                                            LLVector4a* intersection = NULL,         // return the intersection point -                                            LLVector2* tex_coord = NULL,            // return the texture coordinates of the intersection point -                                            LLVector4a* normal = NULL,               // return the surface normal at the intersection point -                                            LLVector4a* tangent = NULL             // return the surface tangent at the intersection point +                                              bool pick_transparent, +                                              S32* face_hit,                          // return the face hit +                                              LLVector4a* intersection = NULL,         // return the intersection point +                                              LLVector2* tex_coord = NULL,            // return the texture coordinates of the intersection point +                                              LLVector4a* normal = NULL,               // return the surface normal at the intersection point +                                              LLVector4a* tangent = NULL             // return the surface tangent at the intersection point          );      // Something about these textures has changed.  Dirty them. @@ -843,8 +843,8 @@ protected:      {          Light(LLDrawable* ptr, F32 d, F32 f = 0.0f)              : drawable(ptr), -            dist(d), -            fade(f) +              dist(d), +              fade(f)          {}          LLPointer<LLDrawable> drawable;          F32 dist; diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index a96a4f2b75..97ff1fd5a2 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -1,201 +1,184 @@  <?xml version="1.0" encoding="utf-8" standalone="yes"?>  <floater -legacy_header_height="18" -positioning="centered" -default_tab_group="1" -height="530" -layout="topleft" -name="Preferences" -help_topic="preferences" -save_rect="true" -single_instance="true" -title="PREFERENCES" -width="658"> - -<button -follows="right|bottom" -height="23" -label="OK" -label_selected="OK" -layout="topleft" -right="-105" -name="OK" -top="492" -width="90"> -   <button.commit_callback -   function="Pref.OK" /> -</button> - -<button -follows="right|bottom" -height="23" -label="Cancel" -label_selected="Cancel" -layout="topleft" -left_pad="5" -name="Cancel" -right="-10" -width="90" > -   <button.commit_callback -   function="Pref.Cancel" /> -</button> - -<panel -name="search_panel" -layout="topleft" -follows="left|top|right" -left="4" -right="-4" -top="21" -height="18" -tab_group="2"> - -   <search_editor -   clear_button_visible="true" -   follows="left|top|right" -   height="18" -   label="Search Settings" -   layout="topleft" -   left="0" -   max_length_bytes="255" -   name="search_prefs_edit" -   right="-1" -   text_pad_left="6" -   tool_tip="Type the search term you are interested in here. Results will be displayed for partial fulltext matches within the setting's name or comment." -   top="0"> - -   <search_editor.commit_callback -      function="UpdateFilter" /> - -   <search_editor.clear_button -      rect.height="18" -      rect.width="18" -      rect.bottom="-1" /> - -   <search_editor.search_button -      rect.height="12" -      rect.width="12" -      rect.bottom="-1" /> -   </search_editor> -</panel> - -<tab_container -follows="all" -halign="left" -height="440" -layout="topleft" -left="0" -name="pref core" -tab_group="1" -tab_position="left" -tab_width="140" -tab_padding_right="0" -top="40" -width="658"> - -   <panel -   class="panel_preference" -   filename="panel_preferences_general.xml" -   label="General" -   layout="topleft" -   help_topic="preferences_general_tab" -   name="general" /> - -   <panel -   class="panel_preference_graphics" -   filename="panel_preferences_graphics1.xml" -   label="Graphics" -   layout="topleft" -   help_topic="preferences_display_tab" -   name="display" /> - -   <panel -   class="panel_preference_graphics3" -   filename="panel_preferences_graphics3.xml" -   label="Visual Effects" -   layout="topleft" -   help_topic="preferences_display_tab" -   name="display3" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_sound.xml" -   label="Sound & Media" -   layout="topleft" -   help_topic="preferences_audio_tab" -   name="audio" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_chat.xml" -   label="Chat" -   layout="topleft" -   help_topic="preferences_chat_tab" -   name="chat" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_move.xml" -   label="Move & View" -   layout="topleft" -   help_topic="preferences_move_tab" -   name="move" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_alerts.xml" -   label="Notifications" -   layout="topleft" -   help_topic="preferences_msgs_tab" -   name="msgs" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_colors.xml" -   label="Colors" -   layout="topleft" -   help_topic="preferences_colors_tab" -   name="colors" /> - -   <panel -   class="panel_preference_privacy" -   filename="panel_preferences_privacy.xml" -   label="Privacy" -   layout="topleft" -   help_topic="preferences_im_tab" -   name="im" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_setup.xml" -   label="Setup" -   layout="topleft" -   help_topic="preferences_input_tab" -   name="input" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_advanced.xml" -   label="Advanced" -   layout="topleft" -   help_topic="preferences_advanced1_tab" -   name="advanced1" /> - -   <panel -   class="panel_preference" -   filename="panel_preferences_uploads.xml" -   label="Uploads" -   layout="topleft" -   help_topic="preferences_uploads_tab" -   name="uploads" /> - -   <panel -   class="panel_preference_controls" -   filename="panel_preferences_controls.xml" -   label="Controls" -   layout="topleft" -   help_topic="preferences_controls_tab" -   name="controls" /> -</tab_container> + legacy_header_height="18" + positioning="centered" + default_tab_group="1" + height="530" + layout="topleft" + name="Preferences" + help_topic="preferences" + save_rect="true" + single_instance="true" + title="PREFERENCES" + width="658"> +   <button +     follows="right|bottom" +     height="23" +     label="OK" +     label_selected="OK" +     layout="topleft" +     right="-105" +     name="OK" +     top="492" +     width="90"> +        <button.commit_callback +         function="Pref.OK" /> +    </button> +    <button +     follows="right|bottom" +     height="23" +     label="Cancel" +     label_selected="Cancel" +     layout="topleft" +     left_pad="5" +     name="Cancel" +     right="-10" +     width="90" > +        <button.commit_callback +         function="Pref.Cancel" /> +    </button> + +    <panel +     name="search_panel" +     layout="topleft" +     follows="left|top|right" +     left="4" +     right="-4" +     top="21" +     height="18" +     tab_group="2"> +        <search_editor +         clear_button_visible="true" +         follows="left|top|right" +         height="18" +         label="Search Settings" +         layout="topleft" +         left="0" +         max_length_bytes="255" +         name="search_prefs_edit" +         right="-1" +         text_pad_left="6" +         tool_tip="Type the search term you are interested in here. Results will be displayed for partial fulltext matches within the setting's name or comment." +         top="0"> +         <search_editor.commit_callback +          function="UpdateFilter" /> +         <search_editor.clear_button +          rect.height="18" +          rect.width="18" +          rect.bottom="-1" /> +         <search_editor.search_button +          rect.height="12" +          rect.width="12" +          rect.bottom="-1" /> +        </search_editor> +    </panel> + +    <tab_container +     follows="all" +     halign="left" +     height="440" +     layout="topleft" +     left="0" +     name="pref core" +     tab_group="1" +     tab_position="left" +     tab_width="140" +     tab_padding_right="0" +     top="40" +     width="658"> +        <panel +	 class="panel_preference" +         filename="panel_preferences_general.xml" +         label="General" +         layout="topleft" +         help_topic="preferences_general_tab" +         name="general" /> +        <panel +	 class="panel_preference_graphics" +         filename="panel_preferences_graphics1.xml" +         label="Graphics" +         layout="topleft" +         help_topic="preferences_display_tab" +         name="display" /> + +        <panel +        class="panel_preference_graphics3" +         filename="panel_preferences_graphics3.xml" +         label="Visual Effects" +         layout="topleft" +         help_topic="preferences_display_tab" +         name="display3" /> + +        <panel +		 class="panel_preference" +         filename="panel_preferences_sound.xml" +         label="Sound & Media" +         layout="topleft" +         help_topic="preferences_audio_tab" +         name="audio" /> +        <panel +		 class="panel_preference" +         filename="panel_preferences_chat.xml" +         label="Chat" +         layout="topleft" +         help_topic="preferences_chat_tab" +         name="chat" /> +        <panel +		 class="panel_preference" +         filename="panel_preferences_move.xml" +         label="Move & View" +         layout="topleft" +         help_topic="preferences_move_tab" +         name="move" /> +        <panel +		 class="panel_preference" +         filename="panel_preferences_alerts.xml" +         label="Notifications" +         layout="topleft" +         help_topic="preferences_msgs_tab" +         name="msgs" /> +        <panel +		 class="panel_preference" +         filename="panel_preferences_colors.xml" +         label="Colors" +         layout="topleft" +         help_topic="preferences_colors_tab" +         name="colors" /> +        <panel +         class="panel_preference_privacy" +         filename="panel_preferences_privacy.xml" +         label="Privacy" +         layout="topleft" +         help_topic="preferences_im_tab" +         name="im" /> +        <panel +		 class="panel_preference" +         filename="panel_preferences_setup.xml" +         label="Setup" +         layout="topleft" +         help_topic="preferences_input_tab" +         name="input" /> +        <panel +		 class="panel_preference" +         filename="panel_preferences_advanced.xml" +         label="Advanced" +         layout="topleft" +         help_topic="preferences_advanced1_tab" +         name="advanced1" /> +        <panel +         class="panel_preference" +         filename="panel_preferences_uploads.xml" +         label="Uploads" +         layout="topleft" +         help_topic="preferences_uploads_tab" +         name="uploads" /> +        <panel +         class="panel_preference_controls" +         filename="panel_preferences_controls.xml" +         label="Controls" +         layout="topleft" +         help_topic="preferences_controls_tab" +         name="controls" /> +    </tab_container>  </floater> diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index ddb2833b5d..8acf870c9d 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -52,7 +52,7 @@      left_delta="330"      width="20">       m -  </text> +  </text>     <slider      control_name="RenderMaxPartCount"      decimal_digits="0" @@ -626,9 +626,9 @@        layout="topleft"        left="385"        name="vert_border" -      top="16" +      top="16"              width="0"/> - +      <text      type="string"      length="1" @@ -732,7 +732,7 @@          <check_box.commit_callback            function="Pref.RenderOptionUpdate" />      </check_box> - +        <text      type="string"      length="1" @@ -751,7 +751,7 @@     height="18"     layout="topleft"     left_delta="130" -   top_delta="0" +   top_delta="0"      name="ShadowDetail"     width="150">       <combo_box.item @@ -785,7 +785,7 @@      <check_box.commit_callback        function="Pref.RenderOptionUpdate" />    </check_box> - +      <text      type="string"      length="1" diff --git a/indra/newview/skins/default/xui/en/panel_performance_preferences.xml b/indra/newview/skins/default/xui/en/panel_performance_preferences.xml index 8d4e8dc8e8..ece9bb2552 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_preferences.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_preferences.xml @@ -420,7 +420,6 @@     width="180">        (Enter value between 0.0 and 4.0)    </text> -    <text     follows="left|top"     font="SansSerifSmall" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index c38af9d4fa..e529ec0db1 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -233,6 +233,15 @@       name="stream_notification_channel"       top_pad="-15"       width="170" /> +    <check_box +     control_name="SnapshotTimestamp" +     height="16" +     label="Add timestamp to snapshot file names" +     layout="topleft" +     left="30" +     name="snapshot_timestamp" +     width="256"> +    </check_box>      <check_box       control_name="AllowMultipleViewers" diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml index ae203d68de..fb88b752ae 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml @@ -28,9 +28,9 @@       top_delta="2">          Disk      </text> -    <view_border +    <view_border        bevel_style="in" -     follows="left|top|right" +     follows="left|top|right"        height="1"       left="9"       layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 3bf402b7fd..dbdec5b5ef 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -1,209 +1,209 @@  <?xml version="1.0" encoding="utf-8" standalone="yes"?>  <panel -background_opaque="true" -background_visible="true" -bg_opaque_color="DkGray" -chrome="true" -follows="top|right" -height="19" -layout="topleft" -left="0" -mouse_opaque="false" -name="status" -top="19" -width="1000"> -   <panel.string -   name="packet_loss_tooltip"> -      Packet Loss -   </panel.string> -   <panel.string -   name="bandwidth_tooltip"> -      Bandwidth -   </panel.string> -   <panel.string -   name="time"> -      [hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] -   </panel.string> -   <panel.string -   name="timeTooltip"> -      [weekday, datetime, slt], [day, datetime, slt] [month, datetime, slt] [year, datetime, slt] -   </panel.string> -<panel.string -   name="buycurrencylabel"> -      L$ [AMT] -   </panel.string> -<panel -   height="18" -   left="-398" -   top="0" -   width="120" -   follows="right|top" -   name="menu_search_panel" -   background_opaque="true" -   background_visible="true" -   bg_opaque_color="MouseGray"> -   <search_editor -      clear_button_visible="true" -      follows="left|top" -      height="18" -      label="Search Menus" -      layout="topleft" -      left="0" -      max_length_bytes="255" -      name="search_menu_edit" -      right="-1" -      text_pad_left="6" -      tool_tip="Type the search term you are interested in here. Results will be displayed for partial fulltext matches within the menu." -      top="0"> -      <search_button -         top_pad="4" -         left_pad="4" -         width="12" -         height="12" -         image_unselected="Search" -         image_selected="Search"/> -      <clear_button -         bottom="2" -         height="12" -         image_unselected="Icon_Close_Foreground" -         image_selected="Icon_Close_Press" -         pad_right="4" -         pad_left="4" -         width="12"/> -   </search_editor> -</panel> -<panel -   height="18" -   left="-398" -   width="185" -   top="1" -   follows="right|top" -   name="balance_bg"> -   <text -   halign="center" -   font="SansSerifSmall" -   follows="all" -   height="18" -   left="0" -   name="balance" -   tool_tip="Click to refresh your L$ balance" -   v_pad="4" -   top="0" -   wrap="false" -   value="L$??" -   width="40" /> -   <button -   halign="center" -   font="SansSerifSmall" -   follows="right|top|bottom" -   image_hover_unselected="PushButton_Over" -   image_unselected="PushButton_Off" -   image_pressed="PushButton_Press" -   height="18" -   label="Buy L$" -   label_color="White" -   left_pad="0" -   label_shadow="true" -   name="buyL" -   pad_right="0" -   tool_tip="Click to buy more L$" -   top="0" -   width="80" /> -   <button -   halign="left" -   font="SansSerifSmall" -   follows="right|top|bottom" -   imgoverlay_label_space="7" -   image_overlay="Command_MiniCart_Icon" -   image_overlay_alignment="left" -   image_hover_unselected="PushButton_Over" -   image_unselected="PushButton_Off" -   image_pressed="PushButton_Press" -   height="18" -   label="Shop" -   label_color="White" -   left_pad="0" -   label_shadow="true" -   name="goShop" -   tool_tip="Open Second Life Marketplace" -   top="0" -   width="65" /> -</panel> -   <text -   type="string" -   font="SansSerifSmall" -   text_readonly_color="TimeTextColor" -   follows="right|top" -   halign="right" -   height="16" -   top="5" -   layout="topleft" -   left_pad="0" -   name="TimeText" -   tool_tip="Current time (Pacific)" -   width="85"> -      24:00 AM PST -   </text> -   <icon -   follows="right|top" -   height="16" -   image_name="Cam_FreeCam_Off" -   left_pad="8" -   top="2" -   name="presets_icon_camera" -   width="18" /> -   <icon -   follows="right|top" -   height="13" -   image_name="Presets_Icon" -   left_pad="8" -   top="4" -   name="presets_icon_graphic" -   width="16" /> -   <button -   follows="right|top" -   height="16" -   image_selected="Play_Off" -   image_unselected="Pause_Off" -   image_pressed="Pause_Press" -   image_pressed_selected="Play_Press" -   is_toggle="true" -   left_pad="5" -   top="1" -   name="media_toggle_btn" -   tool_tip="Start/Stop All Media (Music, Video, Web pages)" -   width="16" > -   </button> -   <button -   follows="right|top" -   height="16" -   image_selected="AudioMute_Off" -   image_pressed="Audio_Press" -   image_unselected="Audio_Off" -   is_toggle="true" -   left_pad="5" -   top="2" -   name="volume_btn" -   width="16" /> -   <button -   type="string" -   font="SansSerif" -   image_unselected="mp_fpsButton" -   image_selected="mp_fpsButton" -   image_hover_unselected="mp_fpsButton" -   image_pressed="mp_fpsButton" -   image_pressed_selected="mp_fpsButton" -   image_color="White" -   label_color="FpsTextColor" -   follows="right|top" -   halign="center" -   valign="center" -   height="18" -   top="1" -   left_pad="2" -   name="FpsText" -   tool_tip="fps: Color indicates frametime fluctuations (Green is optimal)" -   width="32"> -   60 -   </button> + background_opaque="true" + background_visible="true" + bg_opaque_color="DkGray" + chrome="true" + follows="top|right" + height="19" + layout="topleft" + left="0" + mouse_opaque="false" + name="status" + top="19" + width="1000"> +    <panel.string +     name="packet_loss_tooltip"> +        Packet Loss +    </panel.string> +    <panel.string +     name="bandwidth_tooltip"> +        Bandwidth +    </panel.string> +    <panel.string +     name="time"> +        [hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] +    </panel.string> +    <panel.string +     name="timeTooltip"> +        [weekday, datetime, slt], [day, datetime, slt] [month, datetime, slt] [year, datetime, slt] +    </panel.string> +	<panel.string +     name="buycurrencylabel"> +        L$ [AMT] +    </panel.string> +  <panel +	 height="18" +	 left="-398" +	 top="0" +	 width="120" +	 follows="right|top" +	 name="menu_search_panel" +	 background_opaque="true" +	 background_visible="true" +	 bg_opaque_color="MouseGray"> +		<search_editor +		 clear_button_visible="true" +		 follows="left|top" +		 height="18" +		 label="Search Menus" +		 layout="topleft" +		 left="0" +		 max_length_bytes="255" +		 name="search_menu_edit" +		 right="-1" +		 text_pad_left="6" +		 tool_tip="Type the search term you are interested in here. Results will be displayed for partial fulltext matches within the menu." +		 top="0"> +			<search_button  +			 top_pad="4" +			 left_pad="4"  +			 width="12" +			 height="12"  +			 image_unselected="Search" +			 image_selected="Search"/> +			<clear_button +			 bottom="2" +			 height="12" +			 image_unselected="Icon_Close_Foreground" +			 image_selected="Icon_Close_Press" +			 pad_right="4" +			 pad_left="4" +			 width="12"/> +		</search_editor> +  </panel> +  <panel +    height="18" +    left="-398" +    width="185" +    top="1" +    follows="right|top"  +    name="balance_bg"> +    <text +     halign="center" +     font="SansSerifSmall" +     follows="all" +     height="18" +     left="0"  +     name="balance" +     tool_tip="Click to refresh your L$ balance" +     v_pad="4" +     top="0" +     wrap="false"  +     value="L$??"  +     width="40" /> +    <button +     halign="center" +     font="SansSerifSmall" +     follows="right|top|bottom" +     image_hover_unselected="PushButton_Over" +     image_unselected="PushButton_Off" +     image_pressed="PushButton_Press" +     height="18" +     label="Buy L$" +     label_color="White" +     left_pad="0" +     label_shadow="true" +     name="buyL" +     pad_right="0" +     tool_tip="Click to buy more L$" +     top="0" +     width="80" /> +    <button +     halign="left" +     font="SansSerifSmall" +     follows="right|top|bottom" +     imgoverlay_label_space="7" +     image_overlay="Command_MiniCart_Icon" +     image_overlay_alignment="left" +     image_hover_unselected="PushButton_Over" +     image_unselected="PushButton_Off" +     image_pressed="PushButton_Press" +     height="18" +     label="Shop" +     label_color="White" +     left_pad="0" +     label_shadow="true" +     name="goShop" +     tool_tip="Open Second Life Marketplace" +     top="0" +     width="65" /> +  </panel> +    <text +     type="string" +     font="SansSerifSmall" +     text_readonly_color="TimeTextColor" +     follows="right|top" +     halign="right" +     height="16" +     top="5" +     layout="topleft" +     left_pad="0" +     name="TimeText" +     tool_tip="Current time (Pacific)" +     width="85"> +        24:00 AM PST +    </text> +    <icon +     follows="right|top" +     height="16" +     image_name="Cam_FreeCam_Off" +     left_pad="8" +     top="2" +     name="presets_icon_camera" +     width="18" /> +    <icon +     follows="right|top" +     height="13" +     image_name="Presets_Icon" +     left_pad="8" +     top="4" +     name="presets_icon_graphic" +     width="16" /> +    <button +     follows="right|top" +     height="16" +     image_selected="Play_Off" +     image_unselected="Pause_Off" +     image_pressed="Pause_Press" +     image_pressed_selected="Play_Press" +     is_toggle="true" +     left_pad="5" +     top="1" +     name="media_toggle_btn" +     tool_tip="Start/Stop All Media (Music, Video, Web pages)" +     width="16" > +    </button> +    <button +     follows="right|top" +     height="16" +     image_selected="AudioMute_Off" +     image_pressed="Audio_Press" +     image_unselected="Audio_Off" +     is_toggle="true" +     left_pad="5" +     top="2" +     name="volume_btn" +     width="16" /> +     <button +     type="string" +     font="SansSerif" +     image_unselected="mp_fpsButton" +     image_selected="mp_fpsButton" +     image_hover_unselected="mp_fpsButton" +     image_pressed="mp_fpsButton" +     image_pressed_selected="mp_fpsButton" +     image_color="White" +     label_color="FpsTextColor" +     follows="right|top" +     halign="center" +     valign="center" +     height="18" +     top="1" +     left_pad="2" +     name="FpsText" +     tool_tip="fps: Color indicates frametime fluctuations (Green is optimal)" +     width="32"> +     60 +     </button>  </panel> | 
