Commit Graph

2338 Commits

Author SHA1 Message Date
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
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
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
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
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
PepperCode1
9886dca1e2 Fix and simplify
- Fix #130
- Simplify Material and default FileResolution creation
- Add instancing to command block and TNT minecarts
- Add missing 440-460 GLSL versions
2022-05-20 21:14:31 -07:00
Jozufozu
f4e648c057 Cleaner compilation
- Check for errors immediately after loading shaders
   - Done through FileResolution
   - Add class SourceChecks to
 - Throw away GatherContextEvent, do everything on client init
 - Unify FileResolution and Resolver, PartialModel style
 - Pass around error reporter to detect errors during load
2022-05-17 20:22:23 -07:00
PepperCode1
be766ad606 Shaded shader
- Rename MaterialManager -> InstancerManager and Material ->
InstancerFactory
- Create Material class consisting of RenderType and shader files
- Make ModelSuppliers use Materials as keys instead of RenderTypes
- Move diffuse calculation from context shaders to material/shaded.vert
- Merge used templates directly into compilers and remove template
classes
2022-05-15 20:09:47 -07:00
PepperCode1
a11bf3537b Reduced to fragments
- Overhaul shader pipeline
  - Remove VertexType#getShaderHeader in favor of vertex-only "layout
shaders"
  - Remove program specs in favor of vertex-only "instance shaders"
  - Add API GLSL headers for vertex and fragment shaders that store
common values
  - Separate context shaders into vertex and fragment shader files
- Improve import handling
  - Ensure imports are not added more than once
  - Change regex for import directives to be more in line with C-style
directives
- Move some classes and GLSL files
2022-05-15 01:58:33 -07:00
PepperCode1
4c7b035f5d Instant legacy code
- Respect fog shape and type
  - Add uFogShape uniform
  - Add macro for current FogType
- Respect dimension constant ambient light when calculating diffuse
  - Add uConstantAmbientLight uniform
  - Redirect diffuse calculation to FLWDiffuse
  - Do not automatically include diffuse.glsl
- Fill CoreShaderInfoMap with info for vanilla and Forge core shaders
- Use try-with-resources when querying ResourceManager
- Move WorldProgram uniform uploading from bind to uploadUniforms
- Use correct layer when rendering bells (cutout -> solid)
- Update Starlight
2022-05-13 23:58:24 -07:00
PepperCode1
958188fc77 Clean up
- Remove OnlyIn annotations
- Replace JSR305 Nullable and Nonnull with Jetbrains Nullable and
NotNull
- Fix indentation in flywheel.mixins.json
- Organize imports
2022-05-11 18:42:31 -07:00
Jozufozu
be60eae9af Simplifications
- Inline a handful of interfaces that had limited use
 - Removed IndexedModel/VBOModel as a first step in refactoring model uploads
 - InstancedModels/GPUInstancers support multiple VAOs
 - Fix padding issue
2022-05-11 16:32:27 -07:00
Jozufozu
d5e9e044ec Refactor GPUInstancer to separate behavior
- Instancer VAO logic moved to InstancedModel
 - Refactor GlVertexArray for easier debugging
 - Sort of clean up BufferLayout
 - Padding items are broken, needs fix
2022-04-30 19:42:57 -07:00
Jozufozu
a336abe4f4 Stuff renders again
- RenderContext doesn't need to have RenderType
 - Pass RenderTypes separately, clean up refactor
2022-04-24 17:22:22 -07:00
Jozufozu
303a58b277 Better buffering
- Abstract ModelUtil.getBufferBuilder and .getBufferBuilderFromTemplate
 - BakedModelBuilder and WorldModelBuilder as parameter objects for getBufferBuilder
 - WorldModelBuilder supports IModelData
2022-04-19 15:08:41 -07:00