Skip to content

Abstract away from just about everything#136

Draft
DaMatrix wants to merge 683 commits intomasterfrom
dev/abstract-everything
Draft

Abstract away from just about everything#136
DaMatrix wants to merge 683 commits intomasterfrom
dev/abstract-everything

Conversation

@DaMatrix
Copy link
Copy Markdown
Member

@DaMatrix DaMatrix commented Dec 23, 2021

This is a huge PR (which, in retrospect, probably should have been broken up into multiple smaller PRs). In combination with #117, it makes the vast majority of the codebase be able to operate entirely independently of the Minecraft version being used.

Additional major changes include:

  • The tile size for heightmap and voxel modes are now separate. The replacements for T_SHIFT and related constants are now to HeightmapConstants/VoxelConstants
  • The makefile-based system for compiling native code has been replaced with a Gradle plugin. This should make future changes substantially easier.
  • GUI code is completely rewritten.
  • All of the static event handler classes have been replaced with a universal FEventBus, which uses a familiar annotation-based event subscription system. It supports a few additional features not commonly found in other event buses, such as the ability to weakly reference a registered handler object, and generic parameter matching.
  • The @DebugOnly annotation is now gone. Debug statistics and related features are now available outside of debug mode.
  • Logging is now routed through a PorkLib Logger, as are messages which appear in the client-side chat menu.

With the exception of the :gl module and children (which are handled by #117), nearly everything is affected in some way.

Known shortcomings:

  • GPU frustum culling will currently crash on heightmap mode.

@DaMatrix DaMatrix self-assigned this Dec 23, 2021
@DaMatrix DaMatrix force-pushed the dev/abstract-everything branch from bf1527f to 22cc032 Compare February 16, 2022 20:26
@nickcat1
Copy link
Copy Markdown

I've tested this and it works well. You should mark this for review.

@DaMatrix
Copy link
Copy Markdown
Member Author

DaMatrix commented Nov 16, 2022

there is still some work required before i can merge this: most importantly, i need to make heightmap mode actually work with the abstracted API, which i'm currently doing on dev/abstract-heightmap-gen.

once that's done, i also still want to do a last round of refactoring in order to minimize the amount of duplicated code between versions, and move more stuff to the :api module to make it more useful.

DaMatrix added 25 commits April 28, 2024 13:17
…hing again!

doesn't seem to render anything, though
apparently the standard preprocessor really can't handle true/false literals, we have to use 1/0 instead
the vertex shader needs to actually feed the right color into the outputs
terrain now renders again! on the other hand, the lightmap texture seems to be misconfigured AGAIN.
rather than (quite badly) guessing the size of the OS send window, i've turned it into a system which relies on platform-specific methods to implement flow control. currently, this is only implemented for the following:
- local (singleplayer) connections, which use no flow control at all
- servers using Epoll (Linux), where Netty exposes an interface to set TCP_NOTSENT_LOWAT on the underlying native socket to a low value, as described in https://blog.cloudflare.com/http-2-prioritization-with-nginx/

other connections currently have no optimizations, and will "flow control" comparatively poorly by simply sending packets until the OS send window fills up. however, this isn't a priority, as the only two platforms in question are Windows and OSX, neither of which are commonly used for hosting servers - likely the only time servers will be run on these platforms is for LAN worlds, where flow control will be less important anyway thanks to a (presumably) fast LAN.
note to self: it helps if you run your code after you change it. i really need to figure out how to run integration tests on the entire game...
# Conflicts:
#	common/src/main/java/net/daporkchop/fp2/common/util/alloc/DirectMemoryAllocator.java
...as well as glFlush() and glGetBufferParameteri()
also added a method for getting values from an index writer
wow, this is a lot cleaner! i should start using this everywhere...
…rtices

this isn't actually used, but will be useful to have readily available while debugging other issues
DaMatrix added 30 commits May 13, 2025 18:57
This includes the ability to get directly into an array
We still don't actually use this anywhere, but this allows us to split shader compilation/linkage into two phases, which may enable drivers to do much of the expensive work in the background.
also, precompute the version header and store it in the OpenGL context object to save some string concatenations
unfortunately some drivers seem to ignore it, making it rather useless
… in debug mode

this makes apitrace output much less overwhelming
this eliminates the need for manually extracting clipping planes from the projection matrix
This is enough to fill exactly one wave on AMD devices, and two warps on Nvidia. In either case this should give the compiler more freedom with regards to register allocation, and so on, as smaller workgroup sizes means that all workgroup resources are freed up immediately when the warp completes.

(This should eventually be made dynamic based on GPU type, but for now this is good enough. I really wish OpenGL had some way to say "please choose the best workgroup size for me" for shaders with no communication between threads, though...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants