Commit Graph

2450 Commits

Author SHA1 Message Date
Jozufozu
59a03ad811 More direct buffers
- Merge object and batch ID buffer.
- ShaderCompiler accepts a Compilation callback.
- Use callback to enable the conservative depth extension only in
  fragment shaders.
- Query subgroup size if available and use callback to set a compile
  definition in compute shaders.
2023-11-30 15:45:11 -08:00
PepperCode1
3a581bac79 Materials and You: Volume 1
- Add MaterialShaders
  - MaterialShaders must be registered
  - Materials are no longer registered
  - Material now returns a MaterialShaders instead of the locations of
each shader
- Rename MaterialIndices to MaterialShaderIndicies
- Improve MaterialShaderIndicies and move it to the backend package
- Use RegisterClientReloadListenersEvent instead of adding listeners
manually
2023-11-30 15:38:14 -08:00
Jozufozu
aa75e7c276 Spheres your cubes
- Use sphere-frustum intersection tests in visuals.
- Seems to be ~20x faster.
2023-11-29 20:10:13 -08:00
Jozufozu
e87eb4e371 A refined plan
- Clean up and improve functional interfaces used in Plans.
- Allow safely running TaskExecutor#sync* methods off-thread.
- Formalize the concept of "main thread" in task executor.
- Improve tests for main-thread plans.
2023-11-29 20:10:13 -08:00
PepperCode1
f72abf8e1d Re-reload
- Rename ReloadRenderersEvent to ReloadLevelRendererEvent
- Rename Engine#renderCrumblingInstances to #renderCrumbling
- Make all mixin classes package-private and abstract
- Make all event classes final and document which event bus they are
posted on
- Add EndClientResourceReloadEvent
  - Replace some usages of ReloadLevelRendererEvent with
EndClientResourceReloadEvent, including ModelHolder and ModelCache
- Always add all existing entities from world to
VisualizationManagerImpl on construction if level is instanceof Level
- Delete all VisualizationManagerImpls on resource reload
- Improve MemoryBlock utility
  - Add MemoryBlock#copyTo(MemoryBlock)
  - Remove MemoryBlock#reallocTracked and make #realloc create a tracked
block if and only if the existing block is tracked
  - Fix reallocating a debug memory block creating a regular memory
block
- Change BakedModelBufferer to only invoke the result consumer if the
data is not empty
- Improve BackendArgument
  - Fix classloading BackendArgument early causing it to return
incomplete suggestions
  - Always allow specifying namespace, allow matching only by path, and
always display suggested IDs with namespace
2023-11-29 20:03:26 -08:00
Jozufozu
7bae0f4d8c Bit off a bigger batch than I could chew
- Implement crumbling for batching engine.
- It's ugly! (the code)
- Need to support translucency sorting in batching.
  - Plumb RenderType#sortOnUpload through to DrawBuffer.
  - Allocate room in DrawBuffer for BufferBuilder to write indices.
  - Set nextElementByte on injectForRender.
- Remove RenderStage from DrawBuffer, isn't really needed.
- Make some fields public, so they can be accessed by BatchedCrumbling.
- Track TransformCalls in BatchedInstancer.
-
2023-11-28 17:06:48 -08:00
Jozufozu
21d7c26ad1 The boring way
- Just use vanilla's implementation for crumbling.
2023-11-27 12:42:41 -08:00
Jozufozu
f3f02963a7 Good enough for government work
- Move crumbling tbn calculation back to the fragment shader.
- Pass the center of the crumbling block position as a uniform.
- Calculate how to flip the crumbling texture such that it tiles well at
  corners in model space.
- Move ugly crumbling code to utility class and improve bucketing.
- Cache uniform locations in GlProgram.
2023-11-26 23:18:09 -08:00
Jozufozu
be74a5a21b Relativistic crumbling
- Apply crumbling texture based on model space coordinates, not world
  space.
- Discard based both on crumbling alpha and diffuse alpha.
2023-11-26 19:24:04 -08:00
Jozufozu
24aa5b1795 Error in errors
- Parse error format produced by my intel laptop now.
- Fix some off-by-one errors in error reporting.
2023-11-26 16:16:33 -08:00
Jozufozu
9f029041a4 Consistent batches
- Reintroduce BatchedDrawManager.
- BatchingEngine no longer implements plan itself, instead uses
  composition of other plans.
