Commit Graph

2573 Commits

Author SHA1 Message Date
Jozufozu
1bd4c4f6cb Non-uniform un-provider
- Delete UniformBuffer on renderer reload to fix crash when switching
  backend to off
- Use library method for getting boolean property (ty pepper!)
2023-04-16 17:20:32 -07:00
Jozufozu
51cbfbc75a Batch in action
- Rename TransformSet -> BatchingStage
- Inline BatchingTransformManager into BatchingEngine
- Reuse one Plan object for each DrawBuffer used by a stage.
- Separate DrawBuffer acquisition from marking as active.
- Remove some unused methods in BatchingDrawTracker
- Rename variables in AnimationTickHolder
- Make flw.loadRenderDoc=false behave as expected.
2023-04-16 15:23:14 -07:00
Jozufozu
e03590b270 Smaller batches
- Extract TransformSet to full class
- Move planning code into BatchingTransformManager
- Reduce exposure BatchingTransformManager of internals
- Comment out WaitGroup log :ioa:
- Move ceilingDiv to MoreMath
- Use dynamic chunk size for TransformCalls
2023-04-16 12:46:20 -07:00
Jozufozu
cb74fa4603 Merge branch '1.18/plan' into 1.18/next
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/api/backend/Engine.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/batching/BatchingEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/batching/TransformCall.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancingEngine.java
#	src/main/java/com/jozufozu/flywheel/handler/EntityWorldHandler.java
#	src/main/java/com/jozufozu/flywheel/impl/instancing/InstancedRenderDispatcher.java
#	src/main/java/com/jozufozu/flywheel/impl/instancing/manager/InstanceManager.java
#	src/main/java/com/jozufozu/flywheel/impl/instancing/storage/AbstractStorage.java
#	src/main/java/com/jozufozu/flywheel/impl/visualization/VisualWorld.java
#	src/main/java/com/jozufozu/flywheel/mixin/instancemanage/InstanceRemoveMixin.java
#	src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualAddMixin.java
#	src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualUpdateMixin.java
2023-04-15 15:27:18 -07:00
Jozufozu
0861d8bfd2 Needs to wait
- Commit to non-blocking waitgroup impl
- Debug log when await takes suspiciously long
2023-04-14 17:14:12 -07:00
Jozufozu
f29dcbc486 Weaving threads
- Restore WaitGroup abstraction
- Simplify WaitGroup to make proper use of atomics
- Fix logic error in ParallelTaskExecutor causing task counter to go
  below zero when executing main thread tasks
- Use ConcurrentHashMap in models to allow parallel access
- Reduce chunk size in RunOnAllPlan
- Only queue in InstanceManager
- Defer syncPoint within renderStage
- AbstractStorage return immutable view for tickable/dynamic instances
- Process InstanceManager queues off-thread
2023-04-13 15:17:02 -07:00
PepperCode1
361cb5a1d9 Clean up mixins and fix changes from last commit
- Add FixNormalScalingMixin from Create
- Fix VisualizedRenderDispatcher#tryAddBlockEntity
- Fix flywheel.sodium.mixins.json using wrong plugin class name
2023-04-13 11:36:05 -07:00
PepperCode1
b4cef0b5c9 Add Rubidium compatibility
- Add proper Rubidium compatibility on our side
- Overwrite methods in Rubidium's FlywheelCompat class with stubs to
prevent crashes
2023-04-13 10:16:33 -07:00
PepperCode1
2847ad28ed Fix rendering far from world origin
- Make BatchingEngine use a shifting render origin
- Make frustum checks relative to the render origin
- Improve AbstractEntityVisual#isVisible to be closer to vanilla
- Move render origin implementation code to AbstractEngine
2023-04-10 14:30:08 -07:00
Jozufozu
76dcf3fed6 The botched batching plan
- Directly port over submitTasks to use Plan
- Could probably make better use of the plan primitives, but oh well
- Remove Engine#beginFrame
2023-04-09 14:37:12 -07:00
Jozufozu
1627874e33 Putting our plan to the test
- Implement plan simplification
- Add unit tests for plan execution and simplification
2023-04-09 14:15:29 -07:00
PepperCode1
05458d01d2 Flywheel's Visualized Rendering
- Rename Instance -> Visual (and all related elements)
- Rename InstancePart -> Instance (and all related elements)
- Move classes in package lib.format -> lib.vertex
- Rename Formats -> VertexTypes
- Remove SimpleLazyModel#setMaterial
- Remove unnecessary newlines in some files
2023-04-09 12:00:03 -07:00
Jozufozu
fb11f29010 Parallel planning primitives
- Engines/InstanceManagers now provide Plans for frames/ticks
- TODO: batching is broken
- TODO: plan caching
- Add Plan interface which can be used to compose complex systems
  of parallel execution
- Add Synchronizer to facilitate barriering
- Remove WorkGroup
- Summary of different primitives below, names need work :ioa:
  - BarrierPlan: executes one plan then another
  - NestedPlan: executes many plans at once
  - OnMainThreadPlan: waits for a syncPoint to execute
  - RunOnAllPlan: dispatches work over a Supplier<List>
  - SimplePlan: executes many Runnables at once
  - UnitPlan: does nothing
2023-04-08 18:08:53 -07:00
PepperCode1
72b5968305 More clean up 2023-04-07 16:01:03 -07:00
Jozufozu
945ed9a1e4 Simple storage staging
- Use one concurrent queue of transactions in InstanceManager
2023-04-07 00:14:39 -07:00
Jozufozu
ab8ab8dbd4 How to handle InstancePart abstraction
- Pull InstancePart into an interface
- Add Handle interface to opaquely notify an instancer something has
  changed or was deleted.
- Remove notify* methods from Instancer
- Remove stealInstance TODO: find a better way to accomplish that
- Track removals/changes through bitsets
- Deprecate InstancePart#copy
- Move InstanceManager#canCreateInstance to Storage#willAccept
2023-04-06 14:48:51 -07:00
PepperCode1
391adfef1a Instance Refactor II 2023-04-05 18:03:25 -07:00
Jozufozu
227aef509b It's-a me
- Lots of plumbing
- Storages/InstanceManagers directly reference the Engine
- Construct Instances with InstanceContext record
  - Stores InstancerProvider as well as Vec3i renderOrigin
- AbstractInstance stores renderOrigin
- InstancerProvider#getOriginCoordinate -> RenderDispatcher#renderOrigin
- Update some styling/documentation
- Inline InstancingControllerHelper create functions
- Use explicit functional interface instead of BiFunction in Controllers
2023-04-04 21:29:36 -07:00
Jozufozu
7326bdd3c2 Stripping instances
- Remove #removeNow and #getWorldPosition from Instance
- Add #distanceSquared for use in update limiting
- Refactor DistanceUpdateLimiter to directly accept distance squared
- Remove proper name from backend
- Misc. cleanup
  - ifs without braces
  - some method names
2023-04-04 17:17:06 -07:00
PepperCode1
632240abf0 Instance Refactor I 2023-04-04 12:36:54 -07:00
PepperCode1
2c010ffa06 Registry refactors and namespaced backends 2023-04-02 23:58:28 -07:00
PepperCode1
59773125b2 Update light updates
- Remove NetworkLightUpdateMixin and associated code
- Do not defer level renderer reload when changing backend
- Remove RenderWork
- Reset DrawBuffer on free
- Move CoordinateConsumer inside ImmutableBox
- Rename GridAlignedBB -> MutableBox
- Rename LightListener#isListenerInvalid -> #isInvalid
- Move package light -> lib.light
- Move package util.box -> lib.box
2023-04-01 11:01:24 -07:00
PepperCode1
806e861edc Reorganization II 2023-03-30 16:52:51 -07:00
PepperCode1
8cc32b49f2 Reorganization I
- Package `backend.gl` -> `gl`
- Package `core.source` -> `glsl`
2023-03-30 12:59:09 -07:00
PepperCode1
e7fd1c6178 Use external JOML
- Use JOML from its official Maven source instead of bundling classes
- Organize imports
2023-03-29 22:03:28 -07:00
Jozufozu
3900297186 We have planes at home
- Don't use FrustumIntersection as intermediary for writing planes in
  indirect rendering.
- Move all computation and writing to FlwUtil.
- Remove corresponding methods from JOML class.
2023-03-29 20:17:22 -07:00
PepperCode1
d6ec7c0e5c Minor mixin organization
- Move LevelRendererInstanceUpdateMixin to instancemanage package
- Ensure flywheel$ prefix is added to all mixin injector methods
2023-03-29 18:32:08 -07:00
Jozufozu
91dfc4789d So many draws
- Sort draws in an IndirectDrawSet by RenderStage and Material
- Loop through ahead of time and determine what individual draws can be
  grouped together into a MultiDraw
  - Contiguous segments with the same RenderStage and Material can be
    merged into one MultiDraw call
