diff options
author | Callum Prentice <callum@lindenlab.com> | 2022-08-15 13:48:57 -0700 |
---|---|---|
committer | Callum Prentice <callum@lindenlab.com> | 2022-08-15 13:48:57 -0700 |
commit | aea4ba7ab78d931a5056735893103f125a293cc2 (patch) | |
tree | 6eeee74a88ea796e12e244765582ca12429e2e70 /indra | |
parent | e7f562e6d8912573c255c8a6621c4f57d7df4b5c (diff) | |
parent | 90bdeddb8f62560e0982e7e4c9917f1a62c7d88f (diff) |
Merge branch 'DRTVWR-559' of https://bitbucket.org/lindenlab/viewer into DRTVWR-559
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/materialV.glsl | 2 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl | 7 | ||||
-rw-r--r-- | indra/newview/lldrawpoolpbropaque.cpp | 132 | ||||
-rw-r--r-- | indra/newview/lldrawpoolpbropaque.h | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 2 |
5 files changed, 77 insertions, 68 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl index 7e29ada205..a1cab87092 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl @@ -1,5 +1,5 @@ /** - * @file bumpV.glsl + * @file materialV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl index 82338069a8..a2606ed771 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl @@ -78,24 +78,23 @@ VARYING vec2 vary_texcoord0; void main() { - vec4 pos4 = vec4(position,1.0); #ifdef HAS_SKIN mat4 mat = getObjectSkinnedTransform(); mat = modelview_matrix * mat; - vec3 pos = (mat*pos4).xyz; + vec3 pos = (mat*vec4(position.xyz,1.0)).xyz; #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) vary_position = pos; #endif - gl_Position = projection_matrix*pos4; + gl_Position = projection_matrix*vec4(pos,1.0); #else //transform vertex + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_Position = modelview_projection_matrix * pos4; #endif vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index 59ec2544dd..3930e11cf3 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -54,18 +54,6 @@ void LLDrawPoolPBROpaque::render(S32 pass) { } -// Deferred -void LLDrawPoolPBROpaque::beginDeferredPass(S32 pass) -{ - gDeferredPBROpaqueProgram.bind(); -} - -void LLDrawPoolPBROpaque::endDeferredPass(S32 pass) -{ - gDeferredPBROpaqueProgram.unbind(); - LLRenderPass::endRenderPass(pass); -} - void LLDrawPoolPBROpaque::renderDeferred(S32 pass) { if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_MATERIALS)) @@ -84,63 +72,87 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass) LLGLDisable blend(GL_BLEND); LLGLDisable alpha_test(GL_ALPHA_TEST); - // TODO: handle HUDs? - //if (LLPipeline::sRenderingHUDs) - // mShader->uniform1i(LLShaderMgr::NO_ATMO, 1); - //else - // mShader->uniform1i(LLShaderMgr::NO_ATMO, 0); + LLVOAvatar* lastAvatar = nullptr; + U64 lastMeshId = 0; - // TODO: handle under water? - // if (LLPipeline::sUnderWaterRender) - LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); - LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); - - for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) + for (int i = 0; i < 2; ++i) { - LLDrawInfo& params = **i; - - //gGL.getTexUnit(0)->activate(); + bool rigged = (i == 1); + LLGLSLShader* shader = &gDeferredPBROpaqueProgram; + U32 vertex_data_mask = getVertexDataMask(); - if (params.mTexture.notNull()) + if (rigged) { - gGL.getTexUnit(0)->bindFast(params.mTexture); // diffuse - } - else - { - gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sWhiteImagep); + shader = shader->mRiggedVariant; + vertex_data_mask |= LLVertexBuffer::MAP_WEIGHT4; } - if (params.mNormalMap) - { - gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); - } - else - { - gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); - } + shader->bind(); - if (params.mSpecularMap) - { - gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); // PBR linear packed Occlusion, Roughness, Metal. - } - else - { - gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); - } + LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type+i); + LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type+i); - if (params.mEmissiveMap) - { - gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::EMISSIVE_MAP, params.mEmissiveMap); // PBR sRGB Emissive - } - else + for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { - gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::EMISSIVE_MAP, LLViewerFetchedTexture::sWhiteImagep); + LLDrawInfo* pparams = *i; + + if (pparams->mTexture.notNull()) + { + gGL.getTexUnit(0)->bindFast(pparams->mTexture); // diffuse + } + else + { + gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sWhiteImagep); + } + + if (pparams->mNormalMap) + { + shader->bindTexture(LLShaderMgr::BUMP_MAP, pparams->mNormalMap); + } + else + { + shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); + } + + if (pparams->mSpecularMap) + { + shader->bindTexture(LLShaderMgr::SPECULAR_MAP, pparams->mSpecularMap); // PBR linear packed Occlusion, Roughness, Metal. + } + else + { + shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); + } + + if (pparams->mEmissiveMap) + { + shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, pparams->mEmissiveMap); // PBR sRGB Emissive + } + else + { + shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, LLViewerFetchedTexture::sWhiteImagep); + } + + shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, pparams->mGLTFMaterial->mRoughnessFactor); + shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, pparams->mGLTFMaterial->mMetallicFactor); + shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, pparams->mGLTFMaterial->mEmissiveColor.mV); + + if (rigged) + { + if (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)) + { + uploadMatrixPalette(*pparams); + lastAvatar = pparams->mAvatar; + lastMeshId = pparams->mSkinInfo->mHash; + } + + pushBatch(*pparams, vertex_data_mask, FALSE, FALSE); + } + else + { + pushBatch(*pparams, vertex_data_mask, FALSE, FALSE); + } } - - gDeferredPBROpaqueProgram.uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, params.mGLTFMaterial->mRoughnessFactor); - gDeferredPBROpaqueProgram.uniform1f(LLShaderMgr::METALLIC_FACTOR, params.mGLTFMaterial->mMetallicFactor); - gDeferredPBROpaqueProgram.uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, params.mGLTFMaterial->mEmissiveColor.mV); - - LLRenderPass::pushBatch(params, getVertexDataMask(), FALSE, FALSE); } + + LLGLSLShader::sCurBoundShaderPtr->unbind(); } diff --git a/indra/newview/lldrawpoolpbropaque.h b/indra/newview/lldrawpoolpbropaque.h index 478d4e1bd4..c355b10b12 100644 --- a/indra/newview/lldrawpoolpbropaque.h +++ b/indra/newview/lldrawpoolpbropaque.h @@ -49,8 +49,6 @@ public: LLDrawPoolPBROpaque(); /*virtual*/ S32 getNumDeferredPasses() { return 1; } - /*virtual*/ void beginDeferredPass(S32 pass); - /*virtual*/ void endDeferredPass(S32 pass); /*virtual*/ void renderDeferred(S32 pass); // Non ALM isn't supported diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 24296363a9..9161b43159 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -10264,7 +10264,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLPipeline::RENDER_TYPE_PASS_NORMSPEC_MASK_RIGGED, LLPipeline::RENDER_TYPE_PASS_NORMSPEC_EMISSIVE_RIGGED, LLPipeline::RENDER_TYPE_PASS_PBR_OPAQUE, - //LLRenderPass::PASS_PBR_OPAQUE_RIGGED, + LLPipeline::RENDER_TYPE_PASS_PBR_OPAQUE_RIGGED, END_RENDER_TYPES); gGL.setColorMask(false, false); |