- Add DynamicNestedPlan, runs many plans provided at execution time.
- Add ContextFunction and ContextSupplier to match *Consumer and
  *Runnable.
- Add unit tests for DynamicNestedPlan and IfElsePlan.
2023-11-26 13:49:54 -08:00
Jozufozu
ce04fc90dc Store bought engines
- Add InstancerStorage so engines can share common code.
- Instanced and Indirect DrawManagers extend InstancerStorage, while
  BatchingEngine keeps an anonymous class for it.
- AbstractEngine now has a InstancerStorage getter and does some
  delegation so the implementations don't have to.
- InstancedInstancer directly stores the list of DrawCalls it belongs
  to.
- InstancingEngine no longer accepts a context parameter.
- Make the /flywheel backend command default to the flywheel nampspace.
2023-11-26 12:07:05 -08:00
Jozufozu
ec7e179394 Buckets of crumbs
- When crumbling, group DrawCalls by ShaderState.
- Pass all instances for a given crumbling progress at once.
- Use a map to associate initialized instancers with draw calls.
- Document most of the fields in InstancedDrawManager.
- Fix race condition in InstancedDrawManager#getInstancer.
- Will follow up for BatchingEngine and IndirectDrawManager.
2023-11-25 14:24:43 -08:00
PepperCode1
9bcc334bfa Port fixes and other changes 2023-11-25 14:09:30 -08:00
Jozufozu
581bec1e7a Reduced to ashes
- renderCrumblingInstances accepts a list.
- Implement crumbling for InstancingEngine.
  - It's ugly.
  - Track what draw calls belong with what instancers.
  - DrawCalls lazily create a second VAO for one-off rendering.
  - Bind instance vbo with offset to scratch VAO to emulate a draw with
    baseInstance.
- Ignore discard predicate in crumbling context.
- SimpleContext takes a Consumer to set sampler bindings.
- Fix debugCrumbling command.
- Compile shaders against all contexts.

Side note: not sure if Context is the right place for crumbling. It
feels like it should be a material, but I don't know how that would
work.
2023-11-24 23:10:27 -08:00
Jozufozu
224c3ee577 Undo invalidate back to delete
- Makes more sense given how the method is used.
2023-11-24 21:21:10 -08:00
Jozufozu
e98317682e Plans yet to crumble
- Rename Engine#delete -> #invalidate per pepper's TODO.
- Plans
  - Remove thenMap and andMap from Plan API.
  - Add builder for MapContextPlan for better composition.
  - Add IfElsePlan and Builder to "fork" on a condition.
  - VisualizationManagerImpl no longer rolls a special Plan class and
    instead uses a plan composition chain.
- Crumbling
  - Not implemented yet!! But the skeleton is taking shape.
  - Remove LevelRendererAccessor, and instead directly pass the map of
    destructionProgress to the VisualizationManagerImpl when it's time
    to render crumbling instances.
  - Give Instances a Handle getter.
  - Add way to get a block entity visual at a given position.
  - Add Engine#renderCrumblingInstance stub.
2023-11-24 20:40:14 -08:00
Jozufozu
9ac8aea347 Shaking things out
- Use JOML better where we can.
  - Inline MatrixUtil#store and #toJoml
  - FlwShaderUniforms keeps a scratch matrix around for mutating the
    viewProjection.
  - Directly store a Quaternion4f in OrientedInstance to avoid creating
    new objects in the batching transformers.
- Move FrameContext creation to a functor.
- We do need to check the renderDebug flag still :ioa:
- Make VisualUpdatePlan's internal plan not null.
- Remove ClientMainMixin :sad:
  - Forge's new earlywindow stuff means there's no opportunity for
    Flywheel the mod to inject renderdoc before the window is
    initialized.
  - The workaround for now is to breakpoint in FML's
    DisplayWindow#initialize and evaluate
    `System.loadLibrary("renderdoc")` manually.
2023-11-24 14:29:03 -08:00
Jozufozu
152688a09f Finally free
- Free from mojmath, have to flip many matrix field accesses.
- Free the memory allocated in model cache.
  - Shout out to pepper's DebugMemoryBlock telling me *exactly* where a
    leak was from.
- Instancing and batching seem to mostly work, indirect appears to be
  rendering instances in the wrong places, though they are culled from
  their real location.
