Commit Graph

248 Commits

Author SHA1 Message Date
Jozufozu
78a21bf0df No need for getDirtyBitSet
- Faster and simpler to just do one loop
2021-12-17 22:41:22 -08:00
Jozufozu
54703d8c1a Use task engine/sync to update instances 2021-12-17 02:17:39 -08:00
Jozufozu
80b3c1ed35 Proper task engine
- Manual threadpool
 - More control
2021-12-17 01:03:52 -08:00
Jozufozu
3049601e4a Simplify SBB
- SBB -> ModelTransformer
 - Shader binding the minecraft way
 - Engines are responsible for ending batches
2021-12-16 23:10:24 -08:00
Jozufozu
a668a7c7ac Naive parallelism
- Submit many tasks to executor and then wait for them all to complete.
 - Use WaitGroup
 - SBB no longer stores params, instead accepts Params arg to render
 - SBB keeps scratch variables local
 - CPUInstancer keeps track of default params
 - Separate #setup and #draw... functions in CPUInstancer
 - Combine DirectBufferBuilder#updateAfterWriting with #intoDirectConsumer
 - DirectVertexConsumer#split to distribute work
2021-12-16 10:49:26 -08:00
Jozufozu
8b472f4f51 Better SBB params
- Transform interface for grouping traits and combined behavior
 - Move transforms to params, impl Transform
 - Pass Params object to BatchingTransformers instead of SBB
2021-12-16 00:11:47 -08:00
Jozufozu
f1e63106fc Batching Engine
- Implement alternate backend using SBBs
2021-12-15 17:12:48 -08:00
Jozufozu
d07dbbf1a4 Possible fix(es) for accessor crash
- Haven't been able to reproduce
 - Try forcing PausedPartialTickAccessor to load early
 - Try renaming the method
2021-12-15 16:19:52 -08:00
Jozufozu
0de377d5bb Fix #extension crash on intel 2021-12-15 13:27:06 -08:00
PepperBell
07cff39a95 Sweeping up
- Remove deprecated methods and fields
- Bump pack format
- Fix CI badge link
- Update VanillaInstances javadoc
- Organize imports
2021-12-14 22:00:44 -08:00
Jozufozu
5e2235dab7 No need for InstancedMaterialRenderer
- Here's to premature abstraction
2021-12-13 21:27:15 -08:00
Jozufozu
d9bbd325ed AMD driver workaround
- Just don't pool models
2021-12-13 19:55:50 -08:00
Jozufozu
0cafa48964 Fix vanishing minecarts 2021-12-12 22:30:46 -08:00
Jozufozu
7ff0a87b17 Use GL_ARB_conservative_depth when possible
- Allows the depth test to discard fragments before the fragment shader is run
2021-12-11 22:03:52 -08:00
Jozufozu
4a86c112dd Cylindrical fog
- having the world position is very nice
 - mojang manages to do multiple matrix multiplications
2021-12-11 17:31:09 -08:00
Jozufozu
5ebc592391 Fix misaligned contraption light
- That was a pain to debug
 - Idk how that ever worked
2021-12-11 15:06:07 -08:00
Jozufozu
cee1a9b0fe 1.18.1 2021-12-11 14:18:43 -08:00
Jozufozu
abeced384d Implemented 2021-12-10 14:50:01 -08:00
Jozufozu
bd58786f94 Mapped buffer sanity
- MappedBuffer no longer abstract
 - Mappable interface used within MappedBuffer
 - MappedBuffer is mapped before ctor
 - No more subclasses, no more thin wrapping overrides
 - Use try with resources for buffer mapping
 - Better error handling with mapped buffers
 - Unimplemented exception as a procrastination method
2021-12-10 14:45:18 -08:00
Jozufozu
43289c3579 Worlds are bigger now pt 2
- Stop clamping Y in [0, 256)
2021-12-10 12:31:57 -08:00
Jozufozu
20eb73025c Worlds are bigger now
- Stop clamping Y in [0, 256)
2021-12-10 00:28:32 -08:00
Jozufozu
c0d5c32766 Debugging changes
- MapBufferRange compat layer not needed, missed that
 - Don't need MappedFullBuffer anymore
 - Add guard for size in GPULightVolume#bind
 - LightVolume#getStride not needed
 - Replace usaged of GlError#poll with #pollAndThrow
 - VecBufferConsumer doesn't need a format
2021-12-10 00:07:52 -08:00
Jozufozu
50fdf9bb59 Whoops remove imports 2021-12-09 16:40:01 -08:00
Jozufozu
a84d850299 No more material spec, everything is StructType 2021-12-09 16:34:32 -08:00
Jozufozu
f2d406a02a Move api package 2021-12-09 15:27:56 -08:00
Jozufozu
c5b53a0297 Add RecordingVertexConsumer
- Very basic and untested
2021-12-09 15:19:48 -08:00
Jozufozu
f3c57b4ae4 Reorganize, rename, refactor, 0.4.0
- Move most user facing interfaces to flywheel.api package
 - Refactor InstanceData to have no package private classes
 - Remove 'I' prefix from many interfaces
 - ILightUpdateListener -> LightListener
 - IMultiProgram -> ContextAwareProgram
 - IFlatLight -> FlatLit
 - All materials use the same vertex format: UNLIT_MODEL
2021-12-09 00:42:27 -08:00
Jozufozu
860aee28d8 Fix shulker box rendering 2021-12-08 12:48:18 -08:00
Jozufozu
e575b1c580 #tick and #beginFrame on creation
- Fixes weird delay in object appearance when reloading chunks
2021-12-08 12:28:22 -08:00
Jozufozu
008c6c1e3f Add instances when chunks are built for rendering
- RIP ChunkIter, may you rule over the depths of hell in peace
 - Fix memory leak when instance worlds get reset
 - Server worlds are not flywheel worlds
 - Nothing to do on world load anymore
2021-12-08 12:16:01 -08:00
Jozufozu
9347fb76a4 Fix potential nullpointer rendering breaking overlay
- Should backport for #52
2021-12-07 23:53:13 -08:00
Jozufozu
c20b0142e9 Groups store their types again
- Fix crash rendering breaking overlay
2021-12-07 23:40:45 -08:00
Jozufozu
8669d68af3 VAO state clearing handled in InstancingEngine#render 2021-12-07 23:00:32 -08:00
Jozufozu
89c96aa026 Cull legacy compat boilerplate
- Minecraft is on GL32 now!
2021-12-07 22:47:05 -08:00
Jozufozu
fef41658d0 Quick fix for create's contraptions 2021-12-07 22:45:10 -08:00
Jozufozu
c85effe6ea Merge branch '1.17/dev' into 1.18/dev 2021-12-07 21:29:38 -08:00
Jozufozu
cfea89a371 Get started on a batching engine
- An Engine is a MaterialManager and a RenderDispatcher
 - Refactor InstanceManager's ctor to use the MaterialManager interface instead of the concrete type
 - MaterialManagerImpl -> InstancingEngine
 - Add skeleton for BatchingEngine
 - Hack in InstanceWorld to switch between the 2
 - Rename/move existing MaterialManager impl to new package
2021-12-06 23:36:14 -08:00
Jozufozu
46cbd76fb6 Update to 1.18 2021-12-06 21:29:21 -08:00
Jozufozu
d179a68769 Miscellaneous gl changes while debugging
- Only unbind at the end of MaterialManagerImpl#render
 - Add GlBufferType#bind and #unbind
 - Make GlVertexArray#unbind static
2021-12-06 21:11:51 -08:00
Jozufozu
3a4fb0e43d Do a 180
- Fix inconsistency in minecart model
2021-12-06 17:19:21 -08:00
Jozufozu
79fe04c6ab Vanillaization
- IModels now accept a VertexConsumer
 - IRenderState -> RenderType
 - AbstractInstancer for dealing with InstanceData tidyness
 - Alter crumbling renderer to match new system
 - Add hack to keep track of bound atlas textures
2021-12-06 15:23:26 -08:00
Jozufozu
4d795d257a No more InstanceData#write 2021-12-02 20:13:55 -08:00
Jozufozu
241c50291d Yeet json extensions that idea doesn't make sense
- Was only ever used for fog
 - Was the same for every material
 - Made things unnecessarily complex
 - Fix fog
 - Convert ProgramState to record
2021-12-02 17:40:23 -08:00
Jozufozu
bdcf034f7f Shadows causing trouble? No more shadows 2021-11-27 11:30:38 -08:00
PepperBell
b1f34389b7 Improve StitchedSprite functionality
- Make StitchedSprite work like PartialModel
- Allow StitchedSprite instances to be created directly
- Allow StitchSprites to be created for any atlas
- Use texture stitch post event instead of lazy computation for filling
StitchedSprites
- Remove legacy method from AngleHelper
- Change artifact name from flywheel to flywheel-forge
- Organize imports
2021-11-24 18:43:05 -08:00
Jozufozu
b762b1a7d3 Merge remote-tracking branch 'origin/1.16/dev' into 1.17/dev
# Conflicts:
#	changelog.txt
#	gradle.properties
#	src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java
#	src/main/java/com/jozufozu/flywheel/config/BooleanConfig.java
#	src/main/java/com/jozufozu/flywheel/config/SConfigureBooleanPacket.java
#	src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java
#	src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java
#	src/main/java/com/jozufozu/flywheel/util/WorldAttached.java
#	src/main/resources/flywheel.mixins.json
2021-11-23 16:49:39 -08:00
Jozufozu
16f43867b6 Implement TransformStack directly on PoseStack
- Add helper method to cast to the interface.
2021-11-23 15:07:31 -08:00
Jozufozu
37eece8756 Split TransformStack interface
- Now individual components Translate Rotate and Scale
 - Internal change to ModelData, store matrices directly
 - Implement Translate Rotate and Scale for ModelData
 - Implement Translate and Rotate for OrientedData
 - Clean usages of ModelData to use new api when possible
 - WriteSafe and WriteUnsafe for matrices
