From b6841d75c2f259c84d5ab6b012bd2ae37d985451 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 15 Apr 2022 19:02:07 -0500 Subject: SL-17219 WIP - Texture pipeline overhaul --- indra/newview/llface.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index b328dd2962..9bf9e7503e 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2311,6 +2311,7 @@ void LLFace::resetVirtualSize() F32 LLFace::getTextureVirtualSize() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; F32 radius; F32 cos_angle_to_view_dir; BOOL in_frustum = calcPixelArea(cos_angle_to_view_dir, radius); -- cgit v1.2.3 From 6c6d9a10f830e264cf75603949b54a12256cab78 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 20 May 2022 13:31:18 -0500 Subject: SL-17287 Update Tracy to 0.8.1. Clean up GPU instrumentation. --- indra/newview/llface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index d0c26bc43b..a2d9c0ba2b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -587,7 +587,6 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords); } gGL.syncMatrices(); - LL_PROFILER_GPU_ZONEC( "gl.DrawElements", 0x00FF00 ); glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } -- cgit v1.2.3 From 39f762c2d1e8666c93689e261380cd70e0fb1749 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 Jun 2022 20:59:42 -0500 Subject: SL-17653 Make sure GLTF material associated vertex buffers have all their texture coordinates --- indra/newview/llface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index a2d9c0ba2b..562042f8bc 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1794,10 +1794,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, scalea.load3(scale.mV); LLMaterial* mat = tep->getMaterialParams().get(); + LLGLTFMaterial* gltf_mat = tep->getGLTFMaterial(); bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1); - if (mat && !do_bump) + if ((mat || gltf_mat) && !do_bump) { do_bump = mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1) || mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2); -- cgit v1.2.3 From 088ddc28a4954f8e10627deec951a51fda8cb31d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 Jun 2022 23:43:41 -0500 Subject: SL-17653 Fix writing of PBR materials to gbuffer. --- indra/newview/llface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 562042f8bc..d1ea5409ed 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2024,10 +2024,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->flush(); } - if (!mat && do_bump) + if ((!mat && !gltf_mat) && do_bump) { mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount, map_range); + mVObjp->getVolume()->genTangents(f); + for (S32 i = 0; i < num_vertices; i++) { LLVector4a tangent = vf.mTangents[i]; -- cgit v1.2.3 From c5e3ace94de01ed61ed43284ea72dacec197cdc9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 24 Jun 2022 14:15:24 -0500 Subject: SL-17274 Hook up albedo tint to pbropaqueF --- indra/newview/llface.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index d1ea5409ed..071e770811 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1384,6 +1384,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLColor4U color = tep->getColor(); + if (tep->getGLTFMaterial()) + { + color = tep->getGLTFMaterial()->mAlbedoColor; + } + if (rebuild_color) { //decide if shiny goes in alpha channel of color if (tep && -- cgit v1.2.3 From 2082443220fe344bb027c3acbf50fea0a99159c3 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Thu, 1 Sep 2022 10:58:27 -0700 Subject: SL-17967 - Git rid of ARB that is in core --- indra/newview/llface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 52aacb607c..ab5c655be0 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1674,7 +1674,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } - glBindBufferARB(GL_TRANSFORM_FEEDBACK_BUFFER, 0); + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0); gGL.popMatrix(); if (cur_shader) -- cgit v1.2.3 From 01d03edd8512580575da515401a42021577c3c57 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Thu, 1 Sep 2022 13:38:22 -0700 Subject: SL-17967 - _ARB constant removal --- indra/newview/llface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index ab5c655be0..534736e0a4 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1224,7 +1224,7 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf) mask |= LLVertexBuffer::MAP_WEIGHT4; } - LLVertexBuffer* buff = new LLVertexBuffer(mask, GL_STATIC_DRAW_ARB); + LLVertexBuffer* buff = new LLVertexBuffer(mask, GL_STATIC_DRAW); vf.mVertexBuffer = buff; buff->allocateBuffer(vf.mNumVertices, 0, true); @@ -1539,7 +1539,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, #ifdef GL_TRANSFORM_FEEDBACK_BUFFER if (use_transform_feedback && - mVertexBuffer->getUsage() == GL_DYNAMIC_COPY_ARB && + mVertexBuffer->getUsage() == GL_DYNAMIC_COPY && gTransformPositionProgram.mProgramObject && //transform shaders are loaded mVertexBuffer->useVBOs() && //target buffer is in VRAM !rebuild_weights && //TODO: add support for weights -- cgit v1.2.3 From 8ad7240a3bb626ebaabcc81fb8155a8cbb5adf39 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 8 Sep 2022 10:06:53 -0500 Subject: SL-18095 WIP -- Add Mikktspace tangent generation for PBR materials and switch to per-pixel binormal generation. Still bugged with some test content. --- indra/newview/llface.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 52aacb607c..f35b4b6d91 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2166,14 +2166,19 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount, map_range); F32* tangents = (F32*) tangent.get(); - mVObjp->getVolume()->genTangents(f); + LLGLTFMaterial* gltf_mat = tep->getGLTFMaterial(); + static LLCachedControl use_mikktspace(gSavedSettings, "RenderUseMikktSpace"); + bool mikktspace = use_mikktspace && gltf_mat != nullptr; + + mVObjp->getVolume()->genTangents(f, mikktspace); LLVector4Logical mask; mask.clear(); mask.setElement<3>(); - LLVector4a* src = vf.mTangents; - LLVector4a* end = vf.mTangents+num_vertices; + LLVector4a* tbuff = mikktspace ? vf.mMikktSpaceTangents : vf.mTangents; + LLVector4a* src = tbuff; + LLVector4a* end = tbuff+num_vertices; while (src < end) { -- cgit v1.2.3 From c822da9fe644e4a420caabb30a25b487ce75c099 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 9 Sep 2022 20:56:22 -0500 Subject: SL-18095 WIP -- Allow mikktspace generator to add more vertices (skip re-welding step for now). --- indra/newview/llface.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index f35b4b6d91..83d35b7f3c 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2177,6 +2177,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mask.setElement<3>(); LLVector4a* tbuff = mikktspace ? vf.mMikktSpaceTangents : vf.mTangents; + if (tbuff == nullptr) + { // non-mesh prims will not have mikktspace tangents + tbuff = vf.mTangents; + } + LLVector4a* src = tbuff; LLVector4a* end = tbuff+num_vertices; @@ -2184,7 +2189,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { LLVector4a tangent_out; mat_normal.rotate(*src, tangent_out); - tangent_out.normalize3fast(); + tangent_out.normalize3(); tangent_out.setSelectWithMask(mask, *src, tangent_out); tangent_out.store4a(tangents); -- cgit v1.2.3 From d7c77e5c64ddfef44b3e47f4c7ae6943ff0e860a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 12 Sep 2022 11:48:16 -0500 Subject: SL-18095 WIP -- Use meshoptimizer to re-weld and cache optimize after generating tangents --- indra/newview/llface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 83d35b7f3c..2827329739 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2189,7 +2189,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { LLVector4a tangent_out; mat_normal.rotate(*src, tangent_out); - tangent_out.normalize3(); tangent_out.setSelectWithMask(mask, *src, tangent_out); tangent_out.store4a(tangents); -- cgit v1.2.3 From 8dc59e5ef37836b15d478fb0d04e3043a9f986de Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 16 Sep 2022 16:25:26 -0500 Subject: SL-18128 Clear out much OpenGL cruft and switch to core profile on AMD --- indra/newview/llface.cpp | 200 +---------------------------------------------- 1 file changed, 1 insertion(+), 199 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 3f69815e38..5562f1d057 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1211,55 +1211,6 @@ bool LLFace::canRenderAsMask() return false; } - -//static -void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; - U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | - LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_NORMAL; - - if (vf.mWeights) - { - mask |= LLVertexBuffer::MAP_WEIGHT4; - } - - LLVertexBuffer* buff = new LLVertexBuffer(mask, GL_STATIC_DRAW); - vf.mVertexBuffer = buff; - - buff->allocateBuffer(vf.mNumVertices, 0, true); - - LLStrider f_vert; - LLStrider f_tangent; - LLStrider f_norm; - LLStrider f_tc; - - buff->getTangentStrider(f_tangent); - buff->getVertexStrider(f_vert); - buff->getNormalStrider(f_norm); - buff->getTexCoord0Strider(f_tc); - - for (U32 i = 0; i < vf.mNumVertices; ++i) - { - *f_vert++ = vf.mPositions[i]; - *f_tangent++ = vf.mTangents[i]; - *f_tc++ = vf.mTexCoords[i]; - (*f_norm++).set(vf.mNormals[i].getF32ptr()); - } - - if (vf.mWeights) - { - LLStrider f_wght; - buff->getWeight4Strider(f_wght); - for (U32 i = 0; i < vf.mNumVertices; ++i) - { - (*f_wght++).set(vf.mWeights[i].getF32ptr()); - } - } - - buff->flush(); -} - //helper function for pushing primitives for transform shaders and cleaning up //uninitialized data on the tail, plus tracking number of expected primitives void push_for_transform(LLVertexBuffer* buff, U32 source_count, U32 dest_count) @@ -1304,7 +1255,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, //don't use map range (generates many redundant unmap calls) - bool map_range = false; //gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange; + bool map_range = false; if (mVertexBuffer.notNull()) { @@ -1535,155 +1486,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } - static LLCachedControl use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback", false); - -#ifdef GL_TRANSFORM_FEEDBACK_BUFFER - if (use_transform_feedback && - mVertexBuffer->getUsage() == GL_DYNAMIC_COPY && - gTransformPositionProgram.mProgramObject && //transform shaders are loaded - mVertexBuffer->useVBOs() && //target buffer is in VRAM - !rebuild_weights && //TODO: add support for weights - !volume.isUnique()) //source volume is NOT flexi - { //use transform feedback to pack vertex buffer - - LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - transform feedback"); - LLGLEnable discard(GL_RASTERIZER_DISCARD); - LLVertexBuffer* buff = (LLVertexBuffer*) vf.mVertexBuffer.get(); - - if (vf.mVertexBuffer.isNull() || buff->getNumVerts() != vf.mNumVertices) - { - mVObjp->getVolume()->genTangents(f); - LLFace::cacheFaceInVRAM(vf); - buff = (LLVertexBuffer*) vf.mVertexBuffer.get(); - } - - LLGLSLShader* cur_shader = LLGLSLShader::sCurBoundShaderPtr; - - gGL.pushMatrix(); - gGL.loadMatrix((GLfloat*) mat_vert_in.mMatrix); - - if (rebuild_pos) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf position"); - gTransformPositionProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_VERTEX, mGeomIndex, mGeomCount); - - U8 index = mTextureIndex < FACE_DO_NOT_BATCH_TEXTURES ? mTextureIndex : 0; - - S32 val = 0; - U8* vp = (U8*) &val; - vp[0] = index; - vp[1] = 0; - vp[2] = 0; - vp[3] = 0; - - gTransformPositionProgram.uniform1i(sTextureIndexIn, val); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - - push_for_transform(buff, vf.mNumVertices, mGeomCount); - - glEndTransformFeedback(); - } - - if (rebuild_color) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf color"); - gTransformColorProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_COLOR, mGeomIndex, mGeomCount); - - S32 val = *((S32*) color.mV); - - gTransformColorProgram.uniform1i(sColorIn, val); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_emissive) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf emissive"); - gTransformColorProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_EMISSIVE, mGeomIndex, mGeomCount); - - U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255); - - S32 glow32 = glow | - (glow << 8) | - (glow << 16) | - (glow << 24); - - gTransformColorProgram.uniform1i(sColorIn, glow32); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_normal) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf normal"); - gTransformNormalProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_NORMAL, mGeomIndex, mGeomCount); - - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_NORMAL); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_tangent) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf tangent"); - gTransformTangentProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TANGENT, mGeomIndex, mGeomCount); - - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_TANGENT); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - - if (rebuild_tcoord) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf tcoord"); - gTransformTexCoordProgram.bind(); - - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD0, mGeomIndex, mGeomCount); - - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_TEXCOORD0); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - - bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1); - - if (do_bump) - { - mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD1, mGeomIndex, mGeomCount); - glBeginTransformFeedback(GL_POINTS); - buff->setBuffer(LLVertexBuffer::MAP_TEXCOORD0); - push_for_transform(buff, vf.mNumVertices, mGeomCount); - glEndTransformFeedback(); - } - } - - glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0); - gGL.popMatrix(); - - if (cur_shader) - { - cur_shader->bind(); - } - } - else -#endif { //if it's not fullbright and has no normals, bake sunlight based on face normal //bool bake_sunlight = !getTextureEntry()->getFullbright() && -- cgit v1.2.3 From 8f1d22686551f4d6783d03cd3685085ed7fcb96c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 23 Sep 2022 11:19:56 -0500 Subject: SL-18134 Rename Albedo to Base Color to be more consistent with GLTF spec --- indra/newview/llface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 5562f1d057..5de8bda787 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1336,7 +1336,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (tep->getGLTFMaterial()) { - color = tep->getGLTFMaterial()->mAlbedoColor; + color = tep->getGLTFMaterial()->mBaseColor; } if (rebuild_color) -- cgit v1.2.3 From 75de4d32768bb1359611dc7cd963c9a12f94423d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 23 Sep 2022 12:53:24 -0500 Subject: SL-18156 Cleanup of MikktSpace integration, apply MikktSpace tangents to all meshes. --- indra/newview/llface.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 5de8bda787..b24bc69791 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1968,24 +1968,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount, map_range); F32* tangents = (F32*) tangent.get(); - LLGLTFMaterial* gltf_mat = tep->getGLTFMaterial(); - static LLCachedControl use_mikktspace(gSavedSettings, "RenderUseMikktSpace"); - bool mikktspace = use_mikktspace && gltf_mat != nullptr; - - mVObjp->getVolume()->genTangents(f, mikktspace); + mVObjp->getVolume()->genTangents(f); LLVector4Logical mask; mask.clear(); mask.setElement<3>(); - LLVector4a* tbuff = mikktspace ? vf.mMikktSpaceTangents : vf.mTangents; - if (tbuff == nullptr) - { // non-mesh prims will not have mikktspace tangents - tbuff = vf.mTangents; - } - - LLVector4a* src = tbuff; - LLVector4a* end = tbuff+num_vertices; + LLVector4a* src = vf.mTangents; + LLVector4a* end = vf.mTangents +num_vertices; while (src < end) { -- cgit v1.2.3 From 9448db5d4af7bba094e5bc51f85e5c2491d3f5a1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2022 18:40:01 -0500 Subject: SL-18190 Water shader WIP. Better parallax correction for sphere probes. Reduce probe memory footprint. Remove framebuffer copies and move to deprecate stencil buffer usage. --- indra/newview/llface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index b24bc69791..431a9ebb29 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -666,7 +666,7 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram { LLGLDisable depth(wireframe_selection ? 0 : GL_BLEND); - LLGLEnable stencil(wireframe_selection ? 0 : GL_STENCIL_TEST); + //LLGLEnable stencil(wireframe_selection ? 0 : GL_STENCIL_TEST); if (!wireframe_selection) { //modify wireframe into outline selection mode -- cgit v1.2.3 From 07bca31e06e4219401f82ae04539418c65e22ea8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 10 Oct 2022 18:53:43 -0500 Subject: SL-18190 Fix alpha not playing nice with water surface by split LLDrawPoolAlpha into two passes, one above water, one below water, and clip against water plane. Currently brute forces two complete alpha passes, still need to cull against water plane and add support for fullbright shaders. --- indra/newview/llface.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 431a9ebb29..4ae8335ca7 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1342,7 +1342,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_color) { //decide if shiny goes in alpha channel of color if (tep && - getPoolType() != LLDrawPool::POOL_ALPHA) // <--- alpha channel MUST contain transparency, not shiny + !isInAlphaPool()) // <--- alpha channel MUST contain transparency, not shiny { LLMaterial* mat = tep->getMaterialParams().get(); @@ -2601,3 +2601,10 @@ U64 LLFace::getSkinHash() { return mSkinInfo ? mSkinInfo->mHash : 0; } + +bool LLFace::isInAlphaPool() const +{ + return getPoolType() == LLDrawPool::POOL_ALPHA || + getPoolType() == LLDrawPool::POOL_ALPHA_PRE_WATER || + getPoolType() == LLDrawPool::POOL_ALPHA_POST_WATER; +} -- cgit v1.2.3 From 8741c05cc10d3f39f272bb4739e7313309539d07 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 19 Oct 2022 17:23:54 -0500 Subject: SL-18105 Hook up TE override material to render pipe by way of render material. --- indra/newview/llface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 4ae8335ca7..23b56aa579 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1334,9 +1334,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLColor4U color = tep->getColor(); - if (tep->getGLTFMaterial()) + if (tep->getGLTFRenderMaterial()) { - color = tep->getGLTFMaterial()->mBaseColor; + color = tep->getGLTFRenderMaterial()->mBaseColor; } if (rebuild_color) @@ -1599,7 +1599,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, scalea.load3(scale.mV); LLMaterial* mat = tep->getMaterialParams().get(); - LLGLTFMaterial* gltf_mat = tep->getGLTFMaterial(); + LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial(); bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1); -- cgit v1.2.3 From 9e7b725c15ea0bfea5246eb81dd7a100b7ac5b6b Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 31 Oct 2022 09:42:27 -0700 Subject: SL-18485: Render GLTF materials with extension KHR_texture_transform with approprate texture transforms --- indra/newview/llface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 23b56aa579..528675072b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1601,6 +1601,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLMaterial* mat = tep->getMaterialParams().get(); LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial(); + if (gltf_mat) + { + // Transforms will be applied later + do_xform = false; + } + bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1); if ((mat || gltf_mat) && !do_bump) -- cgit v1.2.3 From 8d2ac419b22c8c9475f2efb312dd198ac8eb9fb7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 16 Nov 2022 14:49:17 -0600 Subject: SL-18154 Profile guided optimizations vs release viewer. Trim some unused abilities and remove some more fast timers. --- indra/newview/llface.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 528675072b..6557bcb81d 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2460,13 +2460,8 @@ S32 LLFace::pushVertices(const U16* index_array) const { if (mIndicesCount) { - U32 render_type = LLRender::TRIANGLES; - if (mDrawInfo) - { - render_type = mDrawInfo->mDrawMode; - } - mVertexBuffer->drawRange(render_type, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); - gPipeline.addTrianglesDrawn(mIndicesCount, render_type); + mVertexBuffer->drawRange(LLRender::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); + gPipeline.addTrianglesDrawn(mIndicesCount); } return mIndicesCount; -- cgit v1.2.3 From 78feca373ea35bfac5ae63095e354257e0d1a1ec Mon Sep 17 00:00:00 2001 From: akleshchev <117672381+akleshchev@users.noreply.github.com> Date: Tue, 29 Nov 2022 21:42:43 +0200 Subject: SL-12069 Backed out changeset: 544a91982eba (#13) Originally a fix for MAINT-4773/SL-5842 (transparent alpha being white). Reverting due to a critical flaw of the fix replacing material (sometimes server side included). And ignoring user and script input in some cases that makes scripts misbehave. Viewer should Not modify existing content of own volition. --- indra/newview/llface.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 6557bcb81d..878022a2c8 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -342,34 +342,6 @@ void LLFace::dirtyTexture() gPipeline.markTextured(drawablep); } -void LLFace::notifyAboutCreatingTexture(LLViewerTexture *texture) -{ - LLDrawable* drawablep = getDrawable(); - if(mVObjp.notNull() && mVObjp->getVolume()) - { - LLVOVolume *vobj = drawablep->getVOVolume(); - if(vobj && vobj->notifyAboutCreatingTexture(texture)) - { - gPipeline.markTextured(drawablep); - gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME); - } - } -} - -void LLFace::notifyAboutMissingAsset(LLViewerTexture *texture) -{ - LLDrawable* drawablep = getDrawable(); - if(mVObjp.notNull() && mVObjp->getVolume()) - { - LLVOVolume *vobj = drawablep->getVOVolume(); - if(vobj && vobj->notifyAboutMissingAsset(texture)) - { - gPipeline.markTextured(drawablep); - gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME); - } - } -} - void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); -- cgit v1.2.3 From 7bd9d21e19b923096ba2b5ea3cbc8be3e13d7aa0 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 19 Jan 2023 09:13:45 -0600 Subject: Optimizations, decruft, and intel compatibility pass (#53) SL-18869, SL-18772 Overhaul VBO management, restore occlusion culling, intel compatibility pass, etc --- indra/newview/llface.cpp | 215 +++++------------------------------------------ 1 file changed, 23 insertions(+), 192 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 878022a2c8..345fb81ada 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -192,7 +192,6 @@ void LLFace::destroy() if (isState(LLFace::PARTICLE)) { - LLVOPartGroup::freeVBSlot(getGeomIndex()/4); clearState(LLFace::PARTICLE); } @@ -539,6 +538,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) if (mDrawablep->isState(LLDrawable::RIGGED)) { +#if 0 // TODO -- there is no way this won't destroy our GL machine as implemented, rewrite it to not rely on software skinning LLVOVolume* volume = mDrawablep->getVOVolume(); if (volume) { @@ -562,12 +562,13 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) glDisableClientState(GL_TEXTURE_COORD_ARRAY); } } +#endif } else { // cheaters sometimes prosper... // - mVertexBuffer->setBuffer(mVertexBuffer->getTypeMask()); + mVertexBuffer->setBuffer(); mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); } @@ -654,54 +655,8 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram } } -/* removed in lieu of raycast uv detection -void LLFace::renderSelectedUV() -{ - LLViewerTexture* red_blue_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test1.j2c", TRUE, LLGLTexture::BOOST_UI); - LLViewerTexture* green_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test2.tga", TRUE, LLGLTexture::BOOST_UI); - - LLGLSUVSelect object_select; - - // use red/blue gradient to get coarse UV coordinates - renderSelected(red_blue_imagep, LLColor4::white); - - static F32 bias = 0.f; - static F32 factor = -10.f; - glPolygonOffset(factor, bias); - - // add green dither pattern on top of red/blue gradient - gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ONE); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.pushMatrix(); - // make green pattern repeat once per texel in red/blue texture - gGL.scalef(256.f, 256.f, 1.f); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - renderSelected(green_imagep, LLColor4::white); - - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); -} -*/ - void LLFace::setDrawInfo(LLDrawInfo* draw_info) { - if (draw_info) - { - if (draw_info->mFace) - { - draw_info->mFace->setDrawInfo(NULL); - } - draw_info->mFace = this; - } - - if (mDrawInfo) - { - mDrawInfo->mFace = NULL; - } - mDrawInfo = draw_info; } @@ -1225,10 +1180,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, updateRebuildFlags(); } - - //don't use map range (generates many redundant unmap calls) - bool map_range = false; - if (mVertexBuffer.notNull()) { if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices()) @@ -1355,7 +1306,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (full_rebuild) { LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - indices"); - mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount, map_range); + mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount); volatile __m128i* dst = (__m128i*) indicesp.get(); __m128i* src = (__m128i*) vf.mIndices; @@ -1378,11 +1329,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, *idx++ = vf.mIndices[i]+index_offset; } } - - if (map_range) - { - mVertexBuffer->flush(); - } } F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0; @@ -1694,11 +1640,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } } - - if (map_range) - { - mVertexBuffer->flush(); - } } else { //bump mapped or has material, just do the whole expensive loop @@ -1718,12 +1659,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, switch (ch) { case 0: - mVertexBuffer->getTexCoord0Strider(dst, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getTexCoord0Strider(dst, mGeomIndex, mGeomCount); break; case 1: if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)) { - mVertexBuffer->getTexCoord1Strider(dst, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getTexCoord1Strider(dst, mGeomIndex, mGeomCount); if (mat && !tex_anim) { r = mat->getNormalRotation(); @@ -1743,7 +1684,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, case 2: if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2)) { - mVertexBuffer->getTexCoord2Strider(dst, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getTexCoord2Strider(dst, mGeomIndex, mGeomCount); if (mat && !tex_anim) { r = mat->getSpecularRotation(); @@ -1802,14 +1743,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } - if (map_range) - { - mVertexBuffer->flush(); - } - if ((!mat && !gltf_mat) && do_bump) { - mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount); mVObjp->getVolume()->genTangents(f); @@ -1844,11 +1780,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, *tex_coords1++ = tc; } - - if (map_range) - { - mVertexBuffer->flush(); - } } } } @@ -1864,7 +1795,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, llassert(num_vertices > 0); - mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount); F32* dst = (F32*) vert.get(); @@ -1910,18 +1841,13 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, res0.store4a((F32*) dst); dst += 4; } - - if (map_range) - { - mVertexBuffer->flush(); - } } if (rebuild_normal) { LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - normal"); - mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount); F32* normals = (F32*) norm.get(); LLVector4a* src = vf.mNormals; LLVector4a* end = src+num_vertices; @@ -1933,17 +1859,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, normal.store4a(normals); normals += 4; } - - if (map_range) - { - mVertexBuffer->flush(); - } } if (rebuild_tangent) { LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tangent"); - mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount); F32* tangents = (F32*) tangent.get(); mVObjp->getVolume()->genTangents(f); @@ -1965,29 +1886,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, src++; tangents += 4; } - - if (map_range) - { - mVertexBuffer->flush(); - } } if (rebuild_weights && vf.mWeights) { LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - weight"); - mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount); F32* weights = (F32*) wght.get(); LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); - if (map_range) - { - mVertexBuffer->flush(); - } } if (rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_COLOR) ) { LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - color"); - mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount); LLVector4a src; @@ -2008,18 +1920,13 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, src.store4a(dst); dst += 4; } - - if (map_range) - { - mVertexBuffer->flush(); - } } if (rebuild_emissive) { LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - emissive"); LLStrider emissive; - mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range); + mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount); U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255); @@ -2047,11 +1954,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, src.store4a(dst); dst += 4; } - - if (map_range) - { - mVertexBuffer->flush(); - } } } @@ -2074,6 +1976,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, return TRUE; } +void LLFace::renderIndexed() +{ + if (mVertexBuffer.notNull()) + { + mVertexBuffer->setBuffer(); + mVertexBuffer->drawRange(LLRender::TRIANGLES, getGeomIndex(), getGeomIndex() + getGeomCount()-1, getIndicesCount(), getIndicesStart()); + } +} + //check if the face has a media BOOL LLFace::hasMedia() const { @@ -2405,92 +2316,12 @@ void LLFace::setViewerObject(LLViewerObject* objp) mVObjp = objp; } -const LLColor4& LLFace::getRenderColor() const -{ - if (isState(USE_FACE_COLOR)) - { - return mFaceColor; // Face Color - } - else - { - const LLTextureEntry* tep = getTextureEntry(); - return (tep ? tep->getColor() : LLColor4::white); - } -} - -void LLFace::renderSetColor() const -{ - if (!LLFacePool::LLOverrideFaceColor::sOverrideFaceColor) - { - const LLColor4* color = &(getRenderColor()); - - gGL.diffuseColor4fv(color->mV); - } -} - -S32 LLFace::pushVertices(const U16* index_array) const -{ - if (mIndicesCount) - { - mVertexBuffer->drawRange(LLRender::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); - gPipeline.addTrianglesDrawn(mIndicesCount); - } - - return mIndicesCount; -} const LLMatrix4& LLFace::getRenderMatrix() const { return mDrawablep->getRenderMatrix(); } -S32 LLFace::renderElements(const U16 *index_array) const -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE - - S32 ret = 0; - - if (isState(GLOBAL)) - { - ret = pushVertices(index_array); - } - else - { - gGL.pushMatrix(); - gGL.multMatrix((float*)getRenderMatrix().mMatrix); - ret = pushVertices(index_array); - gGL.popMatrix(); - } - - return ret; -} - -S32 LLFace::renderIndexed() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE - - if(mDrawablep == NULL || mDrawPoolp == NULL) - { - return 0; - } - - return renderIndexed(mDrawPoolp->getVertexDataMask()); -} - -S32 LLFace::renderIndexed(U32 mask) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE - - if (mVertexBuffer.isNull()) - { - return 0; - } - - mVertexBuffer->setBuffer(mask); - U16* index_array = (U16*) mVertexBuffer->getIndicesPointer(); - return renderElements(index_array); -} - //============================================================================ // From llface.inl -- cgit v1.2.3 From 6f136d403b6bbccae80661c6585f29e1caed3a7c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 1 Feb 2023 17:09:34 -0600 Subject: SL-19000 Fix various 3D UI components not respecting depth buffer. Incidental decruft. Do I get a prize for 1000th jira? --- indra/newview/llface.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 345fb81ada..811f475705 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -616,14 +616,6 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram } else { - LLGLEnable fog(GL_FOG); - glFogi(GL_FOG_MODE, GL_LINEAR); - float d = (LLViewerCamera::getInstance()->getPointOfInterest() - LLViewerCamera::getInstance()->getOrigin()).magVec(); - LLColor4 fogCol = color * fogCfx; - glFogf(GL_FOG_START, d); - glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); - glFogfv(GL_FOG_COLOR, fogCol.mV); - gGL.flush(); { gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); -- cgit v1.2.3 From 93b1da52f56293663d9bfe5272a83a77185f4cff Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 2 Feb 2023 14:35:09 -0600 Subject: SL-18908 Make media texture override base color and emissive texture on PBR materials when present. --- indra/newview/llface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 811f475705..45e7709409 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -362,7 +362,7 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) if (ch == LLRender::DIFFUSE_MAP) { - getViewerObject()->changeTEImage(mTEOffset, new_texture) ; + getViewerObject()->changeTEImage(mTEOffset, new_texture) ; } setTexture(ch, new_texture) ; -- cgit v1.2.3 From 1c2410b8af62254e96d60b2ae2e411d4756215e4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Feb 2023 19:45:31 -0600 Subject: SL-19148 Decruft followthrough -- decruft shader tree and some remaining forward rendering code. --- indra/newview/llface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 45e7709409..a74950dad2 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -47,7 +47,6 @@ #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llvopartgroup.h" -#include "llvosky.h" #include "llvovolume.h" #include "pipeline.h" #include "llviewerregion.h" -- cgit v1.2.3 From db44e06d66cfa11e55660663ea33e604b604ace3 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 1 Mar 2023 16:15:26 -0800 Subject: SL-19294: Fix Blinn-Phong texture transforms affecting GLTF materials --- indra/newview/llface.cpp | 95 ++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 40 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index a74950dad2..d05e367c12 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1524,7 +1524,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, || mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2); } - bool do_tex_mat = tex_mode && mTextureMatrix; + // For GLTF materials: Transforms will be applied later + bool do_tex_mat = tex_mode && mTextureMatrix && !gltf_mat; if (!do_bump) { //not bump mapped, might be able to do a cheap update @@ -1614,7 +1615,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, *tex_coords0++ = tc; } } - else + else if (do_xform) { for (S32 i = 0; i < num_vertices; i++) { @@ -1627,6 +1628,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, xform(tc, cos_ang, sin_ang, os, ot, ms, mt); + *tex_coords0++ = tc; + } + } + else + { + for (S32 i = 0; i < num_vertices; i++) + { + LLVector2 tc(vf.mTexCoords[i]); + LLVector4a& norm = vf.mNormals[i]; + LLVector4a& center = *(vf.mCenter); + LLVector4a vec = vf.mPositions[i]; + vec.mul(scalea); + planarProjection(tc, norm, center, vec); + *tex_coords0++ = tc; } } @@ -1694,44 +1709,44 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } - for (S32 i = 0; i < num_vertices; i++) - { - LLVector2 tc(vf.mTexCoords[i]); - - LLVector4a& norm = vf.mNormals[i]; - - LLVector4a& center = *(vf.mCenter); - - if (texgen != LLTextureEntry::TEX_GEN_DEFAULT) - { - LLVector4a vec = vf.mPositions[i]; - - vec.mul(scalea); - - if (texgen == LLTextureEntry::TEX_GEN_PLANAR) - { - planarProjection(tc, norm, center, vec); - } - } - - if (tex_mode && mTextureMatrix) - { - LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); - tmp = tmp * *mTextureMatrix; - tc.mV[0] = tmp.mV[0]; - tc.mV[1] = tmp.mV[1]; - } - else - { - xform(tc, cos_ang, sin_ang, os, ot, ms, mt); - } - - *dst++ = tc; - if (do_bump) - { - bump_tc.push_back(tc); - } - } + for (S32 i = 0; i < num_vertices; i++) + { + LLVector2 tc(vf.mTexCoords[i]); + + LLVector4a& norm = vf.mNormals[i]; + + LLVector4a& center = *(vf.mCenter); + + if (texgen != LLTextureEntry::TEX_GEN_DEFAULT) + { + LLVector4a vec = vf.mPositions[i]; + + vec.mul(scalea); + + if (texgen == LLTextureEntry::TEX_GEN_PLANAR) + { + planarProjection(tc, norm, center, vec); + } + } + + if (tex_mode && mTextureMatrix) + { + LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); + tmp = tmp * *mTextureMatrix; + tc.mV[0] = tmp.mV[0]; + tc.mV[1] = tmp.mV[1]; + } + else if (do_xform) + { + xform(tc, cos_ang, sin_ang, os, ot, ms, mt); + } + + *dst++ = tc; + if (do_bump) + { + bump_tc.push_back(tc); + } + } } if ((!mat && !gltf_mat) && do_bump) -- cgit v1.2.3 From 40e942b4910d69043b00de4cf64299ae8932f47d Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 6 Mar 2023 13:58:33 -0800 Subject: SL-19345: Fix Blinn-Phong normspec materials not having texture transforms on their normal/specular textures --- indra/newview/llface.cpp | 120 ++++++++++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 44 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index d05e367c12..87abb06285 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1322,39 +1322,75 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } + + LLMaterial* mat = tep->getMaterialParams().get(); + LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial(); + F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0; - bool do_xform = false; - if (rebuild_tcoord) - { - if (tep) - { - r = tep->getRotation(); - os = tep->mOffsetS; - ot = tep->mOffsetT; - ms = tep->mScaleS; - mt = tep->mScaleT; - cos_ang = cos(r); - sin_ang = sin(r); - - if (cos_ang != 1.f || - sin_ang != 0.f || - os != 0.f || - ot != 0.f || - ms != 1.f || - mt != 1.f) - { - do_xform = true; - } - else - { - do_xform = false; - } - } - else - { - do_xform = false; - } - } + + constexpr S32 XFORM_NONE = 0; + constexpr S32 XFORM_BLINNPHONG_COLOR = 1; + constexpr S32 XFORM_BLINNPHONG_NORMAL = 1 << 1; + constexpr S32 XFORM_BLINNPHONG_SPECULAR = 1 << 2; + + S32 xforms = XFORM_NONE; + // For GLTF, transforms will be applied later + if (rebuild_tcoord && tep && !gltf_mat) + { + r = tep->getRotation(); + os = tep->mOffsetS; + ot = tep->mOffsetT; + ms = tep->mScaleS; + mt = tep->mScaleT; + cos_ang = cos(r); + sin_ang = sin(r); + + if (cos_ang != 1.f || + sin_ang != 0.f || + os != 0.f || + ot != 0.f || + ms != 1.f || + mt != 1.f) + { + xforms |= XFORM_BLINNPHONG_COLOR; + } + if (mat) + { + F32 r_norm = 0, os_norm = 0, ot_norm = 0, ms_norm = 0, mt_norm = 0, cos_ang_norm = 0, sin_ang_norm = 0; + mat->getNormalOffset(os_norm, ot_norm); + mat->getNormalRepeat(ms_norm, mt_norm); + r_norm = mat->getNormalRotation(); + cos_ang_norm = cos(r_norm); + sin_ang_norm = sin(r_norm); + if (cos_ang_norm != 1.f || + sin_ang_norm != 0.f || + os_norm != 0.f || + ot_norm != 0.f || + ms_norm != 1.f || + mt_norm != 1.f) + { + xforms |= XFORM_BLINNPHONG_NORMAL; + } + } + if (mat) + { + F32 r_spec = 0, os_spec = 0, ot_spec = 0, ms_spec = 0, mt_spec = 0, cos_ang_spec = 0, sin_ang_spec = 0; + mat->getSpecularOffset(os_spec, ot_spec); + mat->getSpecularRepeat(ms_spec, mt_spec); + r_spec = mat->getSpecularRotation(); + cos_ang_spec = cos(r_spec); + sin_ang_spec = sin(r_spec); + if (cos_ang_spec != 1.f || + sin_ang_spec != 0.f || + os_spec != 0.f || + ot_spec != 0.f || + ms_spec != 1.f || + mt_spec != 1.f) + { + xforms |= XFORM_BLINNPHONG_SPECULAR; + } + } + } const LLMeshSkinInfo* skin = nullptr; LLMatrix4a mat_vert; @@ -1495,7 +1531,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, sin_ang = 0.f; ms = mt = 1.f; - do_xform = false; + xforms = XFORM_NONE; } if (getVirtualSize() >= MIN_TEX_ANIM_SIZE) // || isState(LLFace::RIGGED)) @@ -1507,15 +1543,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a scalea; scalea.load3(scale.mV); - LLMaterial* mat = tep->getMaterialParams().get(); - LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial(); - - if (gltf_mat) - { - // Transforms will be applied later - do_xform = false; - } - bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1); if ((mat || gltf_mat) && !do_bump) @@ -1536,7 +1563,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen"); if (!do_tex_mat) { - if (!do_xform) + if (xforms == XFORM_NONE) { LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("ggv - texgen 1"); S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; @@ -1615,7 +1642,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, *tex_coords0++ = tc; } } - else if (do_xform) + else if (xforms != XFORM_NONE) { for (S32 i = 0; i < num_vertices; i++) { @@ -1662,12 +1689,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, for (U32 ch = 0; ch < 3; ++ch) { + S32 xform_channel = XFORM_NONE; switch (ch) { case 0: + xform_channel = XFORM_BLINNPHONG_COLOR; mVertexBuffer->getTexCoord0Strider(dst, mGeomIndex, mGeomCount); break; case 1: + xform_channel = XFORM_BLINNPHONG_NORMAL; if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)) { mVertexBuffer->getTexCoord1Strider(dst, mGeomIndex, mGeomCount); @@ -1688,6 +1718,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } break; case 2: + xform_channel = XFORM_BLINNPHONG_SPECULAR; if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2)) { mVertexBuffer->getTexCoord2Strider(dst, mGeomIndex, mGeomCount); @@ -1707,6 +1738,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } break; } + const bool do_xform = (xforms & xform_channel) != XFORM_NONE; for (S32 i = 0; i < num_vertices; i++) -- cgit v1.2.3 From 25ede8638209fac8dde5b71bece4bc1dfa30ea16 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Mar 2023 10:52:35 -0600 Subject: SL-19172 Texture streaming tune up. Incidental decruft. --- indra/newview/llface.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 87abb06285..1ae13e06f5 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -357,8 +357,6 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) llassert(mTexture[ch].notNull()); - new_texture->addTextureStats(mTexture[ch]->getMaxVirtualSize()) ; - if (ch == LLRender::DIFFUSE_MAP) { getViewerObject()->changeTEImage(mTEOffset, new_texture) ; -- cgit v1.2.3 From bd4b03de8b73ecb888f8e3111bada7c643f7fcfd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Mar 2023 13:33:36 -0600 Subject: DRTVWR-559 Fix for assert in LLVertexBuffer, incidental decruft. --- indra/newview/llface.cpp | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 1ae13e06f5..d7e4632ab0 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1107,20 +1107,13 @@ bool LLFace::canRenderAsMask() (te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask getTexture()->getIsAlphaMask()) // texture actually qualifies for masking (lazily recalculated but expensive) { - if (LLPipeline::sRenderDeferred) - { - if (getViewerObject()->isHUDAttachment() || te->getFullbright()) - { //hud attachments and fullbright objects are NOT subject to the deferred rendering pipe - return LLPipeline::sAutoMaskAlphaNonDeferred; - } - else - { - return LLPipeline::sAutoMaskAlphaDeferred; - } + if (getViewerObject()->isHUDAttachment() || te->getFullbright()) + { //hud attachments and fullbright objects are NOT subject to the deferred rendering pipe + return LLPipeline::sAutoMaskAlphaNonDeferred; } else { - return LLPipeline::sAutoMaskAlphaNonDeferred; + return LLPipeline::sAutoMaskAlphaDeferred; } } @@ -1260,19 +1253,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, bool shiny_in_alpha = false; - if (LLPipeline::sRenderDeferred) - { //store shiny in alpha if we don't have a specular map - if (!mat || mat->getSpecularID().isNull()) - { - shiny_in_alpha = true; - } - } - else + //store shiny in alpha if we don't have a specular map + if (!mat || mat->getSpecularID().isNull()) { - if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) - { - shiny_in_alpha = true; - } + shiny_in_alpha = true; } if (shiny_in_alpha) -- cgit v1.2.3 From aaedacf3f3da9051f9f704eb1d050fcae63d0d3b Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 19 Apr 2023 18:15:28 -0500 Subject: DRTVWR-559 Fix for bad vertex data getting sent to PBR alpha shader (auto alpha mask regression). --- indra/newview/llface.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index d7e4632ab0..5554112043 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1081,21 +1081,27 @@ void LLFace::updateRebuildFlags() bool LLFace::canRenderAsMask() { - if (LLPipeline::sNoAlpha) + const LLTextureEntry* te = getTextureEntry(); + if( !te || !getViewerObject() || !getTexture() ) { - return true; + return false; } + if (te->getGLTFRenderMaterial()) + { + return false; + } + + if (LLPipeline::sNoAlpha) + { + return true; + } + if (isState(LLFace::RIGGED)) { // never auto alpha-mask rigged faces return false; } - const LLTextureEntry* te = getTextureEntry(); - if( !te || !getViewerObject() || !getTexture() ) - { - return false; - } LLMaterial* mat = te->getMaterialParams(); if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) -- cgit v1.2.3 From 6f5f16e0319bde183534a779839299dca7fe50ab Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 17 May 2023 13:40:33 -0500 Subject: SL-19655 Remove concept of "low priority" updates (RenderDebugGLSession assertion stomping pass). Remove a couple unused debug settings and related code. --- indra/newview/llface.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 5554112043..3c71d3e49d 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -211,7 +211,7 @@ void LLFace::destroy() if (group) { group->dirtyGeom(); - gPipeline.markRebuild(group, TRUE); + gPipeline.markRebuild(group); } } } @@ -250,7 +250,7 @@ void LLFace::setPool(LLFacePool* new_pool, LLViewerTexture *texturep) if (mDrawablep) { - gPipeline.markRebuild(mDrawablep, LLDrawable::REBUILD_ALL, TRUE); + gPipeline.markRebuild(mDrawablep, LLDrawable::REBUILD_ALL); } } mGeomIndex = 0; @@ -332,7 +332,7 @@ void LLFace::dirtyTexture() vobj->updateVisualComplexity(); } - gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME, FALSE); + gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME); } } } @@ -1174,6 +1174,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (gDebugGL) { + llassert(false); LL_WARNS() << "Index buffer overflow!" << LL_ENDL; LL_WARNS() << "Indices Count: " << mIndicesCount << " VF Num Indices: " << num_indices @@ -1189,6 +1190,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (gDebugGL) { + llassert(false); LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL; } return FALSE; -- cgit v1.2.3 From 88a4d1f5d30bd354d9e9813c2fb3bc3f140256f4 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 5 Sep 2023 16:59:27 +0200 Subject: SL-19655 Remove a couple unused debug settings and related code (update) --- indra/newview/llface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 3c71d3e49d..cec1f47a4c 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1174,7 +1174,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (gDebugGL) { - llassert(false); LL_WARNS() << "Index buffer overflow!" << LL_ENDL; LL_WARNS() << "Indices Count: " << mIndicesCount << " VF Num Indices: " << num_indices @@ -1182,6 +1181,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, << " VB Num Indices: " << mVertexBuffer->getNumIndices() << LL_ENDL; LL_WARNS() << " Face Index: " << f << " Pool Type: " << mPoolType << LL_ENDL; + llassert(false); } return FALSE; } @@ -1190,8 +1190,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (gDebugGL) { - llassert(false); LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL; + llassert(false); } return FALSE; } -- cgit v1.2.3 From f479c54fbf4a2264f705f153dd944b637eaa860a Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Sat, 2 Sep 2023 18:17:33 +0200 Subject: SEC-430 'WARNING: LLFace::getGeometryVolume: Index buffer overflow' occuring 500 times plus per minute --- indra/newview/llface.cpp | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index cec1f47a4c..c1776705f9 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1144,22 +1144,32 @@ void push_for_transform(LLVertexBuffer* buff, U32 source_count, U32 dest_count) } BOOL LLFace::getGeometryVolume(const LLVolume& volume, - const S32 &f, - const LLMatrix4& mat_vert_in, const LLMatrix3& mat_norm_in, - const U16 &index_offset, - bool force_rebuild) + S32 face_index, + const LLMatrix4& mat_vert_in, + const LLMatrix3& mat_norm_in, + U16 index_offset, + bool force_rebuild, + bool no_debug_assert) { LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; llassert(verify()); - if (volume.getNumVolumeFaces() <= f) { - LL_WARNS() << "Attempt get volume face out of range! Total Faces: " << volume.getNumVolumeFaces() << " Attempt get access to: " << f << LL_ENDL; - return FALSE; - } + if (face_index < 0 || face_index >= volume.getNumVolumeFaces()) + { + if (gDebugGL) + { + LL_WARNS() << "Face index is out of bounds!" << LL_ENDL; + LL_WARNS() << "Attempt get volume face out of range!" + " Total Faces: " << volume.getNumVolumeFaces() << + " Attempt get access to: " << face_index << LL_ENDL; + llassert(no_debug_assert); + } + return FALSE; + } bool rigged = isState(RIGGED); - const LLVolumeFace &vf = volume.getVolumeFace(f); + const LLVolumeFace &vf = volume.getVolumeFace(face_index); S32 num_vertices = (S32)vf.mNumVertices; S32 num_indices = (S32) vf.mNumIndices; @@ -1174,14 +1184,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (gDebugGL) { - LL_WARNS() << "Index buffer overflow!" << LL_ENDL; + LL_WARNS() << "Index buffer overflow!" << LL_ENDL; LL_WARNS() << "Indices Count: " << mIndicesCount << " VF Num Indices: " << num_indices << " Indices Index: " << mIndicesIndex << " VB Num Indices: " << mVertexBuffer->getNumIndices() << LL_ENDL; - LL_WARNS() << " Face Index: " << f + LL_WARNS() << " Face Index: " << face_index << " Pool Type: " << mPoolType << LL_ENDL; - llassert(false); + llassert(no_debug_assert); } return FALSE; } @@ -1191,7 +1201,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (gDebugGL) { LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL; - llassert(false); + llassert(no_debug_assert); } return FALSE; } @@ -1228,7 +1238,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, bool rebuild_tangent = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TANGENT); bool rebuild_weights = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_WEIGHT4); - const LLTextureEntry *tep = mVObjp->getTE(f); + const LLTextureEntry *tep = mVObjp->getTE(face_index); const U8 bump_code = tep ? tep->getBumpmap() : 0; BOOL is_static = mDrawablep->isStatic(); @@ -1443,7 +1453,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (bump_code) { - mVObjp->getVolume()->genTangents(f); + mVObjp->getVolume()->genTangents(face_index); F32 offset_multiple; switch( bump_code ) { @@ -1492,7 +1502,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, U8 texgen = getTextureEntry()->getTexGen(); if (rebuild_tcoord && texgen != LLTextureEntry::TEX_GEN_DEFAULT) { //planar texgen needs binormals - mVObjp->getVolume()->genTangents(f); + mVObjp->getVolume()->genTangents(face_index); } U8 tex_mode = 0; @@ -1775,7 +1785,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount); - mVObjp->getVolume()->genTangents(f); + mVObjp->getVolume()->genTangents(face_index); for (S32 i = 0; i < num_vertices; i++) { @@ -1895,7 +1905,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount); F32* tangents = (F32*) tangent.get(); - mVObjp->getVolume()->genTangents(f); + mVObjp->getVolume()->genTangents(face_index); LLVector4Logical mask; mask.clear(); -- cgit v1.2.3