summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRunitai Linden <davep@lindenlab.com>2021-12-08 15:35:25 -0600
committerRunitai Linden <davep@lindenlab.com>2021-12-08 15:35:25 -0600
commit1a6ef9a1fbecadaff00b733c51fd6b980905f102 (patch)
treec49e42662469641ed891561fae356acac12e7063 /indra
parent25e993cd3a961a08d625ac18c31e92a0342a1fe1 (diff)
SL-16468 Fix for crash when enabling highlight transparent (add rigged mesh support to highlight transparent).
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightV.glsl13
-rw-r--r--indra/newview/lldrawpoolalpha.cpp47
-rw-r--r--indra/newview/llviewershadermgr.cpp11
3 files changed, 51 insertions, 20 deletions
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index 9bf7b60eb7..0b362cf46c 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -31,10 +31,23 @@ ATTRIBUTE vec2 texcoord0;
VARYING vec2 vary_texcoord0;
+#ifdef HAS_SKIN
+mat4 getObjectSkinnedTransform();
+uniform mat4 projection_matrix;
+uniform mat4 modelview_matrix;
+#endif
+
void main()
{
//transform vertex
+#ifdef HAS_SKIN
+ mat4 mat = getObjectSkinnedTransform();
+ mat = modelview_matrix * mat;
+ vec4 pos = mat * vec4(position.xyz,1.0);
+ gl_Position = projection_matrix * pos;
+#else
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+#endif
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
}
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index cecdefd7e8..5eb5c6caad 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -160,8 +160,6 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
gGL.setColorMask(true, false);
}
- renderDebugAlpha();
-
deferred_render = FALSE;
}
@@ -201,8 +199,6 @@ void LLDrawPoolAlpha::render(S32 pass)
prepare_forward_shader(simple_shader, minimum_alpha);
forwardRender();
-
- renderDebugAlpha();
}
void LLDrawPoolAlpha::forwardRender()
@@ -232,20 +228,21 @@ void LLDrawPoolAlpha::forwardRender()
renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2);
gGL.setColorMask(true, false);
+
+ renderDebugAlpha();
}
void LLDrawPoolAlpha::renderDebugAlpha()
{
if (sShowDebugAlpha)
{
- gHighlightProgram.bind();
-
- gGL.diffuseColor4f(1,0,0,1);
-
- LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
- gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sSmokeImagep);
- renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0);
+ gHighlightProgram.bind();
+ gGL.diffuseColor4f(1, 0, 0, 1);
+ LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f * 1024.f);
+ gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sSmokeImagep);
+
+ renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0);
pushBatches(LLRenderPass::PASS_ALPHA_MASK, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE);
pushBatches(LLRenderPass::PASS_ALPHA_INVISIBLE, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE);
@@ -283,6 +280,9 @@ void LLDrawPoolAlpha::renderDebugAlpha()
void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
{
+ LLVOAvatar* lastAvatar = nullptr;
+ U64 lastMeshId = 0;
+
for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
{
LLSpatialGroup* group = *i;
@@ -300,16 +300,37 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
continue;
}
+ bool rigged = (params.mAvatar != nullptr);
+ gHighlightProgram.bind(rigged);
+ gGL.diffuseColor4f(1, 0, 0, 1);
+
+ if (rigged)
+ {
+ if (lastAvatar != params.mAvatar ||
+ lastMeshId != params.mSkinInfo->mHash)
+ {
+ if (!uploadMatrixPalette(params))
+ {
+ continue;
+ }
+ lastAvatar = params.mAvatar;
+ lastMeshId = params.mSkinInfo->mHash;
+ }
+ }
+
LLRenderPass::applyModelMatrix(params);
if (params.mGroup)
{
params.mGroup->rebuildMesh();
}
- params.mVertexBuffer->setBufferFast(mask);
+ params.mVertexBuffer->setBufferFast(rigged ? mask | LLVertexBuffer::MAP_WEIGHT4 : mask);
params.mVertexBuffer->drawRangeFast(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
}
}
}
+
+ // make sure static version of highlight shader is bound before returning
+ gHighlightProgram.bind();
}
inline bool IsFullbright(LLDrawInfo& params)
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 8669abf284..d37e86fa5e 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -151,6 +151,7 @@ LLGLSLShader gUnderWaterProgram;
//interface shaders
LLGLSLShader gHighlightProgram;
+LLGLSLShader gSkinnedHighlightProgram;
LLGLSLShader gHighlightNormalProgram;
LLGLSLShader gHighlightSpecularProgram;
@@ -807,6 +808,7 @@ void LLViewerShaderMgr::unloadShaders()
gAvatarEyeballProgram.unload();
gAvatarPickProgram.unload();
gHighlightProgram.unload();
+ gSkinnedHighlightProgram.unload();
gHighlightNormalProgram.unload();
gHighlightSpecularProgram.unload();
@@ -3419,12 +3421,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
{
BOOL success = TRUE;
- if (mShaderLevel[SHADER_INTERFACE] == 0)
- {
- gHighlightProgram.unload();
- return TRUE;
- }
-
if (success)
{
gHighlightProgram.mName = "Highlight Shader";
@@ -3432,7 +3428,8 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER_ARB));
gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER_ARB));
gHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gHighlightProgram.createShader(NULL, NULL);
+ success = make_rigged_variant(gHighlightProgram, gSkinnedHighlightProgram);
+ success = success && gHighlightProgram.createShader(NULL, NULL);
}
if (success)