Commit Graph

2467 Commits

Author SHA1 Message Date
PepperCode1
d3d5797fd3 Merge branch '1.18/batching-stage-support' into 1.18/next
Conflicts:
	src/main/java/com/jozufozu/flywheel/backend/Backend.java
	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/DrawBuffer.java
	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java
	src/main/java/com/jozufozu/flywheel/config/FlwConfig.java
	src/main/java/com/jozufozu/flywheel/core/hardcoded/ModelPart.java
	src/main/java/com/jozufozu/flywheel/core/model/SimpleMesh.java
2022-09-16 13:54:45 -07:00
PepperCode1
360ed4aa29 State restoration confusion
- Do not wrap BeginFrameEvent and RenderStageEvent with GL restore state
- Move GL state restoration into InstancingEngine
- Remove BufferUploaderMixin
- Add binding enum values to GlBufferType
- Remove debugNormals config
- Rename some occurrences of "world" to "level"
2022-09-16 13:32:13 -07:00
Jozufozu
cab922f187 Reorganize/rename
- No more set in builders
 - Move generated components to backend packages
 - Fix code organization
2022-09-15 12:37:18 -07:00
Jozufozu
03c2df4664 Instandirect
- Finishing touches on the unification
2022-09-12 22:32:30 -07:00
Jozufozu
cab7aff9c3 Fresh loaded entities here!
- Remove loaded chunk check from entity instance manager
2022-09-06 08:49:48 -07:00
Jozufozu
bf03f084c3 Inderinstanced 2022-09-06 00:48:00 -07:00
PepperCode1
5ac6065205 Memcpy: Batching Edition
- Add BatchedMeshPool
- Rename MeshPool to InstancedMeshPool
- Rename/remove/add methods to VertexList/ReusableVertexList
2022-08-24 17:51:24 -07:00
Jozufozu
61c2c76b47 Back-and better than ever
- Move BackendType to backend package
 - BackendType is now an interface whose implementors must be registered
2022-08-22 22:17:36 -07:00
PepperCode1
d7613fc5e4 Add batching stage support 2022-08-22 20:00:21 -07:00
Jozufozu
94bd6f4b98 Merge branch '1.18/culling' into 1.18/next
# Conflicts:
#	build.gradle
#	src/main/java/com/jozufozu/flywheel/Flywheel.java
#	src/main/java/com/jozufozu/flywheel/backend/Loader.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceWorld.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingDrawTracker.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/MeshPool.java
#	src/main/java/com/jozufozu/flywheel/core/compile/ProgramCompiler.java
#	src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java
#	src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java
#	src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java
#	src/main/java/com/jozufozu/flywheel/mixin/matrix/Matrix3fMixin.java
#	src/main/java/com/jozufozu/flywheel/mixin/matrix/Matrix4fMixin.java
2022-08-22 17:18:13 -07:00
Jozufozu
04d291e01b Merge ease 2022-08-22 15:33:03 -07:00
Jozufozu
57f6a48969 One liners
- Fix nothing rendering + gl error spam when renderdoc is not attached
 - Fix fog rendering incorrectly with indirect
2022-08-21 23:02:43 -07:00
PepperCode1
d3c280d298 Fix flickering with batching
- Call syncPoint before submitting tasks
- Reset DrawBuffer even if it has no vertices when drawing
2022-08-21 20:56:22 -07:00
Jozufozu
9a4cfbe47c Cool Command Captures/Pauses
- Add frustum debug utility
 - Fix scaling for transformed bounding spheres
2022-08-21 17:35:43 -07:00
Jozufozu
f84b169bd7 Indirectly packed
- Use glsl structs to pack vec/mat data in ssbos
 - Support RenderStages
 - Dynamically sized draw storage
