Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for an Atlas allocator for shadow maps #8345

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

pixelflinger
Copy link
Collaborator

This feature is controled by a feature flag and is turned off at this point.
This CL shouldn't change the existing behavior of shadowmap allocation as
long as the atlas feature is not enanled.

When enabled, shadowmap allocations are not limited to layers of the
shadowmap texture, instead, an atlas is used meaning a layer can
be shared by multiple shadowmaps. At the very least this can save
a lot of memory as smaller shadowmaps can be packed together.

Currently this feature breaks some VSM features:

  • mipmapping
  • blurring

- when inserting an entry at a root other than zero, we need to update
  the children count of the root's parent.

- the QuadTree array nodes need to be able to encode enough indices for
  the largest "layer" in the tree. With 7 layers the largest one has
  4096 entries, so we need 12 bits, not 8.
We add an offset to the shadowmap viewport, but in this change
it is always set to (0,0)
This feature is controled by a feature flag and is turned off at this point.
This CL shouldn't change the existing behavior of shadowmap allocation as
long as the atlas feature is not enanled.

When enabled, shadowmap allocations are not limited to layers of the
shadowmap texture, instead, an atlas is used meaning a layer can
be shared by multiple shadowmaps. At the very least this can save
a lot of memory as smaller shadowmaps can be packed together.

Currently this feature breaks some VSM features:
- mipmapping
- blurring
@pixelflinger pixelflinger added the internal Issue/PR does not affect clients label Jan 10, 2025
@pixelflinger pixelflinger merged commit 37fd83a into main Jan 13, 2025
13 checks passed
@pixelflinger pixelflinger deleted the ma/shadowallocator branch January 13, 2025 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants