Commit Graph

2602 Commits

Author SHA1 Message Date
Jozufozu
238fd68ef4 safety = null
- Do not crash when instances passed to api methods are null.
  - Ignore null crumbling instances.
  - Do not attempt to steal null instances.
- Add nullability annotations where relevant.
- Update docs to indicate null behavior.
2024-01-19 16:20:34 -08:00
Jozufozu
04b8a6ff07 Diewheel
- Remove update json url from mods.toml.
- Change display url to link to github.
2024-01-19 14:08:12 -08:00
Jozufozu
59fec85584 Stop playing hide and seek
- Dump stitched shaders to meaningful paths.
- Simplify dataflow to Compilation.
- Rename some compiler classes to better reflect what they do.
- Inline some utility methods on shader enums.
2024-01-19 13:20:57 -08:00
Jozufozu
a6ee564784 Marker?
- Include a marker for each compilation harness in its logs.
- Use a separate instance of logger for compilation stuffs.
- Change CompilerStats info format to log programs before shaders.
2024-01-19 12:29:35 -08:00
Jozufozu
4aa833e027 Scull
- Add header to define uniforms/other api variables for the cull shader.
2024-01-19 11:52:09 -08:00
Jozufozu
113408a07a We had lost track of time
- Add some uniforms related to game time.
- Move frustum planes to the top as its better for alignment.
- Make constantAmbientLight a uint.
2024-01-18 18:17:09 -08:00
Jozufozu
e5428d20e8 Monster mat
- Tweak the matrix and quaternion utility shaders.
2024-01-18 17:23:18 -08:00
Jozufozu
af56417d23 Update uniform providers (again)
- Remove uniform api.
- Do not generate uniform interface blocks.
- Move uniform shader into internal/ and manually include it in the api
  impl headers.
- Add flw_ prefix to existing uniforms.
- Separate fog uniforms into their own UBO, uploaded in FogUpdateMixin.
- Drastically simplify UniformBuffer.
- Do not poll for uniform buffer updates. Instead, do the upload at the
  beginning of a frame when the engine is flushing.
2024-01-18 17:07:10 -08:00
Jozufozu
5a4bbd3a39 We had ConcurrentHashMap at home
- Use ConcurrentHashMap in InstancerStorage.
- Fix exception thrown by stack walking while warning about empty models
2024-01-17 11:55:41 -08:00
PepperCode1
a93e061013 Actually use the provided instance 2024-01-17 10:56:34 -08:00
PepperCode1
4ad80e132e Fix crash after compilation error during in-world resource reload
- Store *Programs inside engines to disallow replacement and use
reference counting to delete programs at the appropriate time
- Move CompilationHarness, Compile, and SourceLoader to compile.core
- Fix packed material comments
- Fix pack.mcmeta pack format
- Remove Embeddium version range
2024-01-17 10:37:39 -08:00
Jozufozu
ad27133253 Feeling empty
- Log a warning and don't allocate any resources when an instancer is
  created with an empty model.
- Log stacktrace starting from the call to InstancerProvider#instancer.
- Revert switch to embeddium dep and comment why the rubidium dep is
  there.
2024-01-16 16:59:15 -08:00
Jozufozu
de622ccc51 Insanity ball
- Publish jarjar artifact as default.
- Publish slim artifact without any fancy stuff.
- Update mods.toml
  - Switch rubidium to embeddium.
  - Set displayURL to modrinth.
  - Change version related stuff to $ variables
- Add processResources step to build.gradle to populate mods.toml.
2024-01-15 17:41:17 -08:00
Jozufozu
740c76f8bf Frag shader go brr
- Add flw_vertexDiffuse and flw_fragDiffuse to glsl api.
- Compute/apply diffuse in the fragment shader.
- Move common glsl between instancing/indirect to common.vert/.frag.
- Add a pittance more documentation to api spec.
- Sneak in a block to build.gradle to always download sources/javadoc.
2024-01-15 14:09:19 -08:00
Jozufozu
2ba8641d65 Write me
- Convert InstanceWriters into lambdas passed directly to the builder.
- It's very nice to have everything in one place like that, will make
  tweaking the layout much easier.
- Also micro-optimize the cull shader for TransformedInstance.
2024-01-08 16:50:22 -08:00
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
Jozufozu
373097742a Add icon to .idea
- Scaled it down because the full-res icon had poor filtering when
  rendered in jetbrains toolbox.
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
61f52cd7d6 More artificer
- Add sources and javadoc to maven artifact
- Update artifact mc version
- Actually test publish locally :lwe:
2023-12-28 13:05:25 -08:00
Jozufozu
5c04c93f62 Artifice
- Specify artifactId again in maven publication
2023-12-27 12:44:16 -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