Skip to content

Commit

Permalink
cleanup code so it's easier to understand
Browse files Browse the repository at this point in the history
this should make it clearer how we set the per primitive variant
when SSR and shadowin is involved
  • Loading branch information
pixelflinger committed Oct 8, 2024
1 parent 26b42a7 commit 58aa74b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions filament/src/RenderPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,18 @@ RenderPass::Command* RenderPass::generateCommandsImpl(RenderPass::CommandTypeFla
bool const hasSkinning = soaVisibility[i].skinning;
bool const hasSkinningOrMorphing = hasSkinning || hasMorphing;

// if we are already an SSR variant, the SRE bit is already set,
// there is no harm setting it again
// if we are already an SSR variant, the SRE bit is already set
static_assert(Variant::SPECIAL_SSR & Variant::SRE);
Variant renderableVariant = variant;
renderableVariant.setShadowReceiver(
Variant::isSSRVariant(variant) || (soaVisibility[i].receiveShadows & hasShadowing));
Variant renderableVariant{ variant };

// we can't have SSR and shadowing together by construction
bool const isSsrVariant = Variant::isSSRVariant(variant);
assert_invariant((isSsrVariant && !hasShadowing) || !isSsrVariant);
if (!isSsrVariant) {
// set the SRE variant, unless we're in SSR mode
renderableVariant.setShadowReceiver(soaVisibility[i].receiveShadows && hasShadowing);
}

renderableVariant.setSkinning(hasSkinningOrMorphing);

FRenderableManager::SkinningBindingInfo const& skinning = soaSkinning[i];
Expand Down

0 comments on commit 58aa74b

Please sign in to comment.