diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 35 | ||||
| -rw-r--r-- | indra/newview/lltoolmorph.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llviewerjointmesh.cpp | 103 | ||||
| -rw-r--r-- | indra/newview/llviewerjointmesh.h | 5 | ||||
| -rw-r--r-- | indra/newview/llviewershadermgr.cpp | 39 | ||||
| -rw-r--r-- | indra/newview/llviewershadermgr.h | 1 |
6 files changed, 32 insertions, 153 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index f0f589e7f4..61f0e3e365 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -595,7 +595,15 @@ void LLDrawPoolAvatar::beginSkinned() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - // used for preview only + // Used for preview only, like LLVisualParamHint + // Uses deprecated logic!!! + if (!gAvatarProgram.isComplete()) + { + llassert(false); // Avatar shader shouldn't have failed if deferred shader loaded + sVertexProgram = nullptr; + LLGLSLShader::unbind(); + return; + } sVertexProgram = &gAvatarProgram; @@ -609,25 +617,18 @@ void LLDrawPoolAvatar::endSkinned() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done - if (sShaderLevel > 0) - { - sRenderingSkinned = false; - sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP); - gGL.getTexUnit(0)->activate(); - sVertexProgram->unbind(); - sShaderLevel = mShaderLevel; - } - else + if (sVertexProgram == nullptr) { - if(gPipeline.shadersLoaded()) - { - // software skinning, use a basic shader for windlight. - // TODO: find a better fallback method for software skinning. - sVertexProgram->unbind(); - } + return; } + // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done + sRenderingSkinned = false; + sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP); + gGL.getTexUnit(0)->activate(); + sVertexProgram->unbind(); + sShaderLevel = mShaderLevel; + gGL.getTexUnit(0)->activate(); } diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 5312ca752f..d2b32f8e23 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -143,6 +143,8 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis bool LLVisualParamHint::needsRender() { + // needsRender gets called once per frame from + // LLViewerDynamicTexture::updateAllInstances() return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->getIsAppearanceAnimating() && mAllowsUpdates; } diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 3306042826..42aed5906b 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -96,7 +96,6 @@ const S32 NUM_AXES = 3; // pivot parent 0-n -- child = n+1 static LLMatrix4 gJointMatUnaligned[LL_CHARACTER_MAX_JOINTS_PER_MESH]; -static LLMatrix4a gJointMatAligned[LL_CHARACTER_MAX_JOINTS_PER_MESH]; static LLMatrix3 gJointRotUnaligned[LL_CHARACTER_MAX_JOINTS_PER_MESH]; static LLVector4 gJointPivot[LL_CHARACTER_MAX_JOINTS_PER_MESH]; @@ -107,8 +106,6 @@ void LLViewerJointMesh::uploadJointMatrices() { S32 joint_num; LLPolyMesh *reference_mesh = mMesh->getReferenceMesh(); - LLDrawPool *poolp = mFace ? mFace->getPool() : NULL; - bool hardware_skinning = (poolp && poolp->getShaderLevel() > 0); //calculate joint matrices size_t num_joints = llmin(reference_mesh->mJointRenderData.size(), LL_CHARACTER_MAX_JOINTS_PER_MESH); @@ -116,10 +113,7 @@ void LLViewerJointMesh::uploadJointMatrices() { LLMatrix4 joint_mat = *reference_mesh->mJointRenderData[joint_num]->mWorldMatrix; - if (hardware_skinning) - { - joint_mat *= LLDrawPoolAvatar::getModelView(); - } + joint_mat *= LLDrawPoolAvatar::getModelView(); gJointMatUnaligned[joint_num] = joint_mat; gJointRotUnaligned[joint_num] = joint_mat.getMat3(); } @@ -171,8 +165,6 @@ void LLViewerJointMesh::uploadJointMatrices() } // upload matrices - if (hardware_skinning) - { GLfloat mat[45*4]; memset(mat, 0, sizeof(GLfloat)*45*4); @@ -193,15 +185,6 @@ void LLViewerJointMesh::uploadJointMatrices() LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLViewerShaderMgr::AVATAR_MATRIX, 45, mat); } stop_glerror(); - } - else - { - //load gJointMatUnaligned into gJointMatAligned - for (joint_num = 0; joint_num < num_joints; ++joint_num) - { - gJointMatAligned[joint_num].loadu(gJointMatUnaligned[joint_num]); - } - } } //-------------------------------------------------------------------- @@ -302,13 +285,9 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, bool first_pass, bool is_dummy) if (mMesh->hasWeights()) { - LLDrawPool* poolp = mFace->getPool(); - if (poolp && (poolp->getShaderLevel() > 0)) + if (first_pass) { - if (first_pass) - { - uploadJointMatrices(); - } + uploadJointMatrices(); } buff->setBuffer(); @@ -368,15 +347,6 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, bool damp_w return; } - LLDrawPool *poolp = mFace->getPool(); - bool hardware_skinning = (poolp && poolp->getShaderLevel() > 0); - - if (!hardware_skinning && terse_update) - { //no need to do terse updates if we're doing software vertex skinning - // since mMesh is being copied into mVertexBuffer every frame - return; - } - LL_PROFILE_ZONE_SCOPED; LLStrider<LLVector3> verticesp; @@ -460,75 +430,8 @@ bool LLViewerJointMesh::updateLOD(F32 pixel_area, bool activate) return (valid != activate); } -// static -void LLViewerJointMesh::updateGeometry(LLFace *mFace, LLPolyMesh *mMesh) -{ - LLStrider<LLVector3> o_vertices; - LLStrider<LLVector3> o_normals; - - //get vertex and normal striders - LLVertexBuffer* buffer = mFace->getVertexBuffer(); - buffer->getVertexStrider(o_vertices, 0); - buffer->getNormalStrider(o_normals, 0); - - F32* __restrict vert = o_vertices[0].mV; - F32* __restrict norm = o_normals[0].mV; - - const F32* __restrict weights = mMesh->getWeights(); - const LLVector4a* __restrict coords = (LLVector4a*) mMesh->getCoords(); - const LLVector4a* __restrict normals = (LLVector4a*) mMesh->getNormals(); - - U32 offset = mMesh->mFaceVertexOffset*4; - vert += offset; - norm += offset; - - for (U32 index = 0; index < mMesh->getNumVertices(); index++) - { - // equivalent to joint = floorf(weights[index]); - S32 joint = _mm_cvtt_ss2si(_mm_load_ss(weights+index)); - F32 w = weights[index] - joint; - - LLMatrix4a gBlendMat; - - if (w != 0.f) - { - // blend between matrices and apply - gBlendMat.setLerp(gJointMatAligned[joint+0], - gJointMatAligned[joint+1], w); - - LLVector4a res; - gBlendMat.affineTransform(coords[index], res); - res.store4a(vert+index*4); - gBlendMat.rotate(normals[index], res); - res.store4a(norm+index*4); - } - else - { // No lerp required in this case. - LLVector4a res; - gJointMatAligned[joint].affineTransform(coords[index], res); - res.store4a(vert+index*4); - gJointMatAligned[joint].rotate(normals[index], res); - res.store4a(norm+index*4); - } - } - - buffer->unmapBuffer(); -} - void LLViewerJointMesh::updateJointGeometry() { - if (!(mValid - && mMesh - && mFace - && mMesh->hasWeights() - && mFace->getVertexBuffer() - && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) == 0)) - { - return; - } - - uploadJointMatrices(); - updateGeometry(mFace, mMesh); } void LLViewerJointMesh::dump() diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index cfe8ecdb67..1365c1ee48 100644 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -67,11 +67,6 @@ public: void dump() override; bool isAnimatable() const override { return false; } - -private: - - //copy mesh into given face's vertex buffer, applying current animation pose - static void updateGeometry(LLFace* face, LLPolyMesh* mesh); }; #endif // LL_LLVIEWERJOINTMESH_H diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 27865f7598..6bbea54e43 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -128,7 +128,6 @@ LLGLSLShader gPathfindingNoNormalsProgram; //avatar shader handles LLGLSLShader gAvatarProgram; -LLGLSLShader gAvatarEyeballProgram; LLGLSLShader gImpostorProgram; // Effects Shaders @@ -413,7 +412,6 @@ void LLViewerShaderMgr::finalizeShaderList() //ONLY shaders that need WL Param management should be added here mShaderList.push_back(&gAvatarProgram); mShaderList.push_back(&gWaterProgram); - mShaderList.push_back(&gAvatarEyeballProgram); mShaderList.push_back(&gImpostorProgram); mShaderList.push_back(&gObjectBumpProgram); mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram); @@ -699,7 +697,7 @@ void LLViewerShaderMgr::setShaders() if (loadShadersObject()) { //hardware skinning is enabled and rigged attachment shaders loaded correctly // cloth is a class3 shader - S32 avatar_class = 1; + constexpr S32 avatar_class = 1; // Set the actual level mShaderLevel[SHADER_AVATAR] = avatar_class; @@ -708,8 +706,11 @@ void LLViewerShaderMgr::setShaders() llassert(loaded); } else - { //hardware skinning not possible, neither is deferred rendering - llassert(false); // SHOULD NOT BE POSSIBLE + { + // SHOULD NOT BE POSSIBLE + // Hardware skinning not possible, neither is deferred rendering + // but both are a hard requirement, viewer will crash without them + LL_ERRS() << "Failed to load object shaders, cannot continue." << LL_ENDL; } } @@ -3104,14 +3105,6 @@ bool LLViewerShaderMgr::loadShadersAvatar() LL_PROFILE_ZONE_SCOPED; #if 1 // DEPRECATED -- forward rendering is deprecated bool success = true; - - if (mShaderLevel[SHADER_AVATAR] == 0) - { - gAvatarProgram.unload(); - gAvatarEyeballProgram.unload(); - return true; - } - if (success) { gAvatarProgram.mName = "Avatar Shader"; @@ -3135,27 +3128,13 @@ bool LLViewerShaderMgr::loadShadersAvatar() } } - if (success) - { - gAvatarEyeballProgram.mName = "Avatar Eyeball Program"; - gAvatarEyeballProgram.mFeatures.calculatesLighting = true; - gAvatarEyeballProgram.mFeatures.isSpecular = true; - gAvatarEyeballProgram.mFeatures.calculatesAtmospherics = true; - gAvatarEyeballProgram.mFeatures.hasGamma = true; - gAvatarEyeballProgram.mFeatures.hasAtmospherics = true; - gAvatarEyeballProgram.mFeatures.hasLighting = true; - gAvatarEyeballProgram.mFeatures.hasAlphaMask = true; - gAvatarEyeballProgram.mShaderFiles.clear(); - gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballV.glsl", GL_VERTEX_SHADER)); - gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballF.glsl", GL_FRAGMENT_SHADER)); - gAvatarEyeballProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR]; - success = gAvatarEyeballProgram.createShader(); - } - if( !success ) { + // This isn't supposed to fail, otherwise defferred shaders would have failed. + // Is only used for avatar previews (like LLVisualParamHint) mShaderLevel[SHADER_AVATAR] = 0; mMaxAvatarShaderLevel = 0; + LL_WARNS() << "Failed to create avatar shader!" << LL_ENDL; return false; } #endif diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 46da30017d..3efd23ad79 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -208,7 +208,6 @@ extern LLGLSLShader gPathfindingNoNormalsProgram; // avatar shader handles extern LLGLSLShader gAvatarProgram; -extern LLGLSLShader gAvatarEyeballProgram; extern LLGLSLShader gImpostorProgram; // Post Process Shaders |
