summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawpool.cpp')
-rw-r--r--indra/newview/lldrawpool.cpp246
1 files changed, 158 insertions, 88 deletions
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 3de0e8a7c4..edabb55cc3 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -52,6 +52,7 @@
#include "llglcommonfunc.h"
#include "llvoavatar.h"
#include "llviewershadermgr.h"
+#include "llperfstats.h"
S32 LLDrawPool::sNumDrawPools = 0;
@@ -385,13 +386,24 @@ void LLRenderPass::renderGroup(LLSpatialGroup* group, U32 type, bool texture)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
-
+
+ std::unique_ptr<LLPerfStats::RecordAttachmentTime> ratPtr{}; // Perf stats
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
{
LLDrawInfo *pparams = *k;
if (pparams)
{
- pushBatch(*pparams, texture);
+#if 0 // TODO SL-19656 figure out how to reenable trackAttachments()
+ if(pparams->mFace)
+ {
+ LLViewerObject* vobj = pparams->mFace->getViewerObject();
+ if(vobj->isAttachment())
+ {
+ trackAttachments(vobj, false, &ratPtr);
+ }
+ }
+#endif
+ pushBatch(*pparams, texture);
}
}
}
@@ -403,11 +415,23 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, bool textu
LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
+ std::unique_ptr<LLPerfStats::RecordAttachmentTime> ratPtr{}; // Perf stats
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
{
LLDrawInfo* pparams = *k;
if (pparams)
{
+#if 0 // TODO SL-19656 figure out how to reenable trackAttachments()
+ if(pparams->mFace)
+ {
+ LLViewerObject* vobj = pparams->mFace->getViewerObject();
+ if(vobj->isAttachment())
+ {
+ trackAttachments( vobj, true ,&ratPtr);
+ }
+ }
+#endif
+
if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)
{
uploadMatrixPalette(*pparams);
@@ -420,93 +444,10 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, bool textu
}
}
-void setup_texture_matrix(LLDrawInfo& params)
-{
- if (params.mTextureMatrix)
- { //special case implementation of texture animation here because of special handling of textures for PBR batches
- gGL.getTexUnit(0)->activate();
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadMatrix((GLfloat*)params.mTextureMatrix->mMatrix);
- gPipeline.mTextureMatrixOps++;
- }
-}
-
-void teardown_texture_matrix(LLDrawInfo& params)
-{
- if (params.mTextureMatrix)
- {
- gGL.matrixMode(LLRender::MM_TEXTURE0);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
-}
-
-void LLRenderPass::pushGLTFBatches(U32 type)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- auto* begin = gPipeline.beginRenderMap(type);
- auto* end = gPipeline.endRenderMap(type);
- for (LLCullResult::drawinfo_iterator i = begin; i != end; )
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("pushGLTFBatch");
- LLDrawInfo& params = **i;
- LLCullResult::increment_iterator(i, end);
-
- pushGLTFBatch(params);
- }
-}
-
-void LLRenderPass::pushGLTFBatch(LLDrawInfo& params)
-{
- auto& mat = params.mGLTFMaterial;
-
- mat->bind(params.mTexture);
-
- LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0);
-
- setup_texture_matrix(params);
-
- applyModelMatrix(params);
-
- params.mVertexBuffer->setBuffer();
- params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
-
- teardown_texture_matrix(params);
-}
-
-void LLRenderPass::pushRiggedGLTFBatches(U32 type)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- LLVOAvatar* lastAvatar = nullptr;
- U64 lastMeshId = 0;
-
- auto* begin = gPipeline.beginRenderMap(type);
- auto* end = gPipeline.endRenderMap(type);
- for (LLCullResult::drawinfo_iterator i = begin; i != end; )
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("pushRiggedGLTFBatch");
- LLDrawInfo& params = **i;
- LLCullResult::increment_iterator(i, end);
-
- pushRiggedGLTFBatch(params, lastAvatar, lastMeshId);
- }
-}
-
-void LLRenderPass::pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId)
-{
- if (params.mAvatar.notNull() && (lastAvatar != params.mAvatar || lastMeshId != params.mSkinInfo->mHash))
- {
- uploadMatrixPalette(params);
- lastAvatar = params.mAvatar;
- lastMeshId = params.mSkinInfo->mHash;
- }
-
- pushGLTFBatch(params);
-}
-
void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures, bool reset_gltf)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+ std::unique_ptr<LLPerfStats::RecordAttachmentTime> ratPtr{};
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
@@ -514,8 +455,17 @@ void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures, bool
LLDrawInfo* pparams = *i;
LLCullResult::increment_iterator(i, end);
- pushBatch(*pparams, texture, batch_textures, reset_gltf);
- reset_gltf = false;
+#if 0 // TODO SL-19656 figure out how to reenable trackAttachments()
+ if(pparams->mFace)
+ {
+ LLViewerObject* vobj = pparams->mFace->getViewerObject();
+ if(vobj->isAttachment())
+ {
+ trackAttachments( vobj, false, &ratPtr);
+ }
+ }
+#endif
+ pushBatch(*pparams, texture, batch_textures, reset_gltf);
}
}
@@ -526,11 +476,23 @@ void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures
U64 lastMeshId = 0;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
+ std::unique_ptr<LLPerfStats::RecordAttachmentTime> ratPtr{}; // Perf stats
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
{
LLDrawInfo* pparams = *i;
LLCullResult::increment_iterator(i, end);
+#if 0 // TODO SL-19656 figure out how to reenable trackAttachments()
+ if(pparams->mFace)
+ {
+ LLViewerObject* vobj = pparams->mFace->getViewerObject();
+ if(vobj->isAttachment())
+ {
+ trackAttachments( vobj, true, &ratPtr);
+ }
+ }
+#endif
+
if (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash))
{
uploadMatrixPalette(*pparams);
@@ -546,12 +508,23 @@ void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures
void LLRenderPass::pushMaskBatches(U32 type, bool texture, bool batch_textures, bool reset_gltf)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+ std::unique_ptr<LLPerfStats::RecordAttachmentTime> ratPtr{};
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
{
LLDrawInfo* pparams = *i;
LLCullResult::increment_iterator(i, end);
+#if 0 // TODO SL-19656 figure out how to reenable trackAttachments()
+ if((*pparams).mFace)
+ {
+ LLViewerObject* vobj = (*pparams).mFace->getViewerObject();
+ if(vobj->isAttachment())
+ {
+ trackAttachments( vobj, false, &ratPtr);
+ }
+ }
+#endif
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
pushBatch(*pparams, texture, batch_textures, reset_gltf);
reset_gltf = false;
@@ -563,6 +536,7 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_text
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
+ std::unique_ptr<LLPerfStats::RecordAttachmentTime> ratPtr{};
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
@@ -571,6 +545,18 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_text
LLCullResult::increment_iterator(i, end);
+ llassert(pparams);
+#if 0 // TODO SL-19656 figure out how to reenable trackAttachments()
+ if((*pparams).mFace)
+ {
+ LLViewerObject* vobj = (*pparams).mFace->getViewerObject();
+ if(vobj->isAttachment())
+ {
+ trackAttachments( vobj, true, &ratPtr);
+ }
+ }
+#endif
+
if (LLGLSLShader::sCurBoundShaderPtr)
{
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
@@ -702,3 +688,87 @@ bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinI
return true;
}
+void setup_texture_matrix(LLDrawInfo& params)
+{
+ if (params.mTextureMatrix)
+ { //special case implementation of texture animation here because of special handling of textures for PBR batches
+ gGL.getTexUnit(0)->activate();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*)params.mTextureMatrix->mMatrix);
+ gPipeline.mTextureMatrixOps++;
+ }
+}
+
+void teardown_texture_matrix(LLDrawInfo& params)
+{
+ if (params.mTextureMatrix)
+ {
+ gGL.matrixMode(LLRender::MM_TEXTURE0);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
+}
+
+void LLRenderPass::pushGLTFBatches(U32 type)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+ auto* begin = gPipeline.beginRenderMap(type);
+ auto* end = gPipeline.endRenderMap(type);
+ for (LLCullResult::drawinfo_iterator i = begin; i != end; )
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("pushGLTFBatch");
+ LLDrawInfo& params = **i;
+ LLCullResult::increment_iterator(i, end);
+
+ pushGLTFBatch(params);
+ }
+}
+
+void LLRenderPass::pushGLTFBatch(LLDrawInfo& params)
+{
+ auto& mat = params.mGLTFMaterial;
+
+ mat->bind(params.mTexture);
+
+ LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0);
+
+ setup_texture_matrix(params);
+
+ applyModelMatrix(params);
+
+ params.mVertexBuffer->setBuffer();
+ params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
+
+ teardown_texture_matrix(params);
+}
+
+void LLRenderPass::pushRiggedGLTFBatches(U32 type)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+ LLVOAvatar* lastAvatar = nullptr;
+ U64 lastMeshId = 0;
+
+ auto* begin = gPipeline.beginRenderMap(type);
+ auto* end = gPipeline.endRenderMap(type);
+ for (LLCullResult::drawinfo_iterator i = begin; i != end; )
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("pushRiggedGLTFBatch");
+ LLDrawInfo& params = **i;
+ LLCullResult::increment_iterator(i, end);
+
+ pushRiggedGLTFBatch(params, lastAvatar, lastMeshId);
+ }
+}
+
+void LLRenderPass::pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId)
+{
+ if (params.mAvatar.notNull() && (lastAvatar != params.mAvatar || lastMeshId != params.mSkinInfo->mHash))
+ {
+ uploadMatrixPalette(params);
+ lastAvatar = params.mAvatar;
+ lastMeshId = params.mSkinInfo->mHash;
+ }
+
+ pushGLTFBatch(params);
+}
+