Commit Graph

2598 Commits

Author SHA1 Message Date
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
PepperCode1
17d8688fd7 Fix mixins sometimes not remapping
- Compress logo image
2022-07-15 09:42:14 -07:00
PepperCode1
a42c027b6f 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
0a671b8f43 Update changelog and bug report template 2022-07-11 20:55:01 -04:00
Jozufozu
d9cdd361cd One line update
- Add modrinth updateJSONURL
2022-07-11 14:36:54 -04:00
Jozufozu
f01e169954 Reading copy
- All vertex lists extend from AbstractVertexList, which handles copying the input
2022-07-11 14:08:07 -04:00
Jozufozu
faa5652c4c World building exercise
- Yoink the WorldModelBuilder and associated changes from 1.18/next
2022-07-10 19:04:30 -04:00
Jozufozu
273c99619f Oculus compatibility
- Rename OptifineHandler to ShadersModHandler
 - Rename functions to match fabric version
2022-07-10 18:08:59 -04:00
Jozufozu
c3b1a43beb One more thing...
- Missed a level param in LightVolume
 - Public removeAndMark
 - Remove batching warning
 - Bump forge and parchment builds
2022-07-10 15:22:02 -04:00
Jozufozu
055802160f Update light updates
- ... to address the nullpointer with create pulleys
 - LightListeners track their own levels
 - Remove BasicProvider and LightProvider
 - Rename MovingListener to better match functionality
 - Remove ListenerStatus in favor of a boolean
 - Instances keep track of their removal status and properly report it via LightListener#isListenerInvalid
 - Bump version - 0.6.4
2022-07-09 13:25:24 -04:00
Jozufozu
5657e8669e Structless instances
- Instance shaders define their own input variables
 - Input locations are transformed during compilation based on vertex type
2022-07-09 11:32:28 -04:00
Jozufozu
f058b37b13
Update changelog.txt 2022-07-08 12:37:54 -07:00
Jozufozu
0e37a0586f Batch 2
- Re-implement batching under new api topology
 - Lots of duplicated code between instancing and batching, room for abstraction
 - StructTypes now require their type argument to extend InstancedPart
 - Fix crash when re-allocating drawbuffers
 - Disable crumbling pending refactor
 - Separate RenderDispatcher#beginFrame from RenderDispatcher#maintainOriginCoordinate
 - Inline OriginShiftListener
 - Refactor InstancedRenderDispatcher hooks
2022-06-30 14:29:35 -07:00
Jozufozu
e26195169f Closing the blinds
- Prevent LightUpdater from interacting with invalid levels.
 - Bump version - 0.6.3
2022-06-22 13:29:28 -07:00
Jozufozu
aa10930fa8 Misc. tweaks
- Drastically reduce stutter on origin shift (it's still bad)
 - GPUInstancers mark their buffers as dynamic
2022-06-20 19:26:39 -07:00
Jozufozu
1ab1c9e6f6 Better draw call organization
- InstancingEngine takes over tracking individual draw calls
 - Many draw calls are associated with a single ShaderState
 - Each ShaderState will bind one shader program
 - Make Material a record
 - Inline Renderable and move InstancedModel.Layer to DrawCall
2022-06-20 12:16:37 -07:00
Jozufozu
08fff1c125 A little of everything
- Rename InstanceData -> InstancedPart, and subclasses
 - Burger Fences
 - Fix GlStateTracker nuking vao element buffer bindings
 - GlVertexArray tracks element buffer bindings
 - Use vertexAttribPointer offset instead of ..BaseVertex
 - Setup code for better crumbling rendering
 - Move some logic into CoreShaderInfoMap
 - Simplify VertexWriter/VertexList
 - Prefer IEventBus#addListener to @SubscribeEvent
 - Stop using persistent buffers... for now
2022-06-19 23:25:44 -07:00
Jozufozu
d22f715f79 Simply struct
- Inline Instanced* and Batched* StructType
 - flw.dumpShaderSource need only be present
 - Make Backend's static fields screaming snake case
2022-06-09 13:51:50 -07:00
Jozufozu
1765aa74f8 Better buffer binding
- Directly call GlBuffer#bind before raw gl calls
 - Everything else is hidden now
 - GlStateTracker.State implements AutoCloseable for try-with-resources blocks
 - Wrap InstancedModel render calls in a GlStateTracker restore block
 - Improve EBO creation
 - Track CPU memory usage (wish java had ownership concepts)
 - Misc cleanups
2022-06-09 12:44:52 -07:00
PepperCode1
2632cd385c Crumbling away
- Fix and improve crumbling rendering
- Rename Batched to BatchedStructType and Instanced to
InstancedStructType
- Normalize flw_vertexNormal in context/common.vert
- Add TODO and FIXME comments
2022-05-22 14:28:38 -07:00