2023-11-23 23:09:46 -08:00
Jozufozu
9f019fc72f Loading visualization
- Fix up/comment out some touchy mixins.
- Get chests to render.
- There's something wrong with the projection matrix.
- Add comment to DebugMemoryBlockImpl's stack walker usage.
2023-11-23 22:48:29 -08:00
Jozufozu
90cfd967dc Instant backport
- Switch to 1.20.1
- It still compiles!
2023-11-23 22:45:39 -08:00
Jozufozu
b7f3c11472 I'm partial to compiler errors
- Update PartialModel events
- Flywheel compiles!
2023-11-23 14:15:01 -08:00
Jozufozu
aae0200d93 The bakery
- Port model baking infrastructure.
- VirtualEmptyModelData seems like it isn't needed anymore,
  but I left some stubs in.
2023-11-23 14:10:50 -08:00
Jozufozu
7bc6a7559a Round 2
- Add Axes class to (temporarily?) replace old mojmath Vector3f.$axis.
- Add helper for getting a random float between 2 values.
- Implement diffuse light formula.
- Fix debug overlay event.
- Try and fix ChunkRebuildHooksMixin but the first parameter isn't
  visible. Hopefully stubbing in Object will compile later.
2023-11-23 11:42:11 -08:00
Jozufozu
99be0ad281 First blood
- Make a quick pass resolving conflicts
- Mostly joml related, or to do with the world -> level rename
- Basically left model builders and virtual levels alone
- There are also some forge events that seem to no longer exist
2023-11-22 21:30:58 -08:00
Jozufozu
5fc346ad7a Build system but no build
- Start with a cherry pick from 1.20/dev
- Copy over newer gradle wrapper related things from the forge 1.20 mdk
- Follow example from 1.20 mdk to update build.gradle and
  settings.gradle
- Update parchment version
2023-11-22 20:57:46 -08:00
Jozufozu
db4c185039 Discard discard
- Do not guard discard predicate on a compile definition because it
  doesn't matter for ubershaders.
2023-11-22 12:49:06 -08:00
Jozufozu
d17d9379df Improved vexillology
- Separate concept of Flags from TaskExecutor.
- Instead, allow TaskExecutor to sync until, or while a given condition
  is met.
- Flags directly store their state as an AtomicBoolean.
- Switch `executor.syncOn(flag)` to `executor.syncUntil(flag::isRaised)`
- Remove tests made redundant by improved interface.
2023-11-21 10:47:33 -08:00
PepperCode1
115f57d341 Less building, more converting
- Add ModelPartConverter and remove ModelPartBuilder
  - ModelPartConverter can convert ModelParts into Flywheel Meshes,
optionally using a transformation and TextureMapper. A
ModelLayerLocation and TextureAtlasSprite can be used instead to quickly
replicate entity models.
- Add ModelHolder and ModelCache to lazily initialize models and
automatically delete them on renderer reload
- Add SimpleModel and remove SimpleLazyModel
- Add flw.useSerialExecutor system property
- Rename ModelBufferingUtil to BakedModelBufferer
- Remove Instance.copy
- Remove Mesh.name
- Make FlwMemoryTracker thread-safe
- Fix potential thread-safety issues, texture issues, and memory leaks
related to previously memoized models
- Fix MinecartVisual only updating when not visible
- Fix ChestVisual locks not moving when opening the chest
2023-11-20 22:03:04 -08:00
Jozufozu
8ea221e4f7 Full of red flags
- Add concept of flags to TaskExecutor.
- Can raise and lower flags from any thread.
- Add TaskExecutor#syncTo
  - Behaves much like #syncPoint, but exits early as soon as it detects
    that the requested flag has been raised.
- Document all methods in TaskExecutor.
- Do not discard tasks when destroying a VisualizationManagerImpl.
- Use flags in VisualizationManagerImpl to track frame plan and tick
  plan completion.
- Use flags in BatchingEngine to track stage buffering completion and
  flush completion.
  - Synchronization is now needed in BatchedDrawTracker#draw.
- Use flags in IndirectEngine and InstancingEngine to track flush
  completion.
