diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl | 6 | ||||
-rw-r--r-- | indra/newview/lldrawpool.cpp | 7 | ||||
-rw-r--r-- | indra/newview/lldrawpool.h | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 44 |
4 files changed, 33 insertions, 26 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index 72a07fa3d0..ddb2881766 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -32,8 +32,10 @@ mat4 getObjectSkinnedTransform(); uniform mat4 modelview_projection_matrix; #endif +#if defined(GLTF) uniform vec4[2] texture_base_color_transform; vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform); +#endif uniform float shadow_target_width; @@ -70,6 +72,10 @@ void main() passTextureIndex(); +#if defined(GLTF) vary_texcoord0 = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); +#else + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; +#endif vertex_color = diffuse_color; } diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 8eb88dc3cd..34d8f8b9ce 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -590,13 +590,6 @@ void LLRenderPass::applyModelMatrix(const LLDrawInfo& params) } } -void LLRenderPass::resetGLTFTextureTransform() -{ - F32 ignore_gltf_transform[8]; - LLGLTFMaterial::sDefault.mTextureTransform[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR].getPacked(ignore_gltf_transform); - LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLShaderMgr::TEXTURE_BASE_COLOR_TRANSFORM, 2, (F32*)ignore_gltf_transform); -} - void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 38132e0793..09c95a1705 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -349,8 +349,6 @@ public: void resetDrawOrders() { } static void applyModelMatrix(const LLDrawInfo& params); - // Use before a non-GLTF batch if it is interleaved with GLTF batches that share the same shader - static void resetGLTFTextureTransform(); virtual void pushBatches(U32 type, bool texture = true, bool batch_textures = false); virtual void pushRiggedBatches(U32 type, bool texture = true, bool batch_textures = false); void pushGLTFBatches(U32 type); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1768c6ee5f..2912d0da82 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -197,6 +197,7 @@ LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize"); const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f; +const F32 ALPHA_BLEND_CUTOFF = 0.598f; const F32 DEFERRED_LIGHT_FALLOFF = 0.5f; const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; @@ -6764,6 +6765,8 @@ void LLPipeline::renderAlphaObjects(bool rigged) assertInitialized(); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; + S32 sun_up = LLEnvironment::instance().getIsSunUp() ? 1 : 0; + U32 target_width = LLRenderTarget::sCurResX; U32 type = LLRenderPass::PASS_ALPHA; LLVOAvatar* lastAvatar = nullptr; U64 lastMeshId = 0; @@ -6786,10 +6789,18 @@ void LLPipeline::renderAlphaObjects(bool rigged) { if (pparams->mGLTFMaterial) { + gDeferredShadowGLTFAlphaMaskProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); + LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF); mSimplePool->pushRiggedGLTFBatch(*pparams, lastAvatar, lastMeshId); } else { + gDeferredShadowAlphaMaskProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); + LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF); if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash) { mSimplePool->uploadMatrixPalette(*pparams); @@ -6797,7 +6808,6 @@ void LLPipeline::renderAlphaObjects(bool rigged) lastMeshId = pparams->mSkinInfo->mHash; } - LLRenderPass::resetGLTFTextureTransform(); mSimplePool->pushBatch(*pparams, true, true); } } @@ -6805,11 +6815,18 @@ void LLPipeline::renderAlphaObjects(bool rigged) { if (pparams->mGLTFMaterial) { + gDeferredShadowGLTFAlphaMaskProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); + LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF); mSimplePool->pushGLTFBatch(*pparams); } else { - LLRenderPass::resetGLTFTextureTransform(); + gDeferredShadowAlphaMaskProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); + LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF); mSimplePool->pushBatch(*pparams, true, true); } } @@ -8836,8 +8853,6 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera stop_glerror(); - LLEnvironment& environment = LLEnvironment::instance(); - struct CompareVertexBuffer { bool operator()(const LLDrawInfo* const& lhs, const LLDrawInfo* const& rhs) @@ -8852,7 +8867,6 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera { bool rigged = j == 1; gDeferredShadowProgram.bind(rigged); - LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); gGL.diffuseColor4f(1, 1, 1, 1); @@ -8897,28 +8911,25 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera { LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha"); LL_PROFILE_GPU_ZONE("shadow alpha"); - + const S32 sun_up = LLEnvironment::instance().getIsSunUp() ? 1 : 0; U32 target_width = LLRenderTarget::sCurResX; for (int i = 0; i < 2; ++i) { bool rigged = i == 1; - gDeferredShadowAlphaMaskProgram.bind(rigged); - LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); - LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); - { LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha masked"); LL_PROFILE_GPU_ZONE("shadow alpha masked"); - LLRenderPass::resetGLTFTextureTransform(); + gDeferredShadowAlphaMaskProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); + LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); renderMaskedObjects(LLRenderPass::PASS_ALPHA_MASK, true, true, rigged); } { LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha blend"); LL_PROFILE_GPU_ZONE("shadow alpha blend"); - LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(0.598f); renderAlphaObjects(rigged); } @@ -8926,9 +8937,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow fullbright alpha masked"); LL_PROFILE_GPU_ZONE("shadow alpha masked"); gDeferredShadowFullbrightAlphaMaskProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); - LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); - LLRenderPass::resetGLTFTextureTransform(); renderFullbrightMaskedObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true, rigged); } @@ -8936,16 +8946,16 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha grass"); LL_PROFILE_GPU_ZONE("shadow alpha grass"); gDeferredTreeShadowProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF); + if (i == 0) { - LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(0.598f); renderObjects(LLRenderPass::PASS_GRASS, true); } { LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha material"); LL_PROFILE_GPU_ZONE("shadow alpha material"); - LLRenderPass::resetGLTFTextureTransform(); renderMaskedObjects(LLRenderPass::PASS_NORMSPEC_MASK, true, false, rigged); renderMaskedObjects(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, true, false, rigged); renderMaskedObjects(LLRenderPass::PASS_SPECMAP_MASK, true, false, rigged); @@ -8958,8 +8968,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera { bool rigged = i == 1; gDeferredShadowGLTFAlphaMaskProgram.bind(rigged); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up); LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); - LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; |