Commit Graph

688 Commits

Author SHA1 Message Date
Jozufozu
8d4fe7722c Gradle grumbles
- Apply java, maven-publish to all projects
- Prefer the tasks.named() syntax for configuring tasks
- Separate shared configuration for platform projects into a separate
  configure block
- Add more fields to processResources
- Make helper methods static
- Exclude duplicated package infos
2024-05-17 08:43:56 -07:00
Jozufozu
57ac1b08f4 Compiling models
- Make model builders abstract
- Move BakedModelBufferer as is into forge project
- Create Forge*ModelBuilders with modeldata parameters
- Wrap ModelBuilder ctors in factory methods
- Add FlywheelLibPlatform api, similar to api.internal package but for
  lib-only/platform specific stuff
- Move TransformStack wrapping into FlywheelLibPlatform
- Create vanilla renderer through FlywheelLibPlatform
- Handle partial model initialization in separate event handler class
- Fix test configuration in common project
2024-05-17 08:43:56 -07:00
Jozufozu
ff0a928479 Everything but models
- Trying to get xplat forge working, fabric can wait until the common
  project compiles
- Move backend manager event handling to separate class
- Move commands into forge for now
- Make FlwConfig an interface and move concrete impl into forge
- Remove event parameters from handlers than don't actually use them
- Add platform specific blockstate light emission for uniforms
- Remove example effect
- Add accessor for LevelRenderer#ticks
2024-05-17 08:43:56 -07:00
Jozufozu
ec685ebdc0 Out for a run
- Move loom.runs into subprojects closure
- Move common code sharing into subprojects closure
- Apply java plugin
- Fix runs not being generated by moving generatePackageInfos to the
  bottom
2024-05-17 08:43:56 -07:00
Jozufozu
e152df6769 Platform dependent wheeling
- Use ClientPlatform to:
  - Dispatch events
  - Create iris/oculus handler
- Move VisualizationEventHandler into forge project
2024-05-17 08:43:56 -07:00
Jozufozu
7e5b2098b1 Deduplication and stubs
- Move common gradle business from each subproject into the
  rootProject.subprojects closure
- Add fabric.mod.json
- Register forge mixin configs
- Make blaze3d mixins remap = false
- Separate common, forge, and fabric mod entrypoints
2024-05-17 08:43:56 -07:00
Kneelawk
58278dd8b4 Move events to platforms 2024-05-17 08:43:56 -07:00
Kneelawk
6e0702aa0b Move MinecraftMixin to platforms 2024-05-17 08:43:56 -07:00
Kneelawk
70a72209d2 Move Sodium mixin to platform code 2024-05-17 08:43:56 -07:00
Kneelawk
f227c44ec8 Begin on platform abstraction interface 2024-05-17 08:43:56 -07:00
Kneelawk
dbd8106b4a Add jsr305 compile dependency 2024-05-17 08:43:56 -07:00
Kneelawk
85f68997e0 Re-add sodium/embeddium, iris/oculus, starlight dependencies 2024-05-17 08:43:56 -07:00
Kneelawk
7aed7c7ad1 Re-add package-info generation 2024-05-17 08:43:56 -07:00
Kneelawk
f728ca4a4e Begin architectury setup 2024-05-17 08:43:56 -07:00
Jozufozu
f51e2d2a1b Case'd into a corner
- Do not clear instance handles when clearing an instancer
  - Fixes case where a stolen handle gets cleared after changing
    instancers
- Use a concurrent queue for initializing instancers in DrawManager
  - Fixes race condition where only one of two instancers created in the
    same moment get initialized
2024-05-01 19:30:11 -07:00
Jozufozu
dbf1977c0d Like a deer in the headlights
- Freeze registries in FMLLoadCompleteEvent
- Pass registry objects into freeze callback consumers
  - Should make it more difficult to pass a callback to the wrong
    registry
2024-04-14 22:24:31 -07:00
PepperCode1
4cb2cabec8 Fix FogUniforms 2024-04-11 12:19:18 -07:00
PepperCode1
2365687950 Next level
- Rename all appropriate occurrences of "world" to "level"
- Simplify uniform buffers
- Fix indirect cull dispatch only binding frame uniforms
- Fix level renderer reload resetting debug mode
- Properly register backend argument
2024-04-11 12:12:13 -07:00
PepperCode1
2f7fce29c3 Arrays and alignment
- Allow array elements in layouts with lengths in range [1, 256]
- Align each layout element to its primitive size instead of always
aligning to 4 bytes; this is the same as C struct alignment
- Rename package lib.visual.components -> component
- Add more methods to layout API interfaces to allow retrieving
information such as padding size and alignment
2024-04-05 17:00:04 -07:00
Jozufozu
09cb15e2ed This context intentionally left blank
- Move Visual*Contexts inside their respective *Visual interfaces
- Acknowledge that TickableVisual.Context has no methods
- api_impl.vert: no need to try to pack in/out variables
2024-04-03 21:23:12 -07:00
Jozufozu
833fadbbdc Much ado
- Go through some TODOs
- Simplify FlatLit interface and directly store packed light
- Rename getters in Events
- Document Effects
- LitVisualStorage: atomics are slow
- BakedModelBufferer: vanilla leaks too, they'll be freed when the game
  exits
2024-04-02 12:36:40 -07:00
Jozufozu
506f2d5158 Unionized threads
- Allow the user to configure the number of worker threads
- Allow the user to disable parallelism entirely without a jvm flag
- Move thread count logic into FlwTaskExecutor and make
  ParallelTaskExecutor simply take a thread count as a parameter
2024-03-31 16:59:53 -07:00
Jozufozu
d5c5b998bc Cache deposits
- Make the scatter shader more cache friendly by doing one copy per
  workgroup and making copies up to 64 uints long
2024-03-31 16:08:12 -07:00
PepperCode1
2ee3944ca6 GLSL to the max
- Always compile with highest supported GLSL version
- Allow indirect shaders to compile with as low as GLSL 420
- Fix GL extension checks for indirect
- Explicitly initialize GlCompat as early as possible to avoid invalid
initialization off render thread
2024-03-31 15:53:23 -07:00
Jozufozu
08476b5779 Delicious words
- Check against totalAvailable in StagingBuffer#reserveForCopy
- Fixes garbage being rendered after uploading large amounts of data
2024-03-31 15:10:56 -07:00
Jozufozu
dfca589c5b Boundless changes
- Fix exception thrown uploading indirect instances when an instance was
  added in the same frame that the tail instance was deleted. We'd leave
  behind some set changed bits out of bounds of the instance list, and
  try to access those indices later
- Add out of bounds guards within forEachSetSpan, though I don't think
  they're actually necessary
- Add AtomicBitset#set and #clear range methods
- Update all changed bits at once when deleting instances rather than
  doing it in the loop
- Start iterating from the first set bit rather than 0 to save
  potentially thousands of iterations
- Smarter model index uploading
2024-03-31 12:56:01 -07:00
Jozufozu
395f4b1dfc Based crumbling
- Fix crumbling on instancing engine by passing a baseInstance uniform
2024-03-29 17:40:49 -07:00
Jozufozu
227d753e73 High noon
- Draw! meshes in contractual order on instancing engine
- Rename DrawSet -> InstancedRenderStage and consolidate associated code
  inside the class
- Re-use GroupKey between engines
- Sort instanced draws based on material and mesh index in model
- Make doCrumblingSort abstract on the instancer class and re-use it
  between engines
2024-03-29 16:33:06 -07:00
Jozufozu
96eb5ea47c Less omissions in mesh emission
- Cannibalize shade separated vertex consumer to function as the mesh
  emitter for baked model buffering
- Create one MeshEmitter per chunk RenderType to allow more coherency
  during multi block buffering
- MeshEmitters own BufferBuilders, and the buffering functions call
  #begin on the mesh emitters directly
- Each time the emitter sees a quad with a different shade flag than the
  previous run of quads, it emits a mesh and begins again
- Finally, the buffering functions call #end on the mesh emitters to
  emit trailing meshes and clear transient state
- Add diffuse debug mode
- Order indirect draws by mesh index first
- Remove non-shade separated option from buffering utilities because it
  allows you to opt in to incorrect behaviour
- Remove TessellatedModel
- Document mesh ordering contract in Model
2024-03-26 12:06:20 -07:00
Jozufozu
183ea1f0f8 Get reset visual
- Remove Visual#shouldReset and associated logic
- Instead, delete and add visuals when the level renderer is notified
  of a block state change (that has a block entity)
- This does remove some control from BEVs, but it greatly simplifies the
  API and API contract
2024-03-25 12:45:53 -05:00
Jozufozu
f0cbce0ae4 24w13oneSectionAtATime
- Hook into ClientChunkCache#onLightUpdate for light updates to be
  compatible with both vanilla and starlight at once
- Bump embeddium/occulus versions
- Move embedding uniform names to static finals and fix culling program
  complaining about missing uniform names
- Light minecart visuals on init
2024-03-25 11:26:36 -05:00
Jozufozu
5775eb863f Single file
- Upload instancers and model indices in separate loops in an
  IndirectCullingGroup