2022-08-21 16:47:15 -07:00
Jozufozu
ebef176089 Dynamically indirect
- Indirect engine now only allocates as much memory as it needs
2022-08-20 20:50:26 -07:00
PepperCode1
8bea467409 BatchingTransformManager
- Rename BatchingDrawManager to BatchingTransformManager
- Rename BatchDrawingTracker to BatchingDrawTracker
- Move BatchDrawingTracker from BatchingTransformManager to
BatchingEngine
- Do not prepare DrawBuffer if number of vertices is 0
- Add DrawBuffer#isPrepared
- Add checks to DrawBuffer methods
- Remove commented code from CPUInstancerFactory
2022-08-20 19:12:44 -07:00
PepperCode1
ba30aca869 BatchingDrawManager
- Merge BatchLists, BatchedModel, and some parts of BatchingEngine into
BatchingDrawManager for consistency with instancing code
- Have InstancingEngine accept the max origin distance as a constructor
parameter
- Rename TransformSet to TransformCall
2022-08-19 17:24:13 -07:00
PepperCode1
2fe69350ef No more leaks
- Free all DrawBuffers on renderer reload
- Add flw.debugMemorySafety flag to detect leaked untracked MemoryBlocks
- Replace VertexListProviderRegistry with static methods in
VertexListProvider and a VertexFormatMixin
- Make the DrawBuffer constructor accept a VertexFormat instead of a
RenderType
- Merge TStack into TransformStack
- Move all duck interfaces/extensions to extension package
- Make mixin style more consistent
2022-08-17 16:20:31 -07:00
Jozufozu
cfa79ec550 MeshP... InstancedMo... DrawC... RenderLists refactor
- RenderLists -> InstancingDrawManager, keeps track of:
  - Uninitialized models
  - All Instancers
  - All DrawCalls via DrawSet
  - All MeshPools
 - One MeshPool is now locked to a single VertexType
 - DrawCall binds instance attributes to avoid making assumptions about mesh attribute count
 - Yeet crumbling
 - Simplify GPUInstancerFactory
2022-08-17 14:58:46 -07:00
Jozufozu
bcaf36c48c Sparse instance updates
- Use MemoryBlock in IndirectBuffers
2022-08-16 23:43:56 -07:00
PepperCode1
bb7d971ebe Merge branch '1.18/dev' into 1.18/next
Conflicts:
	.github/ISSUE_TEMPLATE/bug_report.yml
	gradle.properties
	src/main/java/com/jozufozu/flywheel/backend/instancing/DrawBuffer.java
	src/main/java/com/jozufozu/flywheel/mixin/RenderTypeMixin.java
2022-08-16 10:48:46 -07:00
PepperCode1
832c94f2ba Lazily instantiate DrawBuffers
- Iris/Oculus create wrapper RenderTypes whose DrawBuffers are never
used. Creating the DrawBuffer on retrieval solves this inefficiency.
- Add 1.18.2 as a Minecraft version to the issue template
2022-08-16 10:41:35 -07:00
Jozufozu
de09331e9b Merge branch '1.18/next' into 1.18/culling
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/api/struct/StructType.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancer.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/MeshPool.java
#	src/main/java/com/jozufozu/flywheel/core/hardcoded/ModelPart.java
#	src/main/java/com/jozufozu/flywheel/core/model/Mesh.java
#	src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java
#	src/main/java/com/jozufozu/flywheel/core/model/SimpleMesh.java
#	src/main/java/com/jozufozu/flywheel/core/structs/model/TransformedWriterUnsafe.java
#	src/main/java/com/jozufozu/flywheel/core/structs/oriented/OrientedType.java
#	src/main/java/com/jozufozu/flywheel/core/structs/transformed/TransformedStorageWriter.java
#	src/main/java/com/jozufozu/flywheel/core/structs/transformed/TransformedType.java
#	src/main/java/com/jozufozu/flywheel/core/uniform/ViewProvider.java
2022-08-14 23:29:01 -07:00
PepperCode1
9b39ba6c32 Hazardous light
- BatchingEngine no longer resets the light matrices
- Fix flw_constantAmbientLight always being 0
- Move code from FlwMemoryTracker#*Block methods into MemoryBlockImpl
and TrackedMemoryBlockImpl
- Convert LightVolume to use MemoryBlock
- Add FlwMemoryTracker#callocBuffer
- Add javadoc to deprecated FlwMemoryTracker#*Buffer methods
- Update Mesh javadoc
- Organize imports
2022-08-14 21:42:44 -07:00
Jozufozu
a1553b04e7 So unsafe it wrapped back around
- Convert buffer mapping to unsafe
 - Implement gpu memory tracking
 - Fix massive gl resource leak
 - Fix GPU memory leak caused by not deleting gl resources
 - Fix CPU memory leak caused by not deleting meshes in Models
 - Remove PersistentGlBuffer, merge GlBuffer and MappedGlBuffer
2022-08-13 23:18:44 -07:00
Jozufozu
251d599944 Indirectly transformed
- Indirect rendering supports TransformedType
 - Use single object to manage all ssbos
2022-08-13 21:28:39 -07:00
PepperCode1
70616d381a Fix crash with Rubidium when using batching
- Backport fix from 1.18/next
- Downgrade and lock ForgeGradle version to fix build
- Update Forge to match 1.18/next
- Bump version
2022-08-13 13:54:52 -07:00
PepperCode1
293d6ee59c Fix tracked MemoryBlocks 2022-08-11 15:48:08 -07:00
PepperCode1
f0823af00f Wait, it's all unsafe? Always has been.
- Create MemoryBlock utility for easier management of memory allocation
- Replace most usage of direct ByteBuffer with MemoryBlock
- Remove all usage of Mojang's MemoryTracker
- Simplifier StructWriter
- Rename some classes and packages
2022-08-10 20:47:53 -07:00
Jozufozu
c94a0934e3 Condensing culling
- Adapt compilers to work with arbitrary instance types
 - Use single compiler for all draw shaders
 - Temp solution for instanced array attributes
 - Introduce pipeline shaders
2022-08-09 15:38:56 -07:00
PepperCode1
6913a34443 Vertex format refactor
- Use memCopy for instanced mesh buffering
- Remove VertexWriter
- Add VertexListProvider
- Add VertexListProviderRegistry to allow vanilla VertexFormats to
create VertexLists
- Add ReusableVertexList that allows setting the pointer and vertex
count
2022-08-09 11:25:26 -07:00
Jozufozu
03f6125c68 Separate shader logic and fix rendering errors
- Batch IDs are stored in a separate buffer
 - Bounding spheres in draw command buffer, subject to change
 - Guard shader api files
 - Generate complete header for compute culler compiler
 - Move Frustum UBO to uniform shader/provider
2022-08-06 17:17:46 -07:00
Jozufozu
63dc8ee923 Functional frustum filter
- Manually fix alignment issue
 - Align UBO size to 16
 - Manual frustum ubo upload
2022-08-05 21:53:21 -07:00
Jozufozu
9d657aed40 Things on the screen
- Specialize MeshPool for the indirect engine
 - Temporarily force the engine to be indirect
 - Fix compilation issues with test shaders
 - VertexAttribute supports DSA
 - Fix Miniball issues in dev-env
 - VertexList implements PointSet for use with Miniball
 - Meshes store their bounding spheres
 - Add hook/system property to load renderdoc on client launch
 - StructTypes provide separate StorageBufferWriter for indirect
2022-08-05 10:51:07 -07:00
Jozufozu
6234df6440 Culling experiments 2: not testing the GPU
- Skeleton for compute shader culling/indirect rendering
2022-07-29 21:46:09 -07:00
Jozufozu
4ec1f8eaf3 Culling experiments
- Cull updates based on the view frustum.
 - Instances check themselves against a FrustumIntersection object
 - Make GlProgram not abstract
 - Leave in small debug rendering experiment
2022-07-29 21:19:44 -07:00
PepperCode1
ed3aca8bfc A fresh batch of refactoring
- Replace ModelTransformer with modular pipeline that closely resembles
the instancing pipeline
  - StructTypes and Materials now provide a VertexTransformer that
mutates a MutableVertexList
- Rewrite all model building to make it cleaner, more flexible, and
easier to use
- Add SimpleMaterial.GlStateShard for easier control over GL state
- Rename and move some classes
2022-07-29 15:58:34 -07:00
Jozufozu
9173ab8b4d Introducing the Apple Pointer
- Support vertexAttribIPointer
2022-07-23 18:39:09 -07:00
Jozufozu
0360c1faf8 Making materials matter more
- Materials are given the opportunity to setup/clear render state
 - Materials bind textures
 - Compile all combinations of shader components at load
 - Drastically simplify compilation context objects
 - Material shaders control cutout and fog
 - Remove all GameState related classes
 - Remove CoreShaderInfoMap
 - Sneaky optimization to instance storage
 - Simplify RenderLists
2022-07-23 18:18:48 -07:00
PepperCode1
d0c6669a49 Fragments of utility
- Give material fragment shaders a use
  - Add new variables to api/fragment.glsl
  - Add flw_initFragment to context shaders
