summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-07-01 17:23:59 -0700
committerGraham Linden <graham@lindenlab.com>2019-07-01 17:23:59 -0700
commit576f1cdd7e16e44c43b39618f715753160045468 (patch)
tree379be882f05a3890d9d7b813b7bd4e98ad53437f
parentf770e55ac6fb76f1ea5e24a4dd91f2a4b4131d6d (diff)
SL-11521, SL-10625
Try aligning data used for glReadPixels to see if we can coax the Intel driver stack into being a less souciant pile of detritus. Replace face color based test replaced with other logic in error.
-rw-r--r--indra/llappearance/llpolymorph.cpp4
-rw-r--r--indra/llappearance/lltexlayer.cpp26
-rw-r--r--indra/newview/llvovolume.cpp12
3 files changed, 31 insertions, 11 deletions
diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp
index 2cb4c65d7c..ce7010984a 100644
--- a/indra/llappearance/llpolymorph.cpp
+++ b/indra/llappearance/llpolymorph.cpp
@@ -816,8 +816,8 @@ void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height,
U32 s = llclamp((U32)(uvCoords.mV[VX] * (F32)(width - 1)), (U32)0, (U32)width - 1);
U32 t = llclamp((U32)(uvCoords.mV[VY] * (F32)(height - 1)), (U32)0, (U32)height - 1);
- mWeights[index] = ((F32) maskTextureData[((t * width + s) * num_components) + (num_components - 1)]) / 255.f;
-
+ mWeights[index] = maskTextureData ? ((F32) maskTextureData[((t * width + s) * num_components) + (num_components - 1)]) / 255.f : 0.0f;
+
if (invert)
{
mWeights[index] = 1.f - mWeights[index];
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 3f2fcce429..22b3364559 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -1575,14 +1575,30 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
delete [] alpha_data;
mAlphaCache.erase(iter2);
}
- alpha_data = new U8[width * height];
+
+ // GPUs tend to be very uptight about memory alignment as the DMA used to convey
+ // said data to the card works better when well-aligned so plain old default-aligned heap mem is a no-no
+ //new U8[width * height];
+ size_t mem_size = (width * height);
+ size_t rem = (mem_size & 0x3F);
+ mem_size += rem > 0 ? (mem_size + (32 - rem)) : 0;
+
+ alpha_data = (U8*)ll_aligned_malloc_32(mem_size);
+
mAlphaCache[cache_index] = alpha_data;
-
- // nSight doesn't support use of glReadPixels
- if (!LLRender::sNsightDebugSupport)
+
+ bool skip_readback = LLRender::sNsightDebugSupport; // nSight doesn't support use of glReadPixels
+ // || gGLManager.mIsIntel; SL-10625?
+
+ if (!skip_readback)
{
- glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data);
+ glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data);
}
+ else
+ {
+ ll_aligned_free_32(alpha_data);
+ alpha_data = nullptr;
+ }
}
getTexLayerSet()->getAvatarAppearance()->dirtyMesh();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 8aaf678aba..3740caa53f 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -6453,7 +6453,8 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
bool use_legacy_bump = te->getBumpmap() && (te->getBumpmap() < 18) && (!mat || mat->getNormalID().isNull());
bool opaque = te_alpha >= 0.999f;
bool transparent = te_alpha < 0.999f;
- bool invisible = te_alpha <= 0.0f;
+
+ is_alpha = (is_alpha || transparent) ? TRUE : FALSE;
if (mat && LLPipeline::sRenderDeferred && !hud_group)
{
@@ -6551,7 +6552,10 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
else if (mat)
{
U8 mode = mat->getDiffuseAlphaMode();
- if (transparent)
+
+ is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND));
+
+ if (is_alpha)
{
mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
}
@@ -6560,7 +6564,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
{
registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK);
}
- else if (is_alpha || transparent)
+ else if (is_alpha )
{
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
}
@@ -6579,7 +6583,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
else if (is_alpha)
{
// can we safely treat this as an alpha mask?
- if (invisible)
+ if (facep->getFaceColor().mV[3] <= 0.f)
{ //100% transparent, don't render unless we're highlighting transparent
registerFace(group, facep, LLRenderPass::PASS_ALPHA_INVISIBLE);
}