- Write out instance bounding spheres in pass one
- Read them back in pass two so we don't have to read in the entire
instance twice
- Cull pass 2 no longer needs to be parameterized by instance type, so
less program binds are needed
- Fix page indexing logic
- Fix visibility sizing logic
- Generic pain relief
- Use new Instance[] rather than capturing the class object of the
instance type
- Make InstancePage static, but manually track the instancer parent so
we can check when stealing
- Simplify array creation helpers and make them static
- Mark InstanceHandleImpl#state as UnknownNullability
- Only upload changed page frame descriptors
- In the instancer, track changed contents separately from changed
validity, so we can separately upload objects and descriptors
- Combine pages only when they're at most half full, and not empty
- This guarantees that we'll fully empty a page, allowing us to free the memory for use by other instancers
- Track mergeable pages via a separate bitset
- Try to shuffle over instances into pages with space
- Clear out now-unused logic from ObjectStorage
- Some cleanup and more comments in IndirectInstancer
- Make AbstractInstancer much more slim and move logic to BaseInstancer
- Extend paging concept to the indirect instancer
- Extend ObjectStorage to support more interesting layouts
- Instance creation on indirect is now entirely lock free and deletions
no longer require re-uploading the entire instancer
- MaterialEncoder would trigger an indexing of CutoutShaders.OFF, though
PipelineCompiler would explicitly not index OFF
- This caused a crash on instancing when MaterialEncoder would delete
all pipeline shaders while instancing was trying to upload the packed
ubershader uniform
* Backport changes from 1.21.1
* fix
* Fix building
* fix compile error
* fix
* fix build for real
* address reviews
* Fix sodium compat
* address requested changes
* mark rubidium as incompatible
* add missed call
* Should have worn steel toe boots
- Add "stub" sourceset to each subproject
- Directly pass vararg sourcesets to methods in PlatformExtension to
avoid automatically shipping jars with the api stubs
- We may have to include stubs in setupLoomMod, but I don't think so
- A lot of this can be stripped back out if we don't need stub sources
for the forge/fabric subprojects
* Guarded stubs
- Add Sodium 0.6 and Iris API stubs to stubs source set and remove Gradle dependencies on local Sodium jar, Iris, and Oculus
- Ensure usage of APIs that may not exist at runtime is in private classes and access is always guarded
- Change ShadersModHandler
- Rename to ShadersModHelper
- Convert methods to check for Iris' and Optifine's presence into static final fields
- Move implementation to impl source set in form of IrisCompat and OptifineCompat classes
- Rename CompatMods to CompatMod and add public field to access mod ID
- Set BlockEntityType's Sodium predicate to null after it is removed
- Update repository links
- Remove local libs repository
---------
Co-authored-by: Jozufozu <jozsefaug@gmail.com>
Co-authored-by: PepperCode1 <44146161+PepperCode1@users.noreply.github.com>
- Don't actually need a framebuffer attachment for visibility
- Instead, process everything in pass 2 and write out the visibility
bitset directly
- Persist visibility bits between frames for use in pass 1
- No need for indirect dispatch!
- Also saves some ssbo bindings
- Do frustum culling in both passes
- Use vanilla light directions for diffuse lighting
- Copy mc's glsl code for it, but assume directions are normalized
- Add command/config to toggle use of light directions vs chunk accurate
diffuse
- Always use shade in getItemMaterial
- Do not reload resource packs when updating light smoothness config,
we don't need to anymore with lazy compilation
- Decide not to render entities directly in the renderEntity method
- Prevents allocating large lists every frame to filter entities from
the client level
- Add pick glint material and system time uniform
- Move _FlwCullData to beginning of uniform block to ensure alignment
- Add helper to convert item rendertype into flywheel material
- Make UberShaderComponent#build NotNull
- Move index update and key creation logic to PipelineCompiler
- Always update index when a resource location is requested to fix
MaterialEncoder misses
- Indices trigger pipeline compiler deletion when updated
- Make everything in the compiler chain's results not null
- Throw errors immediately when encountered
- Log error messages when falling back
- Do not eagerly grab utility programs in IndirectDrawManager so we can
actually catch errors and fall back
- Remove CompilerStats
- Remove fog shader registry
- Remove Registry and RegistryImpl
- Make shader indices mutable
- Track fog uber component in a static field in PipelineCompiler
- When a new fog source is added, delete the pipeline compilation
harness and recreate the fog uber component
- Inline SourceLoader
- Strip out almost all source registries
- Fog will be dealt with in a follow-up commit
- Remove most static #init methods
- Remove old ubershader indices from shaders
- Hidden state now tracks the Instance object to keep the handle small
- Make the recreate supplier an explicit record to allow comparisons
- Add setVisible method to Instance
- Use state machine interface in InstanceHandleImpl
- 3 states: deleted, visible, hidden
- Visible is directly implemented by AbstractInstancer
- Hidden stores the instancer supplier to recreate an instancer
- Eagerly load ALL shaders in ShaderSources, resolving imports there
- Compile and cache programs on-demand
- Move gl state try blocks to EngineImpl
- EngineImpl catches shader exceptions and triggers a fallback
- Fix crumbling on indirect
- Directly use the baseInstance as instance index without indirection
- #define base instance and draw id variables to simplify usage
- Fix null pointer looking up culling group
- Add method to map an instancer's local instance index to a global
index in the page file
- Remove ModelHolder and ModelCache
- Remove lib/util.FlwUtil
- Remove lib/util.Pair and replace usages with com.mojang.datafixers.util.Pair
- Remove lib/util.Unit and replace usages with net.minecraft.util.Unit
- Make ResourceReloadHolder and ResourceReloadCache final and move to util
- Clean up code in backend/glsl
- Move LightSmoothnessArgument to impl
- Remove LoweringVisitor
- Move functionality of four main static methods in LoweringVisitor to new ModelTrees class
- Return ModelTree directly
- Accept Material instead of TextureAtlasSprite for efficiency, so visuals don't need to look up the sprite to get the ModelTree
- Use ResourceReloadCache for MeshTree.CACHE
- Implement instance hiding by deleting/stealing
- Work around instancer persistence by storing a recreation supplier in
the instance handle
- Rework instancer ctors to just take an InstancerKey
- Parameterize InstanceHandle by I extends Instance so the steal method
and the supplier can be safely assigned
- IndirectInstancer#uploadInstances: 46% of render thread to 26%
- Inline #enqueueCopy to avoid allocating LongConsumers
- Do not even bother to track individual changed indices, instead rely
on just the changedPage set
- Convert ShulkerBoxVisual to use InstanceTree
- Add "pruning" helper visitors
- Remove ModelPartConverter
- Remove TextureMapper and related code from VertexWriter
- Add ModelTree
- Add LoweringVisitor to traverse a MeshTree and emit ModelTree nodes
and Models
- Provide some default visitor creation methods
- Abstract ModelCache -> ResourceReloadCache
- Abstract ModelHolder -> ResourceReloadHolder
- Add ModelTreeCache to hide lookup cost if it gets extreme
- Use InstanceTrees in BellVisual and MinecartVisual
- Use JOML Matrix4fStack instead of PoseStack
- Directly transform Matrix4f instead of using PoseStack to compute initial pose
- Track if the transforms for an InstanceTree have changed
- Pass a boolean down the tree and || it with our changed flag to force
updates
- Expose the force flag to visuals so they can hint to us if their root
transforms never change
- Add 2 wrapper methods to make the distinction more clear
- Store a pose matrix in each InstanceTree, equivalent to its instance's pose matrix if the instance exists
- Directly transform the current InstanceTree's pose matrix instead of transforming a PoseStack and copying its matrix to the instance, eliminating the need to push and pop stack entries
- Remove InstanceTree.rotation
- Add more InstanceTree methods to allow full inspection of children