2021-11-22 18:05:53 -08:00
PepperBell
279e0893c6 Server crash fix and formatting
- Fix matrix mixins being applied on dedicated server
- Expand PartialModel functionality: add location getter and model
setter
- Remove Loader.getResourceType since selective reloading is deprecated
- Organize imports and mixin order
- Other formatting
- Update Gradle and Forge
2021-11-18 14:59:39 -08:00
Jozufozu
3919aaeead TextureBinder for dealing with vanilla RenderTypes 2021-11-09 16:48:54 -08:00
Jozufozu
ecb3fd1540 Instance init
- So that simi can have his cogs.
 - Inheritance is painful when models are acquired in an instance's ctor
2021-11-09 15:03:52 -08:00
Jozufozu
1233c95edb Chipping away at light 2021-11-09 14:59:31 -08:00
Jozufozu
7b5b8cca2a Named models 2021-11-08 20:48:02 -08:00
Jozufozu
18f5561f9a Invalidate regardless 2021-11-05 16:47:27 -07:00
Jozufozu
0c94188613 Revert "Weak hash map in world attached"
This reverts commit 98a3f759b3.
2021-11-05 16:45:39 -07:00
Jozufozu
42522ffc27 Weak hash map in world attached
- More robust solution that listening to WorldEvent.Unload
2021-10-31 19:54:12 -07:00
Jozufozu
ba3ef05aa4 Fix world leak 2021-10-31 19:50:01 -07:00
Jozufozu
bf2525cb2e Remove chunk provider mixin and refactor config packets 2021-10-31 17:24:57 -07:00
Jozufozu
d9bfe82a22 Compat work
- No more net.minecraftforge.common.util usages
 - Replace forge lazy with flywheel lazy
 - Replace forge NonNullSupplier with flywheel NonNullSupplier
 - texture2D -> texture
2021-10-12 12:52:02 -07:00
Jozufozu
59ea700b04 Revert "Rename/refactor many interfaces"
This reverts commit 66aa987dbd.

Can re-think the names later.
2021-09-30 13:43:09 -07:00
Jozufozu
18ed201c93 Rename/refactor many interfaces
- Drop I prefix
 - Inline IMultiProgram
 - Remove unused method in InstanceRendered
2021-09-28 17:54:47 -07:00
Jozufozu
39ce96ec9c Better Block Entity filtering
- Assumes IInstanceRendered#shouldRenderNormally does not change over a BE's life
2021-09-26 22:30:11 -07:00
Jozufozu
79ac9e96e4 Testing + fixing 2021-09-26 21:15:02 -07:00
Jozufozu
7c5e02d2e8 UNTESTED - Replace ATs
- Matrices use #store
 - Accessor for pausedPartialTick
2021-09-26 19:40:53 -07:00
Jozufozu
532e7450e9 GL32 shaders and errors
- Update shaders to glsl 150
 - Objectfy errors
2021-09-20 19:27:04 -07:00
Jozufozu
c504496728 Small things
- Fix minecarts rendering really far away
 - InstanceManager#getInstance now has one job
 - Instance creation moved to InstanceManager#addInternal
 - TransformStack#translateBack for Vec3i
2021-09-17 15:59:20 -07:00
Jozufozu
ca554f5993 F3+A
- Reloading chunks correctly reloads block entity instances
2021-09-17 14:20:35 -07:00
Jozufozu
0c6a75ade5 Always use discard 2021-09-16 20:53:35 -07:00
Jozufozu
7da64cded6 It renders stuff
- The lightmap moved
 - Begin to move away from access transformers
 - .textureManager -> .getTextureManager()
 - RIP cutout, saw that coming
2021-09-16 20:03:45 -07:00
Jozufozu
9976de110d Don't crash when block entities are placed
- Block entities got a huge refactor in 1.17, a lot of the old code needs to be rethought
2021-09-15 14:29:58 -07:00
Jozufozu
d67362cacd Minecraft already stores the projection matrix
mixins--
2021-09-15 14:27:51 -07:00
Jozufozu
d023b27ae8 It launches
- yeet the fog
 - update mixin compatibility level
