Commit Graph

796 Commits

Author SHA1 Message Date
Jozufozu
738514b86b Fresh loaded entities here!
- Remove loaded chunk check from entity instance manager
2022-09-06 08:49:48 -07:00
Jozufozu
07b694b635 Inderinstanced 2022-09-06 00:48:00 -07:00
PepperCode1
adb0b5c2a8 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
6436f0e9ba 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
6bb7ed8dc4 Add batching stage support 2022-08-22 20:00:21 -07:00
Jozufozu
4bb7c4bd48 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
46bd1a374f Merge ease 2022-08-22 15:33:03 -07:00
Jozufozu
0e6f249cd0 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
bf7332b7da 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
8833181cfe Cool Command Captures/Pauses
- Add frustum debug utility
 - Fix scaling for transformed bounding spheres
2022-08-21 17:35:43 -07:00
Jozufozu
564b0996f9 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
9b3c4d4992 Dynamically indirect
- Indirect engine now only allocates as much memory as it needs
2022-08-20 20:50:26 -07:00
PepperCode1
5d5cd19928 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
a29ba6e24a 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
72826f1de5 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
0c2a3af467 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
2910e33626 Sparse instance updates
- Use MemoryBlock in IndirectBuffers
2022-08-16 23:43:56 -07:00
PepperCode1
e7518d5230 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
06454a713f 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
3eb15fc84d 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
1a62916f32 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
4c3d8fa09f 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
56ded52193 Indirectly transformed
- Indirect rendering supports TransformedType
 - Use single object to manage all ssbos
2022-08-13 21:28:39 -07:00
PepperCode1
527d91b8ae 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
74cc6d903a Fix tracked MemoryBlocks 2022-08-11 15:48:08 -07:00
PepperCode1
5ca830963e 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
e7339dc7ef 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
5488c5ff22 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
a9ee85ff76 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
0a4fcf27d8 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
e00d5772c3 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
e42657cd8a Culling experiments 2: not testing the GPU
- Skeleton for compute shader culling/indirect rendering
2022-07-29 21:46:09 -07:00
Jozufozu
4f407d8659 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
83f4aaa4db 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
69de15d4de Introducing the Apple Pointer
- Support vertexAttribIPointer
2022-07-23 18:39:09 -07:00
Jozufozu
00af8bda2e 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
dd33c6f444 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
1a03b63406 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
55de2beabb 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
5e517a1bfe Little JOML
- Only bundle the small subset of JOML that Flywheel will actually use
2022-07-22 16:56:05 -07:00
PepperCode1
1c058018b4 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
dca2ba7605 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
0b228b9db9 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
9c61f57f5a 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
0786a3a2c5 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
2323e770d2 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
PepperCode1
2a715dfd5d Fix mixins sometimes not remapping
- Compress logo image
2022-07-15 09:42:14 -07:00
PepperCode1
dd18300b70 Scheme-a-version
- Fix Resources not being closed properly
- Change versioning scheme to match Create
- Add LICENSE to built jar
- Fix mods.toml version sync
- Move JOML code to non-src directory
- Update Gradle
- Organize imports
2022-07-15 00:00:54 -07:00
Jozufozu
768cc4ddba Update changelog and bug report template 2022-07-11 20:55:01 -04:00
Jozufozu
e499bfb98a One line update
- Add modrinth updateJSONURL
2022-07-11 14:36:54 -04:00