- Reset changed bitset and update last* in separate method
- Don't need to upload instances anymore if the model index changes
2024-03-24 15:30:22 -05:00
Jozufozu
ff7130c71c We need to go deeper
- Compose transformations of embeddings
- Make EmbeddedEnvironment abstract and move light stuffs into
  TopLevelEmbeddedEnvironment
- Add NestedEmbeddedEnvironment that only handles matrices, and tracks
  a parent EmbeddedEnvironment
- AbstractEmbeddedEnvironment handles most of the deletion/update logic,
  and also creates further NestedEmbeddedEnvironments
- EnvironmentStorage now only tracks environments and does not creat
  them.
2024-03-24 15:05:19 -05:00
PepperCode1
277597d6bf The uintification
- Store packed instances in a uint[] in indirect
  - Split the object buffer into an instance buffer and a model index
buffer
  - Rename StructInstanceComponent to SsboInstanceComponent
  - Expand abstraction in InstanceAssemblerComponent to allow both types
of instance assemblers to reuse per-element unpacking generation
- Separate FlwInstance struct generation into separate component,
InstanceStructComponent
  - Also inline LayoutInterpreter into this class
- Move necessary internal definitions for components from api_impl to
common components_header shaders
- Use the same api_impl shader between pipelines
2024-03-24 12:36:48 -07:00
Jozufozu
84515316a7 Smart lighting
- Do not delete light volume memory when invalidated. Keep the block
  around, and then use it again later when we collect more light
- Do not allocate fresh memory blocks when growing a light volume. Turns
  out self-blitting is perfectly fine since we always start from the
  volume's origin
- Inline BoxSet back into light volume. The precise tracking it did is
  no longer relevant now that the embedding api has been simplified
- Light volumes now directly
2024-03-22 13:42:47 -05:00
Jozufozu
cfe6f3901b Like a game of telephone
- Fix overlay via casting
- Saw cortex doing this in nvidium, and it seems obvious in hindsight
2024-03-08 16:06:24 -08:00
Jozufozu
e7a112d773 Embeddebug
- Simplify light invalidation api/impl
  - There are 2 use cases for invalidating collected light:
    - The embedding visual receives a light update
    - The embedding visual moves
  - In either case, it's in the visual's best interest to re-collect any
    light it might need, rather than relying on the impl to copy
    potentially outdated light.
  - Do not sample the light volume if no light is collected
- Improve debug modes
  - Calculate colors in the fragment shader to reflect any per-fragment
    material/embedding alterations to the vertex output
  - Fix light volume debug mode spewing rainbow seizure garbage
  - Add light color debug mode
2024-03-08 13:01:58 -08:00
Jozufozu
2b39b13744 Reset off offsets
- Fix frame uniforms reserving too much space
- Fix level uniforms reserving too little space
- Actually move flw_constantAmbientLight to level uniforms
2024-03-08 12:55:07 -08:00
Cyan
04e66cad59 Add More Uniforms (#231)
Squashed commit history:

* Add basic view.h matrices

* Add last values

* Add clean matrices

* Finish adding most view.h things to frame.glsl

* Document cameraIn- uniforms

* Add options uniform

* Begin on player uniforms

* Add more player uniforms

* Add level uniforms

* Fix uniform bindings

* Update options

* Fix offset alignments

* Add new uniforms to cull shader

* Fix simple things

* Make alpha 1 if team exists but does not have a color

* Fix mixin method names

* Provide all uniforms to cull shaders

* Move constant ambient light uniform to level group

* Level uniforms gets context from context

* Remove `clean` matrices for now
2024-03-05 16:42:51 -08:00
Jozufozu
8c5c89921d Collector's edition
- Track exactly what blocks are contained in a light volume via BoxSet
- Fix segfault when a volume is expanded
- Shrink the volume when enough data is discarded
  - I think the texture management is broken for this case
2024-03-03 21:36:59 -08:00
Jozufozu
e4df896710 Protect the environment
- Environment/Embedding ownership is complicated, reference counting to
  the rescue!
  - VisualEmbeddings are acquired on construction and deleted manually
  - Instancers acquire/delete their environments
  - EmbeddedEnvironment now has three (3) delete methods
- Add EnvironmentStorage to create, track, update, and delete
  environments
- Remove InstancingEngine/IndirectEngine and move shared logic to
  EngineImpl
  - There's probably more that can be done to make DrawManager cleaner
    now
2024-03-03 14:53:07 -08:00
Jozufozu
b90b80c8b0 Turn it up to 11
- Consolidate context shaders into the common shaders, guarded by ifdefs
- Make ContextShaders into an enum
- Cache shaders by name instead of SourceComponents so the defines for
  contexts actually get compiled
- Move all embedding stuff into backend.embed
- Cannibalize GPULightVolume into an api better suited for environments
- Separate light storage from 3d texture management
- Add #delete to Environment
- Add light volume debug mode
2024-03-03 13:14:41 -08:00
Jozufozu
5d142d2f13 Thought I'd need this
- Consolidate common logic from transfer list and scatter list into
  MemoryBuffer
2024-03-03 12:29:25 -08:00
PepperCode1
64aa8d4242 The end of issues with big endianness
- Fix unpacking of some layout elements (only for instancing)
  - All byte backed and short backed elements (incorrect assumption that
system is little endian)
  - All signed byte and signed short elements (missing sign extension)
  - Matrices with byte backed and short backed reprs in some cases
(incorrect assumption that matrix rows are 4 byte aligned)
  - IntegerRepr.INT scalar (invalid implicit cast)
  - FloatRepr.NORMALIZED_INT scalar (missing cast to signed int)
  - IntegerRepr.INT vector (invalid implicit cast)
  - FloatRepr.NORMALIZED_INT vector (missing cast to signed int)
  - FloatRepr.NORMALIZED_SHORT vector (incorrect divisor)
- Add explicit casts from uint to float since some drivers have a bug
where uint over float division is invalid
- Lower GLSL requirement of instancing from 420 to 330
- Fix lib instance writers assuming little endian when writing overlay
and light
- Move overlay clamping to vertex input shader and clamp to 15 instead
of 10
- Create abstract InstanceAssemblerComponent class
- Change return type of SourceComponent.name() to String and improve
implementations
2024-03-03 11:16:38 -08:00
PepperCode1
115aad3d40 Multi-improvements
- Make lib instance shaders multiply color value instead of overriding
it
- Improve MultiBlockModelBuilder
  - Accept an Iterable<BlockPos> instead of a
Collection<StructureBlockInfo> and assume all block state data is
already contained within the render world
  - Accept a Function instead of a Map as the model data lookup
  - Allow enabling fluid rendering (all rendered fluids are currently
unshaded)
- Refactor VirtualEmptyBlockGetter
  - Move elementary implementations into abstract VirtualBlockGetter
class
  - Extract virtual LevelLightEngine into separate VirtualLightEngine
class with ability to lookup light values per pos
  - Turn VirtualEmptyBlockGetter into a class and make all methods final
to ensure instances of this class are actually empty even if subclassed
- Make BakedModelBufferer class package private
- Remove unused VertexTransformations class
- Remove Experimental annotation from
VisualizationContext.createEmbedding
2024-02-29 16:25:20 -08:00
PepperCode1
c3307630b2 A different type of translation
- Display actual backend instead of preferred backend when checking
backend
- Remove engine message and use standard messages that display backend
ID
- Simplify command code
- Replace all literal components with translatable components
- Pass 1 instead of 0 for partialTick on tick
- Extract base AtomicReferenceCounted and ReferenceCounted abstract
classes
- Double buffer capacity instead of adding constant on resize in
VertexWriter
- Move Samplers class from backend.engine to backend
2024-02-28 21:41:16 -08:00
Jozufozu
c931e84b65 More simpler
- Remove Plan#simplify and associated tests
- Neat idea but ineffective in practice
- Should reduce the user burden of implementing plans
2024-02-28 21:23:47 -08:00
Jozufozu
bd70b89621 Backend into a corner
- Make VisualizationContext, InstancerProvider, VisualEmbedding all
  BackendImplemented
- Add Engine#createVisualizationContext
- Remove Engine#instancer and variants
- VisualEmbeddings are created by backends, and data will be pushed into
  them by visuals.
- VisualEmbedding extends VisualizationContext
- The implementation of VisualEmbedding also implements Environment
- Environment is an internal replacement for Context
- Instancers are keyed by Environments
- Default environment is a noop essentially
2024-02-26 18:41:55 -08:00
Jozufozu
4d216b6672 A sample of what's to come
- Clean up texture binder stuff that's no longer needed
- Move all sampler binding to program link time
- Centralize sampler bindings/names to Samplers
- Move diffuse, light, and overlay textures into the api
- Add builder for context shader
- Fix generated_indirect -> generated_instancing
2024-02-26 15:38:11 -08:00
Jozufozu
2c3b4c54ca Stay inline
- Inline all unnecessary context stuff
- Move ContextShaders into backend.compile
- Instancers are parameterized by a nullable VisualEmbedding
  - I don't like this, but the code currently compiles, so I want a
    checkpoint before I try my next idea
2024-02-26 14:50:58 -08:00