Commit Graph

2602 Commits

Author SHA1 Message Date
PepperCode1
59773125b2 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
806e861edc Reorganization II 2023-03-30 16:52:51 -07:00
PepperCode1
8cc32b49f2 Reorganization I
- Package `backend.gl` -> `gl`
- Package `core.source` -> `glsl`
2023-03-30 12:59:09 -07:00
PepperCode1
e7fd1c6178 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
3900297186 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
d6ec7c0e5c 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
91dfc4789d 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
d3eb717e44 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
5658aebc88 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
6bacc6ea42 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
3dd74fe4b2 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
95bd36b90d 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
39423090b4 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
6add6c43b1 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
80001f0037 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
d197fe0a4f 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
9a88bb96ab Move RenderStage from Material to InstancerManager#instancer 2023-03-24 17:04:22 -07:00
PepperCode1
bbcf019bc2 Remove InstancerFactory 2023-03-24 16:15:29 -07:00
PepperCode1
f370e85d6d Increment version 2023-01-13 16:08:32 -08:00
PepperCode1
83a5723420 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
9a746f700d 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
23c0ef6f33
Update changelog.txt 2022-12-14 09:16:21 -08:00
PepperCode1
27f2181752
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
e04ae88073
Switch to the block vertex format. 2022-12-01 21:24:11 +01:00
PepperCode1
f56d0f9024 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
f6d5ed01e7 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
e328a270e2 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
72a05ad35d 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
ef568d22f7 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
7a080a5538 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
99e4105e94 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
28e16a7810 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
36140623d3 Include new versions in bug report template 2022-09-28 20:05:41 -07:00
PepperCode1
098cb3ee70 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
79464361d2 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
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