Commit Graph

641 Commits

Author SHA1 Message Date
Jozufozu
1e5f690072 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
6002bfafd9 Instance Refactor II 2023-04-05 18:03:25 -07:00
Jozufozu
e6248f502e 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
b8effd31a4 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
b65cb7eb7f Instance Refactor I 2023-04-04 12:36:54 -07:00
PepperCode1
4ac0adf703 Registry refactors and namespaced backends 2023-04-02 23:58:28 -07:00
PepperCode1
f2d55a5001 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
a1910f06d4 Reorganization II 2023-03-30 16:52:51 -07:00
PepperCode1
bd5a26f71f Reorganization I
- Package `backend.gl` -> `gl`
- Package `core.source` -> `glsl`
2023-03-30 12:59:09 -07:00
PepperCode1
a27fffca69 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
ba69b893c8 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
a526a48d23 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
6b9b2a9927 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
671e1a002c 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
e31575de3b 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
7e58849160 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
135f1e3fd2 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
e3464d8ee0 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
44b9a666c4 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
1e3729f96f 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
e7dd801379 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
3eae6be05d 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
7d49a0cc53 Move RenderStage from Material to InstancerManager#instancer 2023-03-24 17:04:22 -07:00
PepperCode1
36f97a79bb Remove InstancerFactory 2023-03-24 16:15:29 -07:00
PepperCode1
3034d3d9b5 Increment version 2023-01-13 16:08:32 -08:00
PepperCode1
d96ad156e1 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
4a1787ee94 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
f5acaeb1d7 Update changelog.txt 2022-12-14 09:16:21 -08:00
PepperCode1
8a64d56d6c 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
d3b09ecb14 Switch to the block vertex format. 2022-12-01 21:24:11 +01:00
PepperCode1
7fe2ca08c1 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
b76e8b1a89 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
edd6c736cf 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
98e4831b6e 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
0539a59da5 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
Jozufozu
d17cfc8533 Fix* the errors
- *make the errors understandable without actually solving them
 - Straighten out shader compilation/error generation
 - Interpret errors in generated code
 - Compilation returns a result type instead of throwing an exception
 - Still need to reimplement source checks?
 - Make error messages prettier
2022-10-11 20:16:15 -07:00
Jozufozu
d043076268 Taxi shaders
- Not *quite* ubershaders yet
 - Note: heavily broken
 - "Pull" based compilation
   - Sources are only ready when they are needed by the compiler
   - Compiler is responsible for import resolution
   - Compiler prepends file headers
 - Reduces need for FileResolution
   - May replace with ResourceLocations?
   - Not sure about the future of source checks
   - TODO: Lots of dead code left in FileResolution
 - PipelineShader -> Pipeline interface + Simple impl
   - Use Context object for assembler factory
2022-10-08 14:02:54 -07:00
Jozufozu
178d39d860 Consolidated compilation
- Note: heavily broken
 - Move all compilation logic into a single package
 - FlwCompiler is responsible for compilation
 - CompilationEnvironment generates combinations and performs analysis
 - Create source components for vertex/fragment ubershader codegen
 - More hacky glsl generation utils
 - Strip explicit uniform buffers from uniform shaders
2022-09-29 20:41:44 -07:00
PepperCode1
2c7a6abcb6 Include new versions in bug report template 2022-09-28 20:05:41 -07:00
PepperCode1
552c132512 Porting from all directions
- Diagonal-port restore state changes from 1.18/next
- Back-port buffer uploader changes and RenderLayerEvent dispatch point
change from 1.19/dev
- Make CrumblingRenderer return earlier if there is nothing to render
- Bump version
2022-09-21 15:34:58 -07:00
PepperCode1
cebcbcedcb Consists of inconsistency
- Make architecture of indirect engine and draw manager match that of
other engines and draw managers
2022-09-20 22:03:20 -07:00
PepperCode1
1583d3f393 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
94e792f25e 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
3c8ffa96da 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
dd535b9c6d Instandirect
- Finishing touches on the unification
2022-09-12 22:32:30 -07:00
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