2021-09-15 13:49:18 -07:00
0b2101c25d Fix obvious errors 2021-09-15 09:26:51 +02:00
2fc54ffbee Remap, update forge, minecraft and java 2021-09-15 09:14:30 +02:00
Jozufozu
0ed59a69ed fixup! Initial data/struct format refactor 2021-09-14 13:52:52 -07:00
Jozufozu
56cb4be580 Revert "Parallel light updates"
Caused a crash, likely related to the use of weak references

This reverts commit c68b2bbf91.
2021-09-14 13:19:52 -07:00
Jozufozu
cc5949a4bb LightPacking utility class 2021-09-14 13:17:13 -07:00
Jozufozu
555cc2e57e Initial data/struct format refactor
- Inspired by jellysquid3's vertex sinks
 - More robust/extensible solution for data writes
2021-09-12 14:49:00 -07:00
Jozufozu
c79084ce57 Parallel light updates 2021-09-12 10:29:29 -07:00
Jozufozu
2ed8c6e2e5 Optimize imports 2021-09-12 09:41:45 -07:00
Jozufozu
aa83cd5c60 Instancer interface
- Entire material/model system finally cleaned up
2021-09-12 09:40:36 -07:00
Jozufozu
b706936be1 Fix compat with optifine shaders, again 2021-09-09 15:30:50 -07:00
Jozufozu
98823e3cf1 Fix BeginFrameEvent not firing with sodium installed
- Rendering is still broken, that fix must come from within sodium
2021-09-09 14:07:35 -07:00
Jozufozu
7e65eaa00d Separate LightVolume and GPULightVolume
- LightVolumes now can act as a light cache with configurable size
 - More GridAlignedBB changes
 - Remove ILightUpdateListeners
 - Simplify pulley rendering using LightVolume
2021-09-08 15:48:49 -07:00
Jozufozu
1f7af0d8b2 Immutable view of GridAlignedBB 2021-09-04 19:57:32 -07:00
Jozufozu
c055873bac Moving light updates
- Better system for moving objects that want to receive light updates
 - LightProvider interface to better abstract light lookups
 - All light listeners use GridAlignedBBs
 - More utility in GridAlignedBB
2021-09-04 16:40:40 -07:00
Jozufozu
352608c2ae Light update convergence
- Move light update logic for all instances to use LightUpdater
 - Begin refactor of LightUpdater to account for moving listeners
2021-08-29 14:40:46 -07:00
Jozufozu
1be7d9a286 Merge branch 'dev' into next 2021-08-25 13:21:42 -07:00
Jozufozu
ae6d953c6b Restore single paramater scale function
- Now has default impl in TransformStack
 - MatrixTransformStack now only overrides xyz scale
2021-08-25 13:15:29 -07:00
Jozufozu
86dbed66af Instanced Minecarts
- Rotations in PartBuilder
 - BlockModels are always UNLIT_MODEL format
2021-08-25 12:53:43 -07:00
MehVahdJukaar
0b2e8834d8 Update TransformStack.java 2021-08-25 21:49:06 +02:00
MehVahdJukaar
e6c67fecc7 Update MatrixTransformStack.java 2021-08-25 21:40:35 +02:00
MehVahdJukaar
e541b6d449 Added 3 parameter scaling function
Simply adds a 3 parameter function to to MatrixTransformStack so a matrix can be scaled on different axis
2021-08-25 20:21:33 +02:00
Jozufozu
68ca281ee8 Interfaces and less log lines
- MateralManager, MaterialGroup, and InstanceMaterial are all interfaces
 - Separate (T)EI facing API from implementation
 - Comment out debug log in ModelPool
2021-08-23 22:34:27 -07:00
Jozufozu
d431318022 Errors and pools
- GlException and error checking WIP
 - Put all models within a material in a ModelPool
 - Instancers directly accept IModels
 - ModelPools are very WIP
2021-08-20 15:05:41 -07:00
Jozufozu
d41acf2bcf Storage clean-up
- Wrapper for sync objects
 - Compat layer for buffer storage
 - Don't get persistent buffers if they're not supported
2021-08-14 15:57:52 -07:00
Jozufozu
f82b9d2d23 Persistent buffers v1.5
- Add new sync function to GlBuffer
2021-08-14 13:33:17 -07:00
Jozufozu
5956fbfaa0 Merge branch 'dev' into shader-pipeline 2021-08-13 16:15:28 -07:00
Jozufozu
6374d6e369 Persistent buffers v1 2021-08-13 16:15:20 -07:00
Jozufozu
55537fb2af Better float array buffering 2021-08-13 13:35:18 -07:00