Commit Graph

2450 Commits

Author SHA1 Message Date
Jozufozu
e447766e47 Little things
- Do not store a list of initialized instancers.
- Remove AbstractInstancer#delete. Only InstancedInstancer was using it
  so move instancer deletion to InstancedDrawManager.
- Improve CompilationHarness builder pattern and reusability.
  - Pass compilation keys directly to compileAndReportErrors.
  - Build the harness at the end of the builder chain rather than at the
    beginning.
  - Use same CompilationHarness for apply shader and scatter shader.
- Remove _ prefix from packed struct fields.
- Make element type's byte size 4-aligned.
- Remove byteSize method from Element.
2024-01-08 13:33:50 -08:00
Jozufozu
cddac38f76 Layout down to rest
- Remove BufferLayout and associated classes.
- Replace InternalVertex with new Layout.
- Calculate InternalVertex stuff as static final fields.
- Elements track their own byte size.
  - The byte size of an element type is unchanged.
  - The byte size of an element is 4-aligned.
- Layout byte size now accounts for alignment.
- Generated packed fields are now always prefixed with an underscore.
2024-01-05 23:03:09 -08:00
Jozufozu
f1554e959e Divider?
- Fix absolute reference after moving packages
2024-01-05 18:48:04 -08:00
Jozufozu
8f7c988168 The great migration
- Move gl -> backend.gl
- Move glsl -> backend.glsl
- Move lib.layout -> backend.gl.layout
2024-01-05 18:38:57 -08:00
Jozufozu
7ad163588e A lot to unpack here
- Elements are 4 byte aligned and store their offset.
- Make all ElementTypeImpls records.
- Implement unpacking for all types/reprs.
- Add many utilities to GlslExpr to facilitate unpacking.
2024-01-05 18:34:28 -08:00
Jozufozu
9309266435 Instancing with Layouts
- InstancedArraysComponent now fully uses Layouts.
  - Trivial to get the glsl type name of a given Element.
  - Also quite easy to get the attribute count without actually
    creating the attribute list.
- IndirectComponent is WIP because unpacking is hard.
  - Reorganize so all the unpacking stuff is in one loop.
2024-01-04 23:44:35 -08:00
Jozufozu
c08a720954 A tribute from layouts
- Add utility to convert a Layout to a list of VertexAttributes.
2024-01-04 22:31:36 -08:00
Jozufozu
5a31bd5d63 Untyped instance types
- Add SimpleInstanceType and builder.
- Remove OrientedType and TransformedType classes in favor of builder.
2024-01-04 15:21:02 -08:00
PepperCode1
6b27614341 Make layout map actually immutable
- Also implement hashCode and equals on *ElementTypeImpl, Layout, and
Layout.Element
2024-01-04 15:19:21 -08:00
PepperCode1
4953b0620c Add missing underscores 2024-01-04 15:00:11 -08:00
PepperCode1
4bcc190b4e Rewrite the layout API 2024-01-04 14:57:21 -08:00
Jozufozu
60ef413c93 We do a little thieving
- Reimplement stealInstance.
2024-01-04 12:35:58 -08:00
Jozufozu
47fc6a5bfb Crumbling inheritance
- Instead of returning a list, collect crumbling instances via consumer.
- This is much friendlier to inheritance and generally better represents
  the behavior we want from Visuals.
2024-01-03 13:57:13 -08:00
Jozufozu
0154efb87c Pain points
- Add Self parameter to TransformStack.
- Replace duck interface impl of TransformStack for PoseStack with
  lazily constructed wrapper object.
- Document Models.
- Replace PARTIAL_DIR with TRANSFORMED_PARTIAl and allow for arbitrary
  transformations with arbitrary keys.
  - Will be useful for transforming by different enums, or using
    alternative transforms by Direction.