- Add unit tests to validate flag behavior.
- Rename OnMainThreadPlan -> SyncedPlan.
2023-11-18 16:07:58 -08:00
PepperCode1
9afbc66b14 Missed renames 2023-11-18 11:53:01 -08:00
PepperCode1
66f11018fe Sweeping changes
- Add VisualizationManager and VisualManager API
- Simplify and fix memory leaks in model utilities
- Pass partialTick directly to visuals and remove AnimationTickHolder
- Fix LevelAttached and FlwTaskExecutor not being thread-safe
- Reorganize and rename many things
- Remove unnecessary things
2023-11-18 11:46:04 -08:00
Jozufozu
fcd70cccd0 Barely better batches
- TransformCall now uses ForEachSlicePlan to reduce the number of
  objects created.
- WaitGroup#await can now timeout. This allows the main thread to
  contribute more work in a syncPoint.
- Don't normalize in transformNormal, things already are normalized.
2023-05-29 20:29:46 -07:00
Jozufozu
257ee07e0e Index sequences but they're unsafe
- Not totally happy with this but it's functional and better than
  directly supplying a GL object.
- Meshes provide an IndexSequence and the length of the sequence.
- IndexSequence can fill a buffer given a length.
- Special case QuadIndexSequence to optimize the most common case.
- All other sequences are treated as if they are unique
- Instancing uses EBOCache to manage ebos
- Indirect does it directly in the meshpool
2023-05-29 20:25:17 -07:00
PepperCode1
961fafce0d Batched simplification
- Perform various cleanup in batching code
- Remove ClientLevel argument from InstanceVertexTransformer#transform
- Rename Plan#maybeSimplify to simplify
- Rename some classes
- Move TickContext from impl to impl.visualization
- Move VertexListProviderRegistryImpl from impl to impl.vertex
2023-05-28 09:54:51 -07:00
Jozufozu
afb14bc1f6 Hol up
- Spin wait for .01ms in WorkerThreads before waiting
2023-05-27 12:01:47 -07:00
Jozufozu
176a839c16 Too many plans
- Add PlannedVisual
- Make ExampleEffect use PlannedVisual
- Remove One2ManyStorage
- Merge Storage, AbstractStorage, and One2OneStorage
- Storage directly provides update and tick plans
- Move work distribution logic to static methods in PlanUtil
- Rename RunOnAllPlan -> ForEachPlan
- Add ContextConsumer and ContextRunnable interfaces and remove
  ContextAgnosticPlan
2023-05-26 15:59:00 -07:00
Jozufozu
d783617a73 Context for Tickable/Dynamic visuals
- Add VisualFrameContext for DynamicVisual#beginFrame
- Add VisualTickContext for TickableVisual#tick
- Move checks for update limiting to within the update calls themselves
- Provide update limiting/culling primitives within (B)E Visuals
- Remove methods from *Visual interfaces related to update limiting
- Add thenMap and andMap to Plan
- Add Plan primitive to transform context
  - Used in Visual update dispatch
2023-05-21 18:10:46 -07:00
Jozufozu
e64976df5d Gone, but not forgotten
- Track the last visible AABB within EntityVisuals to prevent entities
  from freezing when the go offscreen.
2023-05-21 16:07:46 -07:00
Jozufozu
3da51885d1 Housekeeping
- Update dependencies, forge version
- Bump LICENCE year
- Use fma in MatrixUtil and VertexTransformations
- Remove some dead variables from TransformCall
- Use onSpinWait in WaitGroup#await
- Do not allow adding negative numbers to a WaitGroup
- Thin abstraction for TaskNotifier
- Clean up WorkerThread task polling
2023-05-21 15:24:33 -07:00
Jozufozu
37ecedb97a Building shade
- Use builder pattern for defining shader compiler flows
  - If only java had type inference extending to builders :whywheel:
- Support glsl 330 on instancing again
  - Set uniform block binding at link time
  - Remove associated glsl builder code
  - Use explicit uint literals in material adapter switch cases
  - No need to enable GL_ARB_explicit_attrib_location
2023-05-18 00:03:53 -07:00
Jozufozu
96493e1571 Instant legacy code 2: electric boogaloo
- Hardcode generation of unpacking structures/functions.
- Remove SourceLoader arg from InstanceAssemblerContext
- Remove types.glsl, move BoundingSphere to indirect_draw_command.glsl
- Remove extra methods from LayoutItem
- Tweak nested error lines
2023-05-17 20:45:30 -07:00
Jozufozu
06063cdb4b Missing lines
- Fix crash trying to generate pretty errors in generated source
- Generate short, unique file names for shaders
- Cleanup some legacy code
- Catch exceptions while compiling shaders for each backend
2023-05-15 16:55:18 -07:00
Jozufozu
7dcfc79a3e Still loading
- Catch errors while loading complex source components
  - Allow compilers to progress when such an error occurs, but don't do
    any actual compilation.