- Add material ID lookup for sorting purposes
2023-03-29 14:11:29 -07:00
Jozufozu
d3eb717e44 Missed error from dev -> next merge
- Need to restore element array buffer state too to avoid segfault in
  instancing.
2023-03-28 17:52:10 -07:00
Jozufozu
5658aebc88 Merge branch '1.18/ubershaders' into 1.18/next
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/api/material/Material.java
#	src/main/java/com/jozufozu/flywheel/api/vertex/VertexType.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java
#	src/main/java/com/jozufozu/flywheel/core/material/SimpleMaterial.java
#	src/main/java/com/jozufozu/flywheel/core/structs/oriented/OrientedType.java
#	src/main/java/com/jozufozu/flywheel/core/structs/transformed/TransformedType.java
#	src/main/java/com/jozufozu/flywheel/core/uniform/ViewProvider.java
#	src/main/java/com/jozufozu/flywheel/util/FlwUtil.java
2023-03-28 16:37:57 -07:00
Jozufozu
6bacc6ea42 No hacks here no sir
- Ubershaders working on instancing
- Just declare a uniform and fetch/set it right before we draw
2023-03-28 16:20:01 -07:00
Jozufozu
3dd74fe4b2 Merge branch '1.18/dev' into 1.18/next
# Conflicts:
#	.github/ISSUE_TEMPLATE/bug_report.yml
#	build.gradle
#	gradle.properties
#	src/main/java/com/jozufozu/flywheel/api/Material.java
#	src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java
#	src/main/java/com/jozufozu/flywheel/backend/gl/buffer/MappedBuffer.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchedMaterial.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchedMaterialGroup.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/CPUInstancer.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstanceManager.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/ElementBuffer.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancer.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancedMaterial.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancedMaterialGroup.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/model/ArrayModelRenderer.java
#	src/main/java/com/jozufozu/flywheel/backend/model/FallbackAllocator.java
#	src/main/java/com/jozufozu/flywheel/backend/model/IndexedModel.java
#	src/main/java/com/jozufozu/flywheel/backend/model/ModelPool.java
#	src/main/java/com/jozufozu/flywheel/backend/model/VBOModel.java
#	src/main/java/com/jozufozu/flywheel/core/QuadConverter.java
#	src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingGroup.java
#	src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java
#	src/main/java/com/jozufozu/flywheel/core/hardcoded/ModelPart.java
#	src/main/java/com/jozufozu/flywheel/core/model/BlockModel.java
#	src/main/java/com/jozufozu/flywheel/core/model/Model.java
#	src/main/java/com/jozufozu/flywheel/core/model/WorldModelBuilder.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/AbstractVertexList.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertexList.java
#	src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java
#	src/main/java/com/jozufozu/flywheel/mixin/ClientMainMixin.java
#	src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java
#	src/main/resources/flywheel.mixins.json
2023-03-28 13:22:53 -07:00
PepperCode1
95bd36b90d TaskEngine and batching changes
- Rename TaskEngine to TaskExecutor
- Make TaskExecutor extend Executor
- Simplify ParallelTaskExecutor
- Move WorkGroup code to separate class
- Fix CPUInstancers being updated too late
- Do not unnecessarily clear memory when preparing DrawBuffer
- Simplify BatchingDrawTracker and DrawBufferSet by storing RenderType
in DrawBuffer
- Move all additional Mojang matrix operations to MatrixUtil and expose
fields using accessors
- Remove Color
- Remove WeakHashSet
2023-03-28 10:58:22 -07:00
Jozufozu
39423090b4 Resolved to ashes
- FileResolution was implemented to support a two-pass
  preprocessor/compiler.
- The new architecture no longer needs its functionality.
- It doesn't make sense to have implementors individually apply the
  "checks" to ensure their components are sound.
