summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-05-18 18:03:17 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-05-18 18:03:17 -0500
commitcae8aa6ecf231302653091162aa0e13e06c25696 (patch)
treeebd02ace709ec71a0393e9d8cfff15cfb962d9f1 /indra
parent87bda552688bb38fe255cc7e6069c1be6ac20834 (diff)
SL-19726 Fix for llTargetOmega on child prim breaking shadow rendering. Incidental decruft.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lldrawpool.cpp76
-rw-r--r--indra/newview/lldrawpool.h4
-rw-r--r--indra/newview/lldrawpoolalpha.cpp42
-rw-r--r--indra/newview/lldrawpoolalpha.h2
-rw-r--r--indra/newview/pipeline.cpp43
-rw-r--r--indra/newview/pipeline.h1
6 files changed, 100 insertions, 68 deletions
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 187e290066..a9f35b3360 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -422,6 +422,27 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, bool textu
void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+ if (texture)
+ {
+ 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);
+
+ pushBatch(*pparams, texture, batch_textures);
+ }
+ }
+ else
+ {
+ pushUntexturedBatches(type);
+ }
+}
+
+void LLRenderPass::pushUntexturedBatches(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; )
@@ -429,13 +450,44 @@ void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures)
LLDrawInfo* pparams = *i;
LLCullResult::increment_iterator(i, end);
- pushBatch(*pparams, texture, batch_textures);
- }
+ pushUntexturedBatch(*pparams);
+ }
}
void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+
+ if (texture)
+ {
+ LLVOAvatar* lastAvatar = nullptr;
+ U64 lastMeshId = 0;
+ 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 (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash))
+ {
+ uploadMatrixPalette(*pparams);
+ lastAvatar = pparams->mAvatar;
+ lastMeshId = pparams->mSkinInfo->mHash;
+ }
+
+ pushBatch(*pparams, texture, batch_textures);
+ }
+ }
+ else
+ {
+ pushUntexturedRiggedBatches(type);
+ }
+}
+
+void LLRenderPass::pushUntexturedRiggedBatches(U32 type)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
auto* begin = gPipeline.beginRenderMap(type);
@@ -452,7 +504,7 @@ void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures
lastMeshId = pparams->mSkinInfo->mHash;
}
- pushBatch(*pparams, texture, batch_textures);
+ pushUntexturedBatch(*pparams);
}
}
@@ -523,6 +575,8 @@ void LLRenderPass::applyModelMatrix(const LLDrawInfo& params)
void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+ llassert(texture);
+
if (!params.mCount)
{
return;
@@ -532,7 +586,6 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textur
bool tex_setup = false;
- if (texture)
{
if (batch_textures && params.mTextureList.size() > 1)
{
@@ -576,6 +629,21 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textur
}
}
+void LLRenderPass::pushUntexturedBatch(LLDrawInfo& params)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+
+ if (!params.mCount)
+ {
+ return;
+ }
+
+ applyModelMatrix(params);
+
+ params.mVertexBuffer->setBuffer();
+ params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
+}
+
// static
bool LLRenderPass::uploadMatrixPalette(LLDrawInfo& params)
{
diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h
index eef19199b9..d5ef734c4b 100644
--- a/indra/newview/lldrawpool.h
+++ b/indra/newview/lldrawpool.h
@@ -352,7 +352,10 @@ public:
// Use before a non-GLTF batch if it is interleaved with GLTF batches that share the same shader
static void resetGLTFTextureTransform();
void pushBatches(U32 type, bool texture = true, bool batch_textures = false);
+ void pushUntexturedBatches(U32 type);
+
void pushRiggedBatches(U32 type, bool texture = true, bool batch_textures = false);
+ void pushUntexturedRiggedBatches(U32 type);
void pushGLTFBatches(U32 type);
void pushGLTFBatch(LLDrawInfo& params);
void pushRiggedGLTFBatches(U32 type);
@@ -360,6 +363,7 @@ public:
void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
void pushRiggedMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
+ void pushUntexturedBatch(LLDrawInfo& params);
void pushBumpBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
static bool uploadMatrixPalette(LLDrawInfo& params);
static bool uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo);
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index a96d480c78..5b158d857a 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -282,47 +282,45 @@ void LLDrawPoolAlpha::renderDebugAlpha()
gGL.diffuseColor4f(1, 0, 0, 1);
gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::getSmokeImage());
- U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0;
+ renderAlphaHighlight();
- renderAlphaHighlight(mask);
-
- pushBatches(LLRenderPass::PASS_ALPHA_MASK, mask, FALSE);
- pushBatches(LLRenderPass::PASS_ALPHA_INVISIBLE, mask, FALSE);
+ pushUntexturedBatches(LLRenderPass::PASS_ALPHA_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_ALPHA_INVISIBLE);
// Material alpha mask
gGL.diffuseColor4f(0, 0, 1, 1);
- pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, mask, FALSE);
- pushBatches(LLRenderPass::PASS_NORMMAP_MASK, mask, FALSE);
- pushBatches(LLRenderPass::PASS_SPECMAP_MASK, mask, FALSE);
- pushBatches(LLRenderPass::PASS_NORMSPEC_MASK, mask, FALSE);
- pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, mask, FALSE);
- pushBatches(LLRenderPass::PASS_GLTF_PBR_ALPHA_MASK, mask, FALSE);
+ pushUntexturedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_NORMMAP_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_SPECMAP_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_NORMSPEC_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_GLTF_PBR_ALPHA_MASK);
gGL.diffuseColor4f(0, 1, 0, 1);
- pushBatches(LLRenderPass::PASS_INVISIBLE, mask, FALSE);
+ pushUntexturedBatches(LLRenderPass::PASS_INVISIBLE);
gHighlightProgram.mRiggedVariant->bind();
gGL.diffuseColor4f(1, 0, 0, 1);
- pushRiggedBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, mask, FALSE);
- pushRiggedBatches(LLRenderPass::PASS_ALPHA_INVISIBLE_RIGGED, mask, FALSE);
+ pushRiggedBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, false);
+ pushRiggedBatches(LLRenderPass::PASS_ALPHA_INVISIBLE_RIGGED, false);
// Material alpha mask
gGL.diffuseColor4f(0, 0, 1, 1);
- pushRiggedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK_RIGGED, mask, FALSE);
- pushRiggedBatches(LLRenderPass::PASS_NORMMAP_MASK_RIGGED, mask, FALSE);
- pushRiggedBatches(LLRenderPass::PASS_SPECMAP_MASK_RIGGED, mask, FALSE);
- pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_MASK_RIGGED, mask, FALSE);
- pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, mask, FALSE);
- pushRiggedBatches(LLRenderPass::PASS_GLTF_PBR_ALPHA_MASK_RIGGED, mask, FALSE);
+ pushRiggedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK_RIGGED, false);
+ pushRiggedBatches(LLRenderPass::PASS_NORMMAP_MASK_RIGGED, false);
+ pushRiggedBatches(LLRenderPass::PASS_SPECMAP_MASK_RIGGED, false);
+ pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_MASK_RIGGED, false);
+ pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, false);
+ pushRiggedBatches(LLRenderPass::PASS_GLTF_PBR_ALPHA_MASK_RIGGED, false);
gGL.diffuseColor4f(0, 1, 0, 1);
- pushRiggedBatches(LLRenderPass::PASS_INVISIBLE_RIGGED, mask, FALSE);
+ pushRiggedBatches(LLRenderPass::PASS_INVISIBLE_RIGGED, false);
LLGLSLShader::sCurBoundShaderPtr->unbind();
}
}
-void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
+void LLDrawPoolAlpha::renderAlphaHighlight()
{
for (int pass = 0; pass < 2; ++pass)
{ //two passes, one rigged and one not
diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h
index f2f802d85e..820c4f4e68 100644
--- a/indra/newview/lldrawpoolalpha.h
+++ b/indra/newview/lldrawpoolalpha.h
@@ -65,7 +65,7 @@ public:
void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE);
void renderAlpha(U32 mask, bool depth_only = false, bool rigged = false);
- void renderAlphaHighlight(U32 mask);
+ void renderAlphaHighlight();
bool uploadMatrixPalette(const LLDrawInfo& params);
static BOOL sShowDebugAlpha;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 2687ccfae2..40112421cd 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6452,6 +6452,7 @@ void LLPipeline::renderObjects(U32 type, bool texture, bool batch_texture, bool
assertInitialized();
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
+
if (rigged)
{
mSimplePool->pushRiggedBatches(type + 1, texture, batch_texture);
@@ -6460,40 +6461,9 @@ void LLPipeline::renderObjects(U32 type, bool texture, bool batch_texture, bool
{
mSimplePool->pushBatches(type, texture, batch_texture);
}
- gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
-}
-
-void LLPipeline::renderShadowSimple(U32 type)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
- gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
-
- LLVertexBuffer* last_vb = nullptr;
-
- LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
- LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
-
- for (LLCullResult::drawinfo_iterator i = begin; i != end; )
- {
- LLDrawInfo& params = **i;
-
- LLCullResult::increment_iterator(i, end);
- LLVertexBuffer* vb = params.mVertexBuffer;
- if (vb != last_vb)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("push shadow simple");
- mSimplePool->applyModelMatrix(params);
- vb->setBuffer();
- vb->drawRange(LLRender::TRIANGLES, 0, vb->getNumVerts()-1, vb->getNumIndices(), 0);
- last_vb = vb;
- }
- }
gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
+ gGLLastMatrix = NULL;
}
// Currently only used for shadows -Cosmic,2023-04-19
@@ -8624,14 +8594,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
for (U32 type : types)
{
- if (rigged)
- {
- renderObjects(type, false, false, rigged);
- }
- else
- {
- renderShadowSimple(type);
- }
+ renderObjects(type, false, false, rigged);
}
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 6b367d3d73..d42253b8d7 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -280,7 +280,6 @@ public:
void forAllVisibleDrawables(void (*func)(LLDrawable*));
void renderObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
- void renderShadowSimple(U32 type);
void renderAlphaObjects(bool rigged = false);
void renderMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);