- Tweak error messages.
- Make resource locations in shaders default to flywheel namespace
- Make PipelineCompiler somehow simpler yet more verbose
2023-05-14 16:41:37 -07:00
Jozufozu
d27929c307 Shader sanity
- Switch #use to #include
- Stop ignoring errors from within shader compilers
- Track load errors in CompilerStats
- Move LoadError to separate sealed interface, LoadResult.Failure wraps
  a LoadError
- Move SourceFile member parsing methods to respective classes
- Add tests for SourceFile loading
- Start work on tests for error messages
2023-05-13 17:02:18 -07:00
Jozufozu
d1e54d65da Actually do it somewhere else
- Move main thread checking to TaskExecutor
2023-05-13 12:01:12 -07:00
Jozufozu
639b2185ab A lot to unwrap
- Make ShaderSources return a LoadResult
- Refactor SourceFile loading to do all parsing outside the ctor
- Don't immediately swallow import errors, instead forward them
- Change Span to reference SourceLines instead of SourceFile
- Still WIP, but functional at this stage
2023-05-08 22:43:55 -07:00
Jozufozu
d44c973bcc Just do it
- In OnMainThreadPlan#execute, don't queue anything if we're already on
  the render thread
2023-05-08 22:41:17 -07:00
Jozufozu
aa38ae4125 Separate separate attributes
- Add new GL43 vertex array impl
- GlNumericType cleaning
- Make GlBuffer growth more abstract
- Organize VertexArrayGL3, track bound ebo
2023-05-07 15:38:45 -07:00
Jozufozu
e2bcc5f325 Should use separate attribute format correctly
- Switch to object oriented vertex array impl
- Expose vao api similar to separate attribute format
- For DSA, directly call methods
- For 33, defer state changes until bindForDraw is called
- Inline instanced mesh #drawInstances method in favor of more
  fine-grained control over binding order
- Move buffer binding to GlStateTracker
- Remove raw bindVAO(0) from indirect engine
- Make VertexAttribute a sealed interface.
- Fix ebo restore state by always updating it and never restoring it
- Remove restore state wrapping in DrawCall
- Also misc cleanup.
2023-05-06 17:04:58 -07:00
Jozufozu
19824e7a3c Apply directly to the buffer
- Add DSA abstraction to GlBuffer
- Move backing impls to their respective classes
- Remove versioned package, move impls to appropriate package
- Make fallback methods take no arguments
- Do VAO check/bind in GlStateTracker
- GlVertexArray actually checks the tracked info when binding attributes
- Add separate enable* and setup* methods in VertexArray
- Add support for DSA VAO with ARB instanced arrays incase there are
  some particularly cursed drivers out there
- Misc. cleanup
2023-05-01 23:43:01 -07:00
Jozufozu
b1a1120764 Enuf enums
- Remove GlVersioned abstraction in favor of explicit fallback
- Remove versioned.BufferStorage
2023-05-01 21:57:12 -07:00
Jozufozu
f1f289124d Buffing the old works
- GlBuffer no longer has an explicit bind method or binding target
- Use READ/WRITE BUFFER for all data operations
- Make MappedBuffer simpler and more RAII
- Remove dead methods from GlBuffer
- Don't actually need to clear the tail of GPUInstancers on shrink
- Implement actual capability check for indirect
  (I think I check all the extensions)