- Add default impl of #delete to Instance.
- Store VisualizationContext in AbstractVisual.
- Reduce usage of @SuppressWarnings in Rotate and Transform.
2024-01-03 12:45:32 -08:00
Jozufozu
6f74d2e53b Buffer built
- Remove BufferBuilderExtension and mixin.
- Missed these in earlier commits.
2023-12-24 12:21:55 -08:00
Jozufozu
56c0e51e54 Consecutive normal draws
- Don't use MDI on intel, instead submit multiple draw indirect commands
2023-12-24 11:55:33 -08:00
Jozufozu
18e375418f Drew buffer
- Remove DrawBuffer and related mixins.
2023-12-20 12:46:01 -08:00
Jozufozu
953e2d1ec4 Gone, reduced to batches
- Remove BatchingEngine.
- Remove InstanceVertexTransformer and BoundingSphereTransformer.
- Remove fallback RenderType and MaterialVertexTransformer.
2023-12-20 12:46:00 -08:00
Jozufozu
948750f296 To delete or not to delete
- Fix AtomicBitset#nextClearBit
- Add test for AtomicBitset
- Remove unnecessary gl state stuff from IndirectEngine#renderCrumbling.
- Fix instance removal on IndirectEngine.
  - Deleting an instance not at the end of the instancers list would
    cause an exception to be thrown during upload caused by
    out-of-bounds indexing.
  - Fixed by unsetting changed for the tail of the instancers list.
2023-12-20 11:21:18 -08:00
Jozufozu
7c0959be9a Spooky crumbling from a distance
- Add crumbling renderer for indirect backend.
- As usual, it's ugly.
- Submit one indirect draw per crumbling instance. Could do multidraw
  here, but we'd have to perform the material sort which seems
  unnecessary.
2023-12-15 13:24:09 -08:00
Jozufozu
c79e94cd18 Layout on me, dev
- Move gl-coupled BufferLayout and co. to lib.
- Add new Layout record to API.
  - List of Elements, a sealed interface of type safe records
    representing most possible vertex attributes.
- Deprecate InstanceType#getLayout.
- Add LayoutBuilder in lib for convenience.
- TODO: use new Layouts in backends.
2023-12-13 13:40:53 -08:00
Jozufozu
867d0fa304 TODONE
- Do not check moreThanTwoThirdsChanged in IndirectInstancer#upload
2023-12-10 15:55:04 -08:00
Jozufozu
bc4ad52d4c Scattered to the winds
- A scatter command is 2 uints:
  - The first contains the size and source offset in the upper byte and
    lower 3 bytes respectively.
  - The destination offset.
  - All offsets and sizes are in uints, not bytes.
- Use ScatterList write scatter commands.
- Use TransferList to collect transfers.
- Rather than consolidating transfers in a separate pass, do so as they
  are collected.
- Reorganize StagingBuffer.
2023-12-10 15:45:16 -08:00
Jozufozu
f9209f7dd6 Throw more compute at it
- Use a shader to perform copies.
- Needs optimization, but it works surprisingly well and avoids the
  driver hitch.
2023-12-09 15:32:21 -08:00
Jozufozu
e8c77f1e89 Un unchanged
- Call setChanged in various visuals' #init.
- Not everything needs it because some just call their frame update
  methods right away.
- Improve lazy update logic for bells.
2023-12-08 18:38:40 -08:00
Jozufozu
a65c0c00be Bit-ing the atom
- Use an atomic bitset in AbstractInstancer.
- Add method to iterate over each contiguous span of set bits.
2023-12-08 18:05:03 -08:00
Jozufozu
f98b8e11b8 DIY
- Visuals must manually call setChanged on Instances.
- Decreases the extent of resource contention and makes what's going on
  more explicit.
- Remove self type parameter from FlatLit, I don't think it was ever
  needed.
2023-12-08 18:05:02 -08:00
PepperCode1
cbbd2bfdf8 Separation, for instance
- Separate instance vertex shaders and instance cull shaders into
different files with separate getters in InstanceType
- Remove all occurrences of Names and Files inner classes
2023-12-08 17:02:12 -08:00
PepperCode1
1def0876d8 Untyped vertices
- Remove VertexType
- Rename ReusableVertexList to VertexView and all associated classes,
methods, fields, and variables
- Add VertexView#stride
- Make vertex compiler automatically include layout shader
- Fix instancing and indirect not setting correct vertex count before
writing mesh
2023-12-07 16:49:12 -08:00
Jozufozu
cba04adc91 More smarter less upload
- Only write draw calls when they change.
- Update baseInstance in the apply shader.
- Simplify object upload logic.
2023-12-07 13:46:17 -08:00
Jozufozu
ea4ec918a6 Merge remote-tracking branch 'origin/1.20/next' into 1.20/next
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectEngine.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectModel.java
#	src/main/resources/assets/flywheel/flywheel/internal/indirect/draw.vert
#	src/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert
#	src/main/resources/assets/flywheel/flywheel/internal/layout.vert
2023-12-07 12:56:10 -08:00
Jozufozu
c2a4ac2e83 In an abstract sense, buffered
- Abstract indirect buffers to deduplicate code.
- Write buffer handles when updating sizes.
- StagingBuffer internally handles deferring to a memCopy, accepting a
  long consumer
2023-12-06 23:30:01 -08:00
PepperCode1
9cf7a1c307 Sparse changes
- Add Model.boundingSphere()
- Fix MaterialRenderState not setting up polygon offset correctly
- Fix GlslSwitch using incorrect indentation for first and last line
- Tweak how instanced crumbling works
- Add CutoutShaders.ONE_TENTH
- Rename Contexts.WORLD to DEFAULT
- Rename Material.baseTexture() to texture
- Rename Transparency.LIGHTING to LIGHTNING
- Rename WriteMask.BOTH to COLOR_DEPTH
- Rename SimpleModel to SingleMeshModel and add new SimpleModel that
stores an arbitrary amount of meshes
- Remove flywheel:flywheel/api/* files and assume appropriate symbols
are automatically defined
- Rename many GLSL variables, functions, and constants
- Reorganize GLSL files
- Add NonExtendable annotation to some API classes
- Rename some Java classes, methods, fields, and variables
2023-12-06 22:00:31 -08:00
Jozufozu
c0d1e736e4 OSHA Theatre
- Add staging buffer for indirect using unholy amounts of unsafe.
- Make GlFence RAII.
- Make all IndirectBuffers GPU only and use a shared staging buffer for
  transfers.
2023-12-05 14:25:21 -08:00
Jozufozu
de0876c2ee Internal overlay
- Add overlay to internal vertex format.
- Move interval vertex format related constants to helper class.
- Switch strides to long so java stops complaining about implicit casts
  in multiplication.
- Remove VertexTypes#init as it's not needed anymore.
2023-12-04 21:17:57 -08:00
Jozufozu
c74fbda15f Merge remote-tracking branch 'origin/1.20/next' into 1.20/next
# Conflicts:
#	src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawSet.java
#	src/main/resources/assets/flywheel/flywheel/internal/block.vert
#	src/main/resources/assets/flywheel/flywheel/layout/pos_tex_normal.vert
2023-12-04 00:29:32 -08:00
Jozufozu
0876902421 More indirecter
- Indirect now supports multiple meshes per model.
- Cull entire models at once and then apply the accumulated instance
  count to each draw command in a separate compute pass.
- Add utility to calculate the bounding sphere for multiple meshes.
- Inline IndirectDrawSet into IndirectCullingGroup.
- Use MemoryBlocks for draw command and model descriptor storage.
- Fix leaked draw commands.
- Add IndirectModel to track bounding sphere and instancer stuffs.
- IndirectDrawCommand now references IndirectModel instead of Instancer.
2023-12-04 00:25:20 -08:00
PepperCode1
dfd27fc968 Materials and You: Volume 3
- Add material properties
  - depthTest
  - useOverlay
- Rename some material properties
  - mip -> mipmap
  - backfaceCull -> backfaceCulling
  - lighting -> useLight
- Fix InstancingEngine and IndirectEngine not binding overlay texture
and setting unnecessary render state
- Fix indirect internal shaders applying light twice
- Fix internal shaders using removed ALPHA_CUTOFF define
- Rename some variables and functions in shader files
- Separate MaterialUtil into MaterialRenderState and MaterialEncoder
- Delete unused Textures class
2023-12-03 18:13:39 -08:00
Jozufozu
d641fd636f Laying out the API
- Remove BufferLayout from VertexType.
- Remove VertexType from mesh, and only allow writes to a VertexList.
- MeshPools directly refer to BufferLayout instead of going through
  VertexType.
2023-12-03 17:03:13 -08:00
Jozufozu
0e5617219b Blocks all the way down
- Instancing and indirect backends use the block format internally.
- Remove layout shaders.
- Do not compile against VertexType.
- Do not sort draw calls by VertexType.
- Remove VertexType#REGISTRY.
2023-12-03 16:27:18 -08:00
Jozufozu
473e5e852f Looks good to me
- Make SimpleMaterial.Builder implement Material itself.
- Add way to copy a material.
- Move fog/cutout shaders to their own utility classes.
- Fix crumbling on cutout materials by overriding properties.
- Add helper in glsl for unpacking 2 shorts from one uint.
- Remove Fog enum.
2023-12-02 13:08:53 -08:00
Jozufozu
570e00978a Fog so thick you could cut it
- Add generic ResourceLocation Index in ShaderIndices.
- Add FogShader and CutoutShader API.
- Implement existing fog/cutout configurations as separate shaders.
- Simplify pipeline shaders to accommodate for new api.
- Separate fog and cutout ubershader components.
  - This was much easier than I anticipated, seems we finally have a
    usable compiler/shader stitcher.
- Pass fog and cutout IDs to ubershader via a 2x16 packed uint.
- Remove discardPredicate and fogFilter from default material shader.
2023-12-02 13:08:25 -08:00
Jozufozu
23ddf350ea We have shards at home
- Break material setup into constituent parts.
- Sort materials by what they setup.
- Fix some shader issues.
2023-12-02 00:40:54 -08:00
Jozufozu
42c4d311b0 Cut it out!
- Down to just one material shader.
- May need some better examples?
2023-12-01 23:59:51 -08:00
Jozufozu
301d2f82dd Usurper materials, do you have any last words?
- Pipeline shaders now implement all currently used material properties.
- Rename flw_initVertex/flw_initFragment to flw_begin*.
- Rename flw_contextVertex/flw_contextFragment to flw_end*.
- Bind the diffuse texture by hand instead of calling bindActive.
- Add cutout property to materials that need it.
2023-12-01 23:44:04 -08:00
Jozufozu
df49b1f25c Something is materializing
- Add flw_material struct to the shader api.
- Initialized by the pipeline.
2023-12-01 13:51:34 -08:00
Jozufozu
31ee65de30 Make it even shadier
- Reorganize internal package based on backend.
- Add api redefinitions in separate files.
- When compiling, insert pipeline api impls at the top.
2023-12-01 13:18:05 -08:00
Jozufozu
ade814140e A shady API
- Remove storage qualifiers and compile guards from api sources.
- Replace api sources with empty stubs by poisoning the ShaderSources
  cache.
- Pipelines redefine the shader api and are inserted at the top of a
  compilation.
- Declare shader api methods in api sources.
- Fix crash in ErrorBuilder#pointAtLine
2023-12-01 00:26:02 -08:00
Jozufozu
2cc1b4719e Materials and You: Volume 2
- Make the state provided by materials explicit
- Add utility to pack material properties into an int for use in shaders
2023-11-30 23:16:23 -08:00
Jozufozu
f6cf019486 Put a lid on it
- Apply lid transform in ChestVisual#init.
- Fixes a horrifying bug where all chest lids you haven't looked
  directly at yet appear coinciding at the origin.
2023-11-30 17:14:09 -08:00
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