- The component checking code
- Remove FileResolution, replace all references with ResourceLocation
- Small refactor to UniformBuffer to put everything into one UBO
- Remove BlockEntityRenderDispatcherAccessor
- Rename component resource location getters for consistency
- Small cleanups here and there
- Consolidate SourceChecks to SourceChecks.java for future use
2023-03-26 00:39:35 -07:00
PepperCode1
6add6c43b1 Various clean up
- Color component methods in vertex lists now use floats instead of
bytes
- VertexList no longer implements PointSet
- Return better defaults for unused attributes in vertex list
implementations
- Slightly optimize vertex list implementations
- Fix ModelUtil#convertBlockBuffer allocating wrong number of bytes for
destination data
- Remove combined color methods in vertex lists
- Remove ReusableVertexList#vertexStride
- Remove default methods in VertexType
- Rename Mesh#close to Mesh#delete
2023-03-25 20:35:17 -07:00
Jozufozu
80001f0037 Indirectly materialized
- Pass material IDs through the indirect draw buffer
- Turns out buffers can be bound to both storage and draw indirect
- Use indexOf in ComponentRegistry to determine IDs
- Remove World/Crumbling Program and move sampler binding to
  ContextShader setup
2023-03-25 17:54:34 -07:00
Jozufozu
d197fe0a4f Uniforms!!!
- Basic idea is to let each mode get one uniform shader
- Uniform shader provides a struct with the mod's id as its name
- All structs get placed into one (1) ubo
- Uniforms are implicitly available in all shaders
- Add GlslUniformBlock for new codegen in UniformComponent
- Condense old uniform providers into one object
- ShaderStructs capture the optional variable name in struct definitions
- Change RecursiveIncluder to interleave root components with included
- GlProgram calls UniformBuffer#sync
2023-03-25 13:41:45 -07:00
PepperCode1
9a88bb96ab Move RenderStage from Material to InstancerManager#instancer 2023-03-24 17:04:22 -07:00
PepperCode1
bbcf019bc2 Remove InstancerFactory 2023-03-24 16:15:29 -07:00
PepperCode1
f370e85d6d Increment version 2023-01-13 16:08:32 -08:00
PepperCode1
83a5723420 Fix IndexedModel allocating incorrect amount of bytes
- model.size() returned the byte size relative to the model's
VertexType, but the byte size relative to the passed VertexType is
needed instead
2022-12-31 14:34:59 -08:00
Jozufozu
9a746f700d Finally have time off
- Attempt at componentizing ShaderCompiler, starting with Includer
 - Begin refactoring uniform providers
 - Context as an interface
 - Separate ContextSet objects for Pipeline shaders and Culling shaders
 - Inline ProgramAssembler
 - Replace StringUtil#trimEnd with String#stripTrailing
 - Add StringUtil#trimPrefix and #trimSuffix
2022-12-20 21:20:08 -08:00
Jozufozu
23c0ef6f33
Update changelog.txt 2022-12-14 09:16:21 -08:00
PepperCode1
27f2181752
Merge pull request #162 from marchermans/1.18/dev
Switch to the block vertex format for instancing
2022-12-08 15:05:16 -08:00
Marc Hermans
e04ae88073
Switch to the block vertex format. 2022-12-01 21:24:11 +01:00
PepperCode1
f56d0f9024 Models are (actually) temporary
- Call Model#delete on instancer delete
- Add constraint to modelSupplier in Material#model
- Fix memory leak in ModelPart
- Add ArrayModelRenderer#getModel
2022-11-22 13:04:03 -08:00
PepperCode1
f6d5ed01e7 A bit of backporting
- Backport general changes from 1.19
- Fix Javadoc of PartialModel
- Remove default Model#getType implementation
- Increment version to 0.6.8
- Update Parchment
2022-11-10 16:30:30 -08:00
PepperCode1
e328a270e2 Models are temporary
- Add Model.delete
- Allow BlockModel.createEBO to be called more than once for a single
instance
- Clear cache on QuadConverter.delete
2022-11-10 12:43:26 -08:00
Jozufozu
72a05ad35d State your state
- Address a few bugs with rubidium
 - Ignore EBOs when restoring state
 - ElementBuffer deals in raw gl handles
 - Document all state changes/restores/resets

Co-authored-by: PepperCode1 <44146161+peppercode1@users.noreply.github.com>
2022-11-10 12:39:01 -08:00
Jozufozu
ef568d22f7 Lyft shaders
- The ubershaders actually compile, but uniforms/material ids are broken
 - Convert vertex/fragment adapter components into generic builder
 - Support arbitrary adapted function signatures
 - Make an attempt at cleaning up generation code
2022-10-13 18:00:59 -07:00