summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-02-07 18:25:22 -0600
committerDave Parks <davep@lindenlab.com>2023-02-07 18:25:22 -0600
commita2647e953aeee26ef99e62e0146adcd37c8afca1 (patch)
treeafb8c28e3ca63eb0f3c5773e3230aa24fe9ff77d /indra/newview/llvovolume.cpp
parentbe9e4f186db1b3612a26e27a0294114ca66c539c (diff)
SL-18229 Fix for PBR materials on HUDs misbehaving. Incidental decruft.
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp72
1 files changed, 42 insertions, 30 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 865c3df1e4..0c5aac4d0f 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5306,33 +5306,35 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
}
- if (idx >= 0 &&
- draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
- draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
+ LLDrawInfo* info = idx >= 0 ? draw_vec[idx] : nullptr;
+
+ if (info &&
+ info->mVertexBuffer == facep->getVertexBuffer() &&
+ info->mEnd == facep->getGeomIndex()-1 &&
(LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex || batchable) &&
#if LL_DARWIN
- draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
- draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
+ info->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
+ info->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
#endif
- draw_vec[idx]->mMaterialID == mat_id &&
- draw_vec[idx]->mFullbright == fullbright &&
- draw_vec[idx]->mBump == bump &&
- (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different
- draw_vec[idx]->mTextureMatrix == tex_mat &&
- draw_vec[idx]->mModelMatrix == model_mat &&
- draw_vec[idx]->mShaderMask == shader_mask &&
- draw_vec[idx]->mAvatar == facep->mAvatar &&
- draw_vec[idx]->getSkinHash() == facep->getSkinHash())
+ info->mMaterialID == mat_id &&
+ info->mFullbright == fullbright &&
+ info->mBump == bump &&
+ (!mat || (info->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different
+ info->mTextureMatrix == tex_mat &&
+ info->mModelMatrix == model_mat &&
+ info->mShaderMask == shader_mask &&
+ info->mAvatar == facep->mAvatar &&
+ info->getSkinHash() == facep->getSkinHash())
{
- draw_vec[idx]->mCount += facep->getIndicesCount();
- draw_vec[idx]->mEnd += facep->getGeomCount();
+ info->mCount += facep->getIndicesCount();
+ info->mEnd += facep->getGeomCount();
- if (index < FACE_DO_NOT_BATCH_TEXTURES && index >= draw_vec[idx]->mTextureList.size())
+ if (index < FACE_DO_NOT_BATCH_TEXTURES && index >= info->mTextureList.size())
{
- draw_vec[idx]->mTextureList.resize(index+1);
- draw_vec[idx]->mTextureList[index] = tex;
+ info->mTextureList.resize(index+1);
+ info->mTextureList[index] = tex;
}
- draw_vec[idx]->validate();
+ info->validate();
}
else
{
@@ -5342,6 +5344,9 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
U32 count = facep->getIndicesCount();
LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex,
facep->getVertexBuffer(), fullbright, bump);
+
+ info = draw_info;
+
draw_vec.push_back(draw_info);
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
@@ -5417,6 +5422,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
draw_info->validate();
}
+
+ llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR || info->mGLTFMaterial != nullptr);
+ llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_RIGGED || info->mGLTFMaterial != nullptr);
+ llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK || info->mGLTFMaterial != nullptr);
+ llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK_RIGGED || info->mGLTFMaterial != nullptr);
+
+ llassert(type != LLRenderPass::PASS_NORMSPEC || info->mNormalMap.notNull());
}
void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group)
@@ -5790,7 +5802,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
facep->setPoolType(type);
- if (vobj->isHUDAttachment())
+ if (vobj->isHUDAttachment() && !is_pbr)
{
facep->setState(LLFace::FULLBRIGHT);
}
@@ -6487,17 +6499,17 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
fullbright = TRUE;
}
- if (hud_group)
+ const LLTextureEntry* te = facep->getTextureEntry();
+ LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
+
+ if (hud_group && gltf_mat == nullptr)
{ //all hud attachments are fullbright
fullbright = TRUE;
}
-
- const LLTextureEntry* te = facep->getTextureEntry();
+
tex = facep->getTexture();
BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE;
-
- LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
LLMaterial* mat = nullptr;
bool can_be_shiny = false;
@@ -6523,7 +6535,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
is_alpha = (is_alpha || transparent) ? TRUE : FALSE;
- if ((gltf_mat || mat) && LLPipeline::sRenderDeferred && !hud_group)
+ if (gltf_mat || (mat && !hud_group))
{
bool material_pass = false;
@@ -6692,7 +6704,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY);
registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
}
- else if (LLPipeline::sRenderDeferred && !hud_group)
+ else if (!hud_group)
{ //deferred rendering
if (te->getFullbright())
{ //register in post deferred fullbright shiny pass
@@ -6737,7 +6749,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
{
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
}
- if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && use_legacy_bump)
+ if (!hud_group && LLPipeline::sRenderBump && use_legacy_bump)
{ //if this is the deferred render and a bump map is present, register in post deferred bump
registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
}
@@ -6773,7 +6785,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
}
//not sure why this is here, and looks like it might cause bump mapped objects to get rendered redundantly -- davep 5/11/2010
- if (!is_alpha && (hud_group || !LLPipeline::sRenderDeferred))
+ if (!is_alpha && hud_group)
{
llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright);
facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE);