diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl | 20 | ||||
-rw-r--r-- | indra/newview/lldrawpool.cpp | 4 | ||||
-rw-r--r-- | indra/newview/lldrawpool.h | 18 | ||||
-rw-r--r-- | indra/newview/lldrawpoolpbropaque.cpp | 48 | ||||
-rw-r--r-- | indra/newview/lldrawpoolpbropaque.h | 19 | ||||
-rw-r--r-- | indra/newview/llfetchedgltfmaterial.cpp | 65 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 4 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 16 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 5 |
9 files changed, 79 insertions, 120 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index 9b8df0a5a4..32e9714a75 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -43,29 +43,11 @@ void main() { float alpha = diffuseLookup(vary_texcoord0.xy).a; - // mask cutoff 0 -> no shadow SL-11051 - if (minimum_alpha == 0) + if (alpha < minimum_alpha) { discard; } -#if !defined(IS_FULLBRIGHT) - alpha *= vertex_color.a; -#endif - - if (alpha < 0.05) // treat as totally transparent - { - discard; - } - - if (alpha < 0.88) // treat as semi-transparent - { - if (fract(0.5*floor(target_pos_x / post_pos.w )) < 0.25) - { - discard; - } - } - frag_color = vec4(1,1,1,1); #if !defined(DEPTH_CLAMP) diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 7305177e4a..bfcc24fd13 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -121,8 +121,8 @@ LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0) case POOL_WL_SKY: poolp = new LLDrawPoolWLSky(); break; - case POOL_PBR_OPAQUE: - poolp = new LLDrawPoolPBROpaque(); + case POOL_GLTF_PBR: + poolp = new LLDrawPoolGLTFPBR(); break; default: LL_ERRS() << "Unknown draw pool type!" << LL_ENDL; diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 620438bb1b..cc5d2ddb26 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -60,6 +60,7 @@ public: POOL_TERRAIN, POOL_MATERIALS, POOL_GRASS, + POOL_GLTF_PBR, POOL_TREE, POOL_ALPHA_MASK, POOL_FULLBRIGHT_ALPHA_MASK, @@ -73,7 +74,6 @@ public: POOL_VOIDWATER, POOL_WATER, POOL_ALPHA_POST_WATER, - POOL_PBR_OPAQUE, POOL_ALPHA, // note there is no actual "POOL_ALPHA" but pre-water and post-water pools consume POOL_ALPHA faces NUM_POOL_TYPES, // * invisiprims work by rendering to the depth buffer but not the color buffer, occluding anything rendered after them @@ -114,8 +114,8 @@ public: virtual S32 getNumShadowPasses(); virtual void renderShadow(S32 pass = 0); - virtual void render(S32 pass = 0) = 0; - virtual void prerender() = 0; + virtual void render(S32 pass = 0) {}; + virtual void prerender() {}; virtual U32 getVertexDataMask() = 0; virtual BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct! virtual S32 getShaderLevel() const { return mShaderLevel; } @@ -199,8 +199,8 @@ public: PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, PASS_ALPHA_INVISIBLE, PASS_ALPHA_INVISIBLE_RIGGED, - PASS_PBR_OPAQUE, - PASS_PBR_OPAQUE_RIGGED, + PASS_GLTF_PBR, + PASS_GLTF_PBR_RIGGED, NUM_RENDER_TYPES, }; @@ -327,10 +327,10 @@ public: return "PASS_ALPHA_INVISIBLE"; case PASS_ALPHA_INVISIBLE_RIGGED: return "PASS_ALPHA_INVISIBLE_RIGGED"; - case PASS_PBR_OPAQUE: - return "PASS_PBR_OPAQUE"; - case PASS_PBR_OPAQUE_RIGGED: - return "PASS_PBR_OPAQUE_RIGGED"; + case PASS_GLTF_PBR: + return "PASS_GLTF_PBR"; + case PASS_GLTF_PBR_RIGGED: + return "PASS_GLTF_PBR_RIGGED"; default: return "Unknown pass"; diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index 2f710e570b..d0c588b65a 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -1,6 +1,6 @@ /** * @file lldrawpoolpbropaque.cpp - * @brief LLDrawPoolPBROpaque class implementation + * @brief LLDrawPoolGLTFPBR class implementation * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code @@ -31,54 +31,24 @@ #include "llviewershadermgr.h" #include "pipeline.h" -LLDrawPoolPBROpaque::LLDrawPoolPBROpaque() : - LLRenderPass(POOL_PBR_OPAQUE) +LLDrawPoolGLTFPBR::LLDrawPoolGLTFPBR() : + LLRenderPass(POOL_GLTF_PBR) { } -void LLDrawPoolPBROpaque::prerender() +void LLDrawPoolGLTFPBR::renderDeferred(S32 pass) { - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - -// Forward -void LLDrawPoolPBROpaque::beginRenderPass(S32 pass) -{ -} - -void LLDrawPoolPBROpaque::endRenderPass( S32 pass ) -{ -} - -void LLDrawPoolPBROpaque::render(S32 pass) -{ -} - -void LLDrawPoolPBROpaque::renderDeferred(S32 pass) -{ - if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_MATERIALS)) - { - return; - } - - const U32 type = LLPipeline::RENDER_TYPE_PASS_PBR_OPAQUE; - if (!gPipeline.hasRenderType(type)) - { - return; - } + const U32 type = LLPipeline::RENDER_TYPE_PASS_GLTF_PBR; gGL.flush(); - LLGLDisable blend(GL_BLEND); - LLGLDisable alpha_test(GL_ALPHA_TEST); - LLVOAvatar* lastAvatar = nullptr; U64 lastMeshId = 0; for (int i = 0; i < 2; ++i) { bool rigged = (i == 1); - LLGLSLShader* shader = &gDeferredPBROpaqueProgram; + LLGLSLShader* shader = LLPipeline::sShadowRender ? &gDeferredShadowAlphaMaskProgram : &gDeferredPBROpaqueProgram; U32 vertex_data_mask = getVertexDataMask(); if (rigged) @@ -138,3 +108,9 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass) LLGLSLShader::sCurBoundShaderPtr->unbind(); } + +void LLDrawPoolGLTFPBR::renderShadow(S32 pass) +{ + renderDeferred(pass); +} + diff --git a/indra/newview/lldrawpoolpbropaque.h b/indra/newview/lldrawpoolpbropaque.h index c355b10b12..3d80a0657e 100644 --- a/indra/newview/lldrawpoolpbropaque.h +++ b/indra/newview/lldrawpoolpbropaque.h @@ -29,7 +29,7 @@ #include "lldrawpool.h" -class LLDrawPoolPBROpaque : public LLRenderPass +class LLDrawPoolGLTFPBR final : public LLRenderPass { public: enum @@ -44,20 +44,17 @@ public: | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_COLOR }; - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } + U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } - LLDrawPoolPBROpaque(); + LLDrawPoolGLTFPBR(); - /*virtual*/ S32 getNumDeferredPasses() { return 1; } - /*virtual*/ void renderDeferred(S32 pass); + S32 getNumDeferredPasses() override { return 1; } + void renderDeferred(S32 pass) override; - // Non ALM isn't supported - /*virtual*/ void beginRenderPass(S32 pass); - /*virtual*/ void endRenderPass(S32 pass); - /*virtual*/ S32 getNumPasses() { return 0; } - /*virtual*/ void render(S32 pass = 0); - /*virtual*/ void prerender(); + S32 getNumShadowPasses() override { return 1; } + void renderShadow(S32 pass) override; + }; #endif // LL_LLDRAWPOOLPBROPAQUE_H diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 2d3015635c..22be8a03dd 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -30,6 +30,7 @@ #include "llviewertexturelist.h" #include "llavatarappearancedefines.h" #include "llshadermgr.h" +#include "pipeline.h" LLFetchedGLTFMaterial::LLFetchedGLTFMaterial() : LLGLTFMaterial() @@ -66,38 +67,40 @@ void LLFetchedGLTFMaterial::bind(LLGLSLShader* shader) gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sWhiteImagep); } - - if (mNormalTexture.notNull()) - { - shader->bindTexture(LLShaderMgr::BUMP_MAP, mNormalTexture); - } - else - { - shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); - } - - if (mMetallicRoughnessTexture.notNull()) - { - shader->bindTexture(LLShaderMgr::SPECULAR_MAP, mMetallicRoughnessTexture); // PBR linear packed Occlusion, Roughness, Metal. - } - else + if (!LLPipeline::sShadowRender) { - shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); + if (mNormalTexture.notNull()) + { + shader->bindTexture(LLShaderMgr::BUMP_MAP, mNormalTexture); + } + else + { + shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); + } + + if (mMetallicRoughnessTexture.notNull()) + { + shader->bindTexture(LLShaderMgr::SPECULAR_MAP, mMetallicRoughnessTexture); // PBR linear packed Occlusion, Roughness, Metal. + } + else + { + shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); + } + + if (mEmissiveTexture.notNull()) + { + shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, mEmissiveTexture); // PBR sRGB Emissive + } + else + { + shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, LLViewerFetchedTexture::sWhiteImagep); + } + + // NOTE: base color factor is baked into vertex stream + + shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, mRoughnessFactor); + shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, mMetallicFactor); + shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, mEmissiveColor.mV); } - if (mEmissiveTexture.notNull()) - { - shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, mEmissiveTexture); // PBR sRGB Emissive - } - else - { - shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, LLViewerFetchedTexture::sWhiteImagep); - } - - // NOTE: base color factor is baked into vertex stream - - shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, mRoughnessFactor); - shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, mMetallicFactor); - shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, mEmissiveColor.mV); - } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 663dd2d9ec..cf104aa89d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5986,7 +5986,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 type = gPipeline.getPoolTypeFromTE(te, tex); if (is_pbr && gltf_mat && gltf_mat->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_BLEND) { - type = LLDrawPool::POOL_PBR_OPAQUE; + type = LLDrawPool::POOL_GLTF_PBR; } else if (type != LLDrawPool::POOL_ALPHA && force_simple) @@ -6790,7 +6790,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace if (gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND) registerFace(group, facep, LLRenderPass::PASS_ALPHA); else - registerFace(group, facep, LLRenderPass::PASS_PBR_OPAQUE); + registerFace(group, facep, LLRenderPass::PASS_GLTF_PBR); } else // do NOT use 'fullbright' for this logic or you risk sending diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a0fec90f87..aacf6fa73e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -428,7 +428,7 @@ void LLPipeline::init() getPool(LLDrawPool::POOL_BUMP); getPool(LLDrawPool::POOL_MATERIALS); getPool(LLDrawPool::POOL_GLOW); - getPool(LLDrawPool::POOL_PBR_OPAQUE); + getPool(LLDrawPool::POOL_GLTF_PBR); resetFrameStats(); @@ -1568,7 +1568,7 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0) poolp = mWLSkyPool; break; - case LLDrawPool::POOL_PBR_OPAQUE: + case LLDrawPool::POOL_GLTF_PBR: poolp = mPBROpaquePool; break; @@ -1649,7 +1649,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima } else if (gltf_mat) { - return LLDrawPool::POOL_PBR_OPAQUE; + return LLDrawPool::POOL_GLTF_PBR; } else if (mat && !alpha) { @@ -5777,7 +5777,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) } break; - case LLDrawPool::POOL_PBR_OPAQUE: + case LLDrawPool::POOL_GLTF_PBR: if( mPBROpaquePool ) { llassert(0); @@ -5910,7 +5910,7 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) mGroundPool = NULL; break; - case LLDrawPool::POOL_PBR_OPAQUE: + case LLDrawPool::POOL_GLTF_PBR: llassert( poolp == mPBROpaquePool ); mPBROpaquePool = NULL; break; @@ -9604,7 +9604,6 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera renderMaskedObjects(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, no_idx_mask, true, false, rigged); renderMaskedObjects(LLRenderPass::PASS_SPECMAP_MASK, no_idx_mask, true, false, rigged); renderMaskedObjects(LLRenderPass::PASS_NORMMAP_MASK, no_idx_mask, true, false, rigged); - renderMaskedObjects(LLRenderPass::PASS_PBR_OPAQUE, no_idx_mask, true, false, rigged); } } } @@ -9943,6 +9942,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLPipeline::RENDER_TYPE_ALPHA_PRE_WATER, LLPipeline::RENDER_TYPE_ALPHA_POST_WATER, LLPipeline::RENDER_TYPE_GRASS, + LLPipeline::RENDER_TYPE_GLTF_PBR, LLPipeline::RENDER_TYPE_FULLBRIGHT, LLPipeline::RENDER_TYPE_BUMP, LLPipeline::RENDER_TYPE_VOLUME, @@ -10000,8 +10000,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLPipeline::RENDER_TYPE_PASS_NORMSPEC_BLEND_RIGGED, LLPipeline::RENDER_TYPE_PASS_NORMSPEC_MASK_RIGGED, LLPipeline::RENDER_TYPE_PASS_NORMSPEC_EMISSIVE_RIGGED, - LLPipeline::RENDER_TYPE_PASS_PBR_OPAQUE, - LLPipeline::RENDER_TYPE_PASS_PBR_OPAQUE_RIGGED, + LLPipeline::RENDER_TYPE_PASS_GLTF_PBR, + LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_RIGGED, END_RENDER_TYPES); gGL.setColorMask(false, false); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 3b41d60356..7bad1cbe87 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -475,6 +475,7 @@ public: RENDER_TYPE_INVISIBLE = LLDrawPool::POOL_INVISIBLE, RENDER_TYPE_VOIDWATER = LLDrawPool::POOL_VOIDWATER, RENDER_TYPE_WATER = LLDrawPool::POOL_WATER, + RENDER_TYPE_GLTF_PBR = LLDrawPool::POOL_GLTF_PBR, RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA, RENDER_TYPE_ALPHA_PRE_WATER = LLDrawPool::POOL_ALPHA_PRE_WATER, RENDER_TYPE_ALPHA_POST_WATER = LLDrawPool::POOL_ALPHA_POST_WATER, @@ -535,8 +536,8 @@ public: RENDER_TYPE_PASS_NORMSPEC_MASK_RIGGED = LLRenderPass::PASS_NORMSPEC_MASK_RIGGED, RENDER_TYPE_PASS_NORMSPEC_EMISSIVE = LLRenderPass::PASS_NORMSPEC_EMISSIVE, RENDER_TYPE_PASS_NORMSPEC_EMISSIVE_RIGGED = LLRenderPass::PASS_NORMSPEC_EMISSIVE_RIGGED, - RENDER_TYPE_PASS_PBR_OPAQUE = LLRenderPass::PASS_PBR_OPAQUE, - RENDER_TYPE_PASS_PBR_OPAQUE_RIGGED = LLRenderPass::PASS_PBR_OPAQUE_RIGGED, + RENDER_TYPE_PASS_GLTF_PBR = LLRenderPass::PASS_GLTF_PBR, + RENDER_TYPE_PASS_GLTF_PBR_RIGGED = LLRenderPass::PASS_GLTF_PBR_RIGGED, // Following are object types (only used in drawable mRenderType) RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES, RENDER_TYPE_VOLUME, |