Commit graph

869 commits

Author SHA1 Message Date
Jozufozu
0c195fef9f Manual light updates
- Update the BakedModelBufferers to default to zero sky light
2024-12-02 17:45:19 -08:00
Jozufozu
e1ddd7c2fc You merely adopted it
- Default light to 0 in DefaultVertexList
- Take the max of mesh and instance light in the instance shader
2024-12-02 17:19:00 -08:00
Jozufozu
9e60045d43 Dimensional storage
- Fix exception thrown in light storage when vising nether and end
  dimensions
- Try to make section collection more tolerant, but more work on a
  fallback path is likely needed
2024-11-18 16:13:25 -08:00
Jozufozu
7148ff3f31 Breaking bright
- Fix crumbling having an incorrect draw buffer bound, causing it to
  appear too bright on indirect
2024-11-17 12:24:14 -08:00
Jozufozu
3b7f9c7770 Lights, camera...
- Hopefully fix gh actions by bumping setup-gradle version
2024-11-16 15:10:31 -08:00
Jozufozu
00bd05af88 Who's counting?
- Atomically count instances in indirect instancer
- Fixes indirect draws/instancers never being deleted
- Fix baseDraw being set incorrectly on intel
- Handle setting baseDraw in GlCompat#safeMultiDrawElementsIndirect
2024-11-16 14:54:23 -08:00
Jozufozu
3811da166c Wait a minute
- Add debug flag to disable frame/tick plan execution
- Should help debugging cases where a visual constructor produces a
  visual in an invalid state like the weeping shulker bug
2024-11-15 18:18:44 -08:00
Jozufozu
f3845a15fb Not a lut left
- Prune empty layers from the lut to avoid it just getting larger as the
  player explores the world
2024-11-14 22:33:14 -08:00
Jozufozu
6431a84f67 Sky's edge
- Fix darkness when collecting light sections from high in the air
- Add dummy data layer impl to return a constant
- Empty sky section returns 15
- Empty block section returns 0
- Copy vanilla's logic for determining which data layer to use for a
  given position's sky light value
- While I'm at it, retrieve light section storage via an accessor to
  avoid allocating SectionPos objects
- Improve lut debug view
2024-11-14 22:33:14 -08:00
PepperCode1
ac544245b3 Deferred default
- BackendManager.defaultBackend now dynamically computes the result every time it is invoked
- Forge backend config value now uses a supplier to provide the default backend
- Fix Fabric backend config being saved to "flw_backends" but loaded from "flw_backend"
2024-11-12 22:52:38 -08:00
Jozufozu
46fb59289f Weeping shulkers
- Properly fix shulker boxes appearing in the wrong location
2024-11-12 16:55:20 -08:00
Jozufozu
cfcb4246af Effective debugging
- Add light storage debug view courtesy of effect visuals
- Yellow boxes are filled in sections
- Red/green/blue bars represent the LUT
- Cyan boxes are the "wasted space" in the LUT. Freely representable
  sections that are simply not filled in
2024-11-12 13:33:30 -08:00
Jozufozu
6f0a2b0e56 Reticulated splines
- Fix line models rendering garbage
- Fix shulker boxes appear at the origin before snapping into place
- Make the box and line models public
2024-11-12 13:33:11 -08:00
Jozufozu
868a263c28 No one can hear you free
- Silence empty model warning behind a system property
- Fix gpu memory leak from light/matrix buffers on indirect
2024-11-11 22:33:41 -08:00
Jozufozu
6709682785 A little less lit
- Fix normalizing constant in light_lut.glsl to make shader light
  slightly darker and consistent with chunk lighting
2024-11-11 18:25:57 -08:00
Jozufozu
671d47a136 Swizzle
- Switch to Y X Z ordering
- In theory this will be more coherent since the first lut step on the
  GPU will have a more constrained range of values in the worst case
2024-11-10 12:10:47 -08:00
Jozufozu
bedb92c73c Lessen updates today!
- LightLut now does incremental updates java-side
- Still requires a full upload when changed, though it does not take up
  much space
- ShaderLightVisualStorage now actually triggers removal of light
  section from the lut
2024-11-10 11:59:05 -08:00
Jozufozu
5b97a56c8c Save yourself the trouble
- Don't initialize instancers if they have 0 instances
- Never shrink the index pool
- Actually process recently allocated meshes to avoid growing the list
  forever
2024-11-08 16:13:28 -08:00
Jozufozu
68453d8349 Always the first thing to fall apart
- Fix crumbling on indirect
2024-11-08 16:10:44 -08:00
Jozufozu
eae1d0ef94 The 3 time world heavyweight champion
- Fix instance hiding on indirect
2024-11-08 10:13:29 -08:00
Jozufozu
c8d76c32a7 Tightening the screws
- Fix hiz test bounds clamping, good ol off by 1 error
- Remove check for useMin since it's never used and the depth reduce
  shader is hard-coded already
2024-11-08 09:58:40 -08:00
Jozufozu
376ac76ac2 A whole lut of refactors
- Replace monolithic lut building function with a class representing a
  layer of the lut
- Actually need 2 classes because int[] and Object[] aren't trivial to
  make a type parameter, and we don't really want to be boxing ints here
- No longer need sorted inputs
- Should fix index out of bounds crash caused by reserving space for the
  wrong index layer