- Add flw_vertexOverlay
- Normalize flw_vertexLight
  - Values are now [0, 1] where 0 is no light and 1 is max light
  - All light values sent to layout shaders and instance shaders are now
[0, 15] and not normalized
  - Remove util/light.glsl
- Rename program samplers
- Add FileResolution.isWeak()
- Add BackendType.getShortName()
- Tweak default material
- Move ShaderField to parse package
- Organize imports
2022-07-23 17:53:57 -07:00
Jozufozu
e43261302a Merge remote-tracking branch 'origin/1.18/next' into 1.18/next
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/api/material/Material.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java
#	src/main/java/com/jozufozu/flywheel/core/BasicModelSupplier.java
#	src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java
#	src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java
#	src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java
#	src/main/java/com/jozufozu/flywheel/vanilla/MinecartInstance.java
#	src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxInstance.java
#	src/main/resources/flywheel.mixins.json
2022-07-22 17:48:40 -07:00
Jozufozu
808933bfc3 Uniformly incomplete
- Initial work on uniform buffer registry
 - Setup skeleton for ComponentRegistry
 - InstancingEngine is no longer generic about the program
 - ProgramCompiler considers ContextShaders as input
 - Support weak file resolutions
 - Temporary GLSL version bump to ease UniformProvider growing pains
 - Centralize component shaders to Components
2022-07-22 17:24:41 -07:00
Jozufozu
84edbbe0f4 Little JOML
- Only bundle the small subset of JOML that Flywheel will actually use
2022-07-22 16:56:05 -07:00
PepperCode1
14d3949134 A Performance on the (Render)Stage
- Add RenderStage enum for better control over when a Material should be
rendered
  - Add getRenderStage method to Material
  - Replace RenderLayerEvent with RenderStageEvent
- Pass more information to RenderContext including camera and projection
matrix
- Pass RenderContext instead of Camera to all beginFrame-related methods
  - Remove RenderContext.CURRENT
- Remove FrustumMixin and CameraMixin
- Remove default BasicModelSupplier constructor
- Convert Material to interface and create SimpleMaterial implementation
- Move API instancer classes to instancer package
- Organize imports
2022-07-22 16:41:39 -07:00
Jozufozu
92c017d680 Small tidying
- Move RenderTypeExtension to util
 - Avoid creating unnecessary material objects in Shuklers
 - Remove vestigial classes
2022-07-19 10:59:29 -07:00
Jozufozu
4405f92639 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/Flywheel.java
#	src/main/java/com/jozufozu/flywheel/backend/Backend.java
#	src/main/java/com/jozufozu/flywheel/backend/Loader.java
#	src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/AbstractInstance.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java
#	src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchedMaterialGroup.java
#	src/main/java/com/jozufozu/flywheel/core/model/BakedModelBuilder.java
#	src/main/java/com/jozufozu/flywheel/core/model/Bufferable.java
#	src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java
#	src/main/java/com/jozufozu/flywheel/core/model/WorldModel.java
#	src/main/java/com/jozufozu/flywheel/core/model/WorldModelBuilder.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertexList.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertexListUnsafe.java
#	src/main/java/com/jozufozu/flywheel/core/vertex/PosTexNormalVertexListUnsafe.java
#	src/main/java/com/jozufozu/flywheel/mixin/FrustumMixin.java
2022-07-19 00:19:50 -07:00
Jozufozu
78839fe7eb Too much fun with boids
- Fix tickable instances ticking while paused
 - Fix CME on effect origin shift
 - ExampleEffect is now boids fireflies
 - Better tick/update load distribution with small instance counts
2022-07-18 23:44:30 -07:00
Jozufozu
1fe8297e72 Freestyle instances
- Add Effect instancing
   - Allows mods to create visual effects without (block) entities
   - One effect object maps to many AbstractInstances
   - Effect objects are expected to exist in isolation
 - Refactor InstanceManager to be composable about how its instances are stored
   - EffectInstanceManager uses this to provide a one to many topology
   - This is in need of more iteration, and more aspects of InstanceManager should be made composable in the future
2022-07-17 16:01:30 -05:00
PepperCode1
418672c065 Final fix-ups
- Revert mods.toml version to ${file.jarVersion}
- Fix license not being added to built jars
- Rename LICENCE.md to LICENSE.md
2022-07-15 19:29:42 -07:00