diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 75c584daab0d956b45eca25b27a737a23db5a2af..eea768a3eaeb94f46e56be58f29f46abff6e4662 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -695,7 +695,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } text[count++] = strdup("\t}\n"); - text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); + text[count++] = strdup("\treturn vec4(1,0,1,1);\n"); text[count++] = strdup("}\n"); } else @@ -718,7 +718,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup(if_str.c_str()); } - text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); + text[count++] = strdup("\treturn vec4(1,0,1,1);\n"); text[count++] = strdup("}\n"); } } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index b426421f88e72e46b4f28c581ec589967012c2d1..3948145580b7b39c33af0f2a45b394b8e51984fc 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -511,6 +511,25 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of llerrs << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << llendl; } } + + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + if (shader && shader->mFeatures.mIndexedTextureChannels > 1) + { + LLStrider<LLVector4a> v; + //hack to get non-const reference + LLVertexBuffer* vb = (LLVertexBuffer*) this; + vb->getVertexStrider(v); + + for (U32 i = start; i < end; i++) + { + S32 idx = (S32) (v[i][3]+0.25f); + if (idx < 0 || idx >= shader->mFeatures.mIndexedTextureChannels) + { + llerrs << "Bad texture index found in vertex data stream." << llendl; + } + } + } } } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index eab3dcfaddb7ba46d34de82cab4811056690b1c3..6dbeae6677fd646e760014d3a5f6574a8c380c03 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1658,6 +1658,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, while(dst < end); F32 index = (F32) (mTextureIndex < 255 ? mTextureIndex : 0); + + llassert(index <= LLGLSLShader::sIndexedTextureChannels-1); F32 *index_dst = (F32*) vertices; F32 *index_end = (F32*) end; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 827c5b9cb58cff17403240ef062414380847211f..baab191cb6c8ffd0a46827171e21b301836f7ca9 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4652,7 +4652,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: buffer_index = -1; } - S32 texture_index_channels = gGLManager.mNumTextureImageUnits-1; //always reserve one for shiny for now just for simplicity + S32 texture_index_channels = LLGLSLShader::sIndexedTextureChannels-1; //always reserve one for shiny for now just for simplicity if (gGLManager.mGLVersion < 3.1f) {