2023-04-29 21:53:56 -07:00
Jozufozu
ef7c259f43 InDSAanced vertex arrays
- Make GlCompat static
- Expand InstancedArrays compat to encompass all vertex array ops
- GlVertexArray calls into VertexArray compat layer
- VertexAttributes still use 2 separate interface methods
2023-04-24 21:54:59 -07:00
Jozufozu
aef676517a Stick to the plan
- Plans are now generic about a context object
- Move default composition impls to SimplyComposedPlan
- Remove PlanUtil
- Make Synchronizer implement Runnable
- Add ContextAgnosticPlan to preserve old behavior
- Reduce creation of plan objects
- Make BatchingEngine, BatchingStage directly implement plan
- Introduce BatchContext for BatchingStage plans
- Introduce FrameContext, TickContext for VisualManager plans
- Cache separate "recreation plan" for when origin shifts occur
2023-04-23 12:42:07 -07:00
PepperCode1
f4cfb24c85 Organize and improve compiler code
- Ensure current backend is never null
- Fix StringUtil#countLines
- Use material index instead of file location when adapting material
shader function name
- Merge Includer and Compilation factory into ShaderCompiler and remove
builder
- Remove CompileUtil
- Remove Index
- Remove unnecessary code from ShaderSources
- Move source component classes to backend.compile.component
- Move core compilation classes to backend.compile.core
- Move pipeline classes to backend.compile
- Move GLSLVersion to glsl package
- Move SourceChecks to backend.compile
2023-04-20 12:22:51 -07:00
Jozufozu
296aa7ca08 Post-post-pre-refactor-refactor actual refactor
- Mark backends as unavailable if their shader compilation failed
- Update command output to notify when a fallback occurs
2023-04-18 21:28:28 -07:00
Jozufozu
4c8e174712 Pre-processing post-pre-refactor-refactor
- Separate pipeline compiler from compute compiler
- Remove Pipeline field from PipelineProgramKey
- Share one UniformComponent across compilers
- Use AbstractCompiler to deduplicate some shared code
- Separate indirect programs from instancing programs
- Move compilation tracking information to CompilerStats
- Improve compilation result/link result reporting
2023-04-18 20:27:25 -07:00
Jozufozu
b30d686785 And I oobe
- Raise exception when trying to slice outside DrawBuffer bounds
- Count vertices in BufferPlan#execute to account for instance creation
  during Visual updates
- Mark DrawBuffers active by default
2023-04-17 15:02:45 -07:00
PepperCode1
7afa2486ad Pre-processing Pre-refactor
- Move pipeline code to backend package
- Store compiled programs in FlwPrograms instead of FlwCompiler
- Rename PipelineContext to PipelineProgramKey and remove CullingContext
- Remove PipelineContextSet and CullingContextSet
- Improve quality of dumped sources
- Rename pipeline directory to internal
- Add underscores before more internal GLSL variables
- Remove unnecessary GLSL files
2023-04-16 22:09:28 -07:00
Jozufozu
5b84046c1d The manhattan batch
- Use atomics to determine buffer position for batches
- Pass resultant vertex count to DrawBuffer once all transform calls
  have run
- Refactor to use RunOnAllPlan within TransformCall
- Make all vertex transform logic to operate per-instance instead of
  per-chunk
- Cull instances based on bounding sphere transformations
- Make BufferedMesh#mesh public to expose bounding sphere
- Roll batching #plan() arguments into FrameContext record
2023-04-16 21:00:36 -07:00
Jozufozu
1bd4c4f6cb Non-uniform un-provider
- Delete UniformBuffer on renderer reload to fix crash when switching
  backend to off
- Use library method for getting boolean property (ty pepper!)
2023-04-16 17:20:32 -07:00
Jozufozu
51cbfbc75a Batch in action
- Rename TransformSet -> BatchingStage
- Inline BatchingTransformManager into BatchingEngine
- Reuse one Plan object for each DrawBuffer used by a stage.
- Separate DrawBuffer acquisition from marking as active.
- Remove some unused methods in BatchingDrawTracker
- Rename variables in AnimationTickHolder
- Make flw.loadRenderDoc=false behave as expected.
2023-04-16 15:23:14 -07:00
Jozufozu
e03590b270 Smaller batches
- Extract TransformSet to full class
- Move planning code into BatchingTransformManager
- Reduce exposure BatchingTransformManager of internals
- Comment out WaitGroup log :ioa:
- Move ceilingDiv to MoreMath
- Use dynamic chunk size for TransformCalls
2023-04-16 12:46:20 -07:00
Jozufozu
cb74fa4603 Merge branch '1.18/plan' into 1.18/next
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/api/backend/Engine.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/batching/BatchingEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/batching/TransformCall.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancingEngine.java
#	src/main/java/com/jozufozu/flywheel/handler/EntityWorldHandler.java
#	src/main/java/com/jozufozu/flywheel/impl/instancing/InstancedRenderDispatcher.java
#	src/main/java/com/jozufozu/flywheel/impl/instancing/manager/InstanceManager.java
#	src/main/java/com/jozufozu/flywheel/impl/instancing/storage/AbstractStorage.java
#	src/main/java/com/jozufozu/flywheel/impl/visualization/VisualWorld.java
#	src/main/java/com/jozufozu/flywheel/mixin/instancemanage/InstanceRemoveMixin.java
#	src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualAddMixin.java
#	src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualUpdateMixin.java
2023-04-15 15:27:18 -07:00
Jozufozu
0861d8bfd2 Needs to wait
- Commit to non-blocking waitgroup impl
- Debug log when await takes suspiciously long
2023-04-14 17:14:12 -07:00
Jozufozu
f29dcbc486 Weaving threads
- Restore WaitGroup abstraction
- Simplify WaitGroup to make proper use of atomics
- Fix logic error in ParallelTaskExecutor causing task counter to go
  below zero when executing main thread tasks