- This will make it much easier to change the coordinate ordering scheme
2024-11-08 09:32:27 -08:00
IThundxr
e6fecc60b5
Remove rubidium optional dependency (#270) 2024-11-08 09:05:50 -08:00
IThundxr
461578ec0e
Automated testing (#269)
* Automated testing

* Testing testing

- Use 2 spaces for indents yaml
- Move setupTestMod to PlatformExtension
- Allow specifying the sourceSet for the testMod artifact
- Rename things to camelCase
- Use rootCompile from transitiveSourceSets for the testMod source sets
- Use a blanket remapTestModJar task in the gh actions build

* Fail slowly

- We want to know the results of both tests regardless

* Add workflow dispatch

* Shoes should be steel toed, dangerous stuff

* Update build.yml

* fix modid

* Update FlywheelTestModClient.java

* add debug logging

* fix syntax issues

* fix issues

* Update build.yml

* Add debug logging

* more logging

* get testmod from correct dir

* switch to env var

* Why wait?

- Immediately audit on client tick

* DidObfuscate

- Fix RenderSystemMixin on fabric
- setShaderFogShape's arguments need to be remapped, but the name of the
  function should not be. Fortunately mixin allows matching by function
  name alone

* Clever commit title

- Change the Fabric mod ID to match Forge
- Move "Flywheel Test Mod" to static
- Cleanup start/stop messages
- Use the client start event on Fabric

---------

Co-authored-by: Jozufozu <jozsefaug@gmail.com>
2024-11-03 17:57:47 -08:00
Jozufozu
4f0c1cc1ae Checking the source
- Remove source checks, it was very old and untouched
- Remove FIXMEs and TODOs that were already fixed/done
2024-11-03 12:15:04 -08:00
Jozufozu
540fe7a7fe Acetaminophen
- 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
2024-11-02 16:56:49 -07:00
Jozufozu
a9f2018c0a The epitome of laziness
- Only upload changed page frame descriptors
- In the instancer, track changed contents separately from changed
  validity, so we can separately upload objects and descriptors
2024-11-02 14:12:45 -07:00
Jozufozu
fc3e475ec9 Gattai!
- 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
2024-11-01 23:50:06 -07:00
Jozufozu
fac63168c1 Bookkeeping
- Mappings drop pages when they write zero validity bits
- Instancer only updates pages that changed
2024-11-01 12:47:15 -07:00
Jozufozu
20b3f78b9c A real page turner
- Try to shuffle over instances into pages with space
- Clear out now-unused logic from ObjectStorage
- Some cleanup and more comments in IndirectInstancer
2024-10-29 20:02:38 -07:00
Jozufozu
a7e7090866 Finding an old bookmark
- 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
2024-10-29 20:02:37 -07:00
Jozufozu
3a949c717a Turn the cutout off crash off
- 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
2024-10-19 16:58:04 -07:00
IThundxr
3d2fdb7e83
Backport changes from 1.21.1 (#265)
* 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>
2024-10-18 20:29:43 -07:00
PepperCode1
734506b010 Fix #266 2024-10-18 18:25:11 -07:00
Jozufozu
3193e16498 Weak assumption
- Use a weak hash set for PipelineCompiler.ALL
2024-10-12 17:02:50 -07:00
Jozufozu
efb68dc776 All or nothing?
- Actually add PipelineCompilers into the ALL list so they get deleted
  when uber components need updating
2024-10-12 16:36:20 -07:00
Jozufozu
40577420d5 In the right direction
- 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
2024-09-29 11:52:35 -07:00
Jozufozu
22b5676e47 Quick thinking
- Decide not to render entities directly in the renderEntity method
- Prevents allocating large lists every frame to filter entities from
  the client level
2024-09-28 23:37:49 -07:00
Jozufozu
0a01b82647 Glimpse of glint
- 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
2024-09-28 23:27:28 -07:00
Jozufozu
bd0aadf9d9 Streamlined pipelines
- 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
2024-09-28 22:05:38 -07:00
Jozufozu
ef05f7d3fd Errors galore
- 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
2024-09-28 16:00:23 -07:00
Jozufozu
11ce4ac185 Dynamic ubering
- 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
2024-09-28 15:30:10 -07:00
Jozufozu
bce657804a Source of all pain
- 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
2024-09-28 14:48:22 -07:00
Jozufozu
48fdcdb751 DeDelleetete
- Process instancer deletions in parallel
- Give DrawManagers a frame plan
2024-09-28 14:26:15 -07:00
Jozufozu
7bd59f7b14 Not pointing
- Fix occasional npe in PlayerUniforms
- Mark accessor method as Nullable
2024-09-23 11:16:45 -07:00
Jozufozu
36b0ad4cf9 To bug or not to bug
- Disable the debug stuff in the frag shader with compile flags
- Also disable discard and conservative depth with CutoutShaders.OFF
2024-09-22 15:51:37 -07:00
Jozufozu
897c350f41 Uberstate ready
- Fix material state sorting/equality functions
2024-09-22 13:13:38 -07:00
Jozufozu
ff73e78e21 Visions of visibility
- Add visible/skipDraw getter/setter to InstanceTree
- Minecart finally gets to resolve its TODO!
2024-09-22 13:04:51 -07:00
Jozufozu
ee0f799f60 More statefuler
- 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
2024-09-22 12:56:49 -07:00
Jozufozu
c5d9abab5f Tasteful stateful handles
- 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
2024-09-22 12:28:35 -07:00