- Use ConcurrentHashMap in models to allow parallel access
- Reduce chunk size in RunOnAllPlan
- Only queue in InstanceManager
- Defer syncPoint within renderStage
- AbstractStorage return immutable view for tickable/dynamic instances
- Process InstanceManager queues off-thread
2023-04-13 15:17:02 -07:00
PepperCode1
361cb5a1d9 Clean up mixins and fix changes from last commit
- Add FixNormalScalingMixin from Create
- Fix VisualizedRenderDispatcher#tryAddBlockEntity
- Fix flywheel.sodium.mixins.json using wrong plugin class name
2023-04-13 11:36:05 -07:00
PepperCode1
b4cef0b5c9 Add Rubidium compatibility
- Add proper Rubidium compatibility on our side
- Overwrite methods in Rubidium's FlywheelCompat class with stubs to
prevent crashes
2023-04-13 10:16:33 -07:00
PepperCode1
2847ad28ed Fix rendering far from world origin
- Make BatchingEngine use a shifting render origin
- Make frustum checks relative to the render origin
- Improve AbstractEntityVisual#isVisible to be closer to vanilla
- Move render origin implementation code to AbstractEngine
2023-04-10 14:30:08 -07:00
Jozufozu
76dcf3fed6 The botched batching plan
- Directly port over submitTasks to use Plan
- Could probably make better use of the plan primitives, but oh well
- Remove Engine#beginFrame
2023-04-09 14:37:12 -07:00
Jozufozu
1627874e33 Putting our plan to the test
- Implement plan simplification
- Add unit tests for plan execution and simplification
2023-04-09 14:15:29 -07:00
PepperCode1
05458d01d2 Flywheel's Visualized Rendering
- Rename Instance -> Visual (and all related elements)
- Rename InstancePart -> Instance (and all related elements)
- Move classes in package lib.format -> lib.vertex
- Rename Formats -> VertexTypes
- Remove SimpleLazyModel#setMaterial
- Remove unnecessary newlines in some files
2023-04-09 12:00:03 -07:00
Jozufozu
fb11f29010 Parallel planning primitives
- Engines/InstanceManagers now provide Plans for frames/ticks
- TODO: batching is broken
- TODO: plan caching
- Add Plan interface which can be used to compose complex systems
  of parallel execution
- Add Synchronizer to facilitate barriering
- Remove WorkGroup
- Summary of different primitives below, names need work :ioa:
  - BarrierPlan: executes one plan then another
  - NestedPlan: executes many plans at once
  - OnMainThreadPlan: waits for a syncPoint to execute
  - RunOnAllPlan: dispatches work over a Supplier<List>
  - SimplePlan: executes many Runnables at once
  - UnitPlan: does nothing
2023-04-08 18:08:53 -07:00
PepperCode1
72b5968305 More clean up 2023-04-07 16:01:03 -07:00
Jozufozu
945ed9a1e4 Simple storage staging
- Use one concurrent queue of transactions in InstanceManager
2023-04-07 00:14:39 -07:00
Jozufozu
ab8ab8dbd4 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
391adfef1a Instance Refactor II 2023-04-05 18:03:25 -07:00
Jozufozu
227aef509b 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
7326bdd3c2 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
632240abf0 Instance Refactor I 2023-04-04 12:36:54 -07:00
PepperCode1
2c010ffa06 Registry refactors and namespaced backends 2023-04-02 23:58:28 -07:00
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
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
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
Jozufozu
ebef176089 Dynamically indirect
- Indirect engine now only allocates as much memory as it needs
2022-08-20 20:50:26 -07:00
PepperCode1
8bea467409 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
ba30aca869 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
2fe69350ef 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
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