1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-09-29 15:30:48 +00:00
Commit Graph

1874 Commits

Author SHA1 Message Date
Jonathan Coates
ad228e94a3
Merge remote-tracking branch 'origin/mc-1.16.x' into mc-1.16.x
I hate doing this, but I have too many merges in progress to rebase.
2022-04-26 22:43:22 +01:00
Jonathan Coates
fccca22d3f
Merge branch 'feature/font-rendering-optimise' into mc-1.16.x
This /significantly/ improves performance of the VBO renderer (3fps to
80fps with 120 constantly changing monitors) and offers some minor FPS
improvements to the TBO renderer.

This also makes the 1.16 rendering code a little more consistent with
the 1.18 code, cleaning it up a little in the process.

Closes #1065 - this is a backport of those changes for 1.16. I will
merge these changes into 1.18, as with everything else (oh boy, that'll
be fun).

Please note this is only tested on my machine right now - any help
testing on other CPU/GPU configurations is much appreciated.
2022-04-26 21:43:53 +01:00
Jonathan Coates
4bfdb65989
Use VBO renderer when Optifine is installed
Historically I've been reluctant to do this as people might be running
Optifine for performance rather than shaders, and the VBO renderer was
significantly slower when monitors were changing.

With the recent performance optimisations, the difference isn't as bad.
Given how many people ask/complain about the TBO renderer and shaders, I
think it's worth doing this, even if it's not as granular as I'd like.

Also changes how we do the monitor backend check. We now only check for
compatibility if BEST is selected - if there's an override, we assume
the user knows what they're doing (a bold assumption, if I may say so
myself).
2022-04-26 21:43:21 +01:00
Jonathan Coates
22e8b9b587
Don't render cursors separately
- For TBOs, we now pass cursor position, colour and blink state as
   variables to the shader, and use them to overlay the cursor texture
   in the right place.

   As we no longer need to render the cursor, we can skip the depth
   buffer, meaning we have to do one fewer upload+draw cycle.

 - For VBOs, we bake the cursor into the main VBO, and switch between
   rendering n and n+1 quads. We still need the depth blocker, but can
   save one upload+draw cycle when the cursor is visible.

This saves significant time on the TBO renderer - somewhere between 4
and 7ms/frame, which bumps us up from 35 to 47fps on my test world (480
full-sized monitors, changing every tick). [Taken on 1.18, but should be
similar on 1.16]
2022-04-26 21:43:21 +01:00
Jonathan Coates
77a00b14ae
Use UBOs for the TBO renderer
Like #455, this sets our uniforms via a UBO rather than having separate
ones for each value. There are a couple of small differences:

 - Have a UBO for each monitor, rather than sharing one and rewriting it
   every monitor. This means we only need to update the buffer when the
   monitor changes.

 - Use std140 rather than the default layout. This means we don't have
   to care about location/stride in the buffer.

Also like #455, this doesn't actually seem to result in any performance
improvements for me. However, it does make it a bit easier to handle a
large number of uniforms.

Also cleans up the generation of the main monitor texture buffer:

 - Move buffer generation into a separate method - just ensures that it
   shows up separately in profilers.
 - Explicitly pass the position when setting bytes, rather than
   incrementing the internal one. This saves some memory reads/writes (I
   thought Java optimised them out, evidently not!). Saves a few fps
   when updating.
 - Use DSA when possible. Unclear if it helps at all, but nice to do :).
2022-04-26 21:43:21 +01:00
Jonathan Coates
78aa757549
Memorize getRenderBoundingBox
This takes a non-trivial amount of time on the render thread[^1], so
worth doing.

I don't actually think the allocation is the heavy thing here -
VisualVM says it's toWorldPos being slow. I'm not sure why - possibly
just all the block property lookups? [^2]

[^1]: To be clear, this is with 120 monitors and no other block entities
with custom renderers. so not really representative.

[^2]: I wish I could provide a narrower range, but it varies so much
between me restarting the game. Makes it impossible to benchmark
anything!
2022-04-26 21:43:21 +01:00
Jonathan Coates
1196568a7c
Use Ű̶̹̚n̵̦̂́s̷̭̲͐a̶̞͔̔f̸̠́̀e̵͔̋̀ to upload the monitor's contents
The VBO renderer needs to generate a buffer with two quads for each
cell, and then transfer it to the GPU. For large monitors, generating
this buffer can get quite slow. Most of the issues come from
IVertexBuilder (VertexConsumer under MojMap) having a lot of overhead.

By emitting a ByteBuffer directly (and doing so with Unsafe to avoid
bounds checks), we can improve performance 10 fold, going from
3fps/300ms for 120 monitors to 111fps/9ms.

See 41fa95bce4 and #1065 for some more
context and other exploratory work. The key thing to note is we _need_ a
separate version of FWFR for emitting to a ByteBuffer, as introducing
polymorphism to it comes with a significant performance hit.
2022-04-26 21:43:21 +01:00
Jonathan Coates
48c4f397f9
Backport some text rendering code from 1.18
- Move all RenderType instances into a common class.

Cherry-picked from 41fa95bce4:
 - Render GL_QUADS instead of GL_TRIANGLES.

 - Remove any "immediate mode" methods from FWFR. Most use-cases can be
   replaced with the global MultiBufferSource and a proper RenderType
   (which we weren't using correctly before!).

   Only the GUI code (WidgetTerminal) needs to use the immediate mode.

 - Pre-convert palette colours to bytes, storing both the coloured and
   greyscale versions as a byte array.

Cherry-picked from 3eb601e554:
 - Pass lightmap variables around the various renderers. Fixes #919 for
   1.16!
2022-04-26 17:56:43 +01:00
Jonathan Coates
8871f40ced
Move FWFR into a separate package
Just a precursor to doing any work on it.
2022-04-26 16:27:49 +01:00
Jonathan Coates
aa62c1f206
Remove redundant CSS in src/web/styles.css
Moved to illuaminate itself
2022-04-26 16:20:04 +01:00
Jonathan Coates
fd32b06d6f
Merge pull request #1078 from Hasaabitt/patch-1
Fixed typo
2022-04-24 22:51:21 +01:00
Hasaabitt
739d6813c0
Fixed typo
"Instead, it is a standard program, which its API into the programs that it launches."
becomes
"Instead, it is a standard program, which injects its API into the programs that it launches."
2022-04-24 16:56:31 -04:00
Jonathan Coates
daf81b897a
Use vector helpers to convert BlockPos to Vector3d
A little shorter and more explicit than constructing the Vector3d
manually. Fixes an issue where sounds were centered on the bottom left
of speakers, not the middle (see cc-tweaked/cc-restitched#85).
2022-04-22 09:30:04 +01:00
Jonathan Coates
e865d96f7b
Fix some typos in the colors API
Closes #1072
2022-04-16 21:14:43 +01:00
Jonathan Coates
79b1872cab
Fall back to the given side if the internal one isn't provided
See #1061, closes #1064.

Nobody ever seems to implement this correctly (though it's better than
1.12, at least we've not seen any crashes), and this isn't a fight I
care enough about fighting any more.
2022-04-08 10:12:41 +01:00
Jonathan Coates
2a92794da3
Merge pull request #1055 from bclindner/mc-1.16.x
Documentation fix for rednet.broadcast
2022-03-27 17:40:33 +01:00
Brian C. Lindner
b3e009cca5
doc fix 2022-03-27 16:12:42 +00:00
Jonathan Coates
2c64186965
Bump version to 1.100.4 2022-03-23 08:36:09 +00:00
Jonathan Coates
31ba17d085
Don't wait for the chunk to be loaded when checking for monitors
There's a couple of alternative ways to solve this. Ideally we'd send
our network messages at the same time as MC does
(ChunkManager.playerLoadedChunk), but this'd require a mixin.

Instead we just rely on the fact that if the chunk isn't loaded,
monitors won't have done anything and so we don't need to send their
contents!

Fixes #1047, probably doesn't cause any regressions. I've not seen any
issues on 1.16, but I also hadn't before so ¯\_(ツ)_/¯.
2022-03-18 19:59:02 +00:00
Jonathan Coates
bcc7dd6991
Fix typo in Javadoc 2022-03-02 12:54:59 +00:00
Jonathan Coates
bd36185662
Bump version
Holding off until Forge releases for 1.18.2
2022-02-28 15:35:16 +00:00
Jonathan Coates
045c4fc88c
Merge pull request #1027 from Toad-Dev/issue-1026
Fix large file uploads producing oversized packets.
2022-02-28 11:06:59 +00:00
Jonathan Coates
e0fcc425c6
Prevent id map being null when file is empty
Fixes #1030
2022-02-28 11:01:04 +00:00
Jonathan Coates
e01895d719
Remove turtle_player EntityType
This was added in the 1.13 update and I'm still not sure why. Other mods
seem to get away without it, so I think it's fine to remove.

Also remove the fake net manager, as that's part of Forge nowadays.

Fixes #1044.
2022-02-28 10:34:41 +00:00
Jonathan Coates
87b38f4249
Fix incorrect recipe name in turtle advancement 2022-02-28 10:32:33 +00:00
Toad-Dev
60d1d1bb18 Fix large file uploads producing oversized packets.
- Fixes #1026
- The remaining bytes counter wasn't being decremented, so the code that
  splits off smaller packets was unreachable. Thus all file slices were
  being put into a single UploadFileMessage packet.
2022-01-23 22:31:27 -08:00
Jonathan Coates
cdf8b77ffd
Merge pull request #1017 from Possseidon/patch-1
Fix table with mouse button codes in documentation.
2022-01-20 12:40:09 +00:00
Possseidon
e2ce52fe81
Fix table with mouse button codes.
Codes for right and middle mouse buttons were swapped.
2022-01-19 17:39:19 +01:00
Jonathan Coates
9cf70b10ef
Bump version 2022-01-14 22:58:19 +00:00
Jonathan Coates
9ac8f3aeea
Fix wired modems having incorrect blockstate
Fixes #1010
2022-01-14 15:37:49 +00:00
Jonathan Coates
e191b08eb5
Use Guava instead of commons-codec for hex encoding
The latter was removed in 1.18 on the server side.

Fixes #1011.
2022-01-14 15:35:58 +00:00
Jonathan Coates
a1221b99e1
Remove debugging log line
Fixes #1014
2022-01-14 14:45:55 +00:00
Jonathan Coates
85bced6b1d
Merge pull request #1015 from Paspartout/patch-1
speaker_audio.md: Fix missing add/sum typo
2022-01-14 10:55:08 +00:00
Paspartout
fc4569e0cc
speaker_audio.md: Fix missing add/sum typo 2022-01-13 17:36:26 +01:00
Weblate
e7f08313d9 Translations for Danish
Co-authored-by: Christian L.W <christianlw@hotmail.dk>
Co-authored-by: Christian L.W. <christianlw@hotmail.dk>
2022-01-02 23:29:24 +00:00
Jonathan Coates
79fc8237b6
Bump version to 1.100.1
My new years resolution is to make no more CC:T commits.
2022-01-01 15:36:03 +00:00
Jonathan Coates
9d50d6414c
Happy new year
Should be the last time I'll have to do this!
2022-01-01 00:09:34 +00:00
Jonathan Coates
16df86224b
Fix pocket speakers incorrectly detaching computers
- Fix UpgradeSpeakerPeripheral not calling super.detach (so old
   computers were never cleaned up)
 - Correctly lock computer accesses inside SpeakerPeripheral

Fixes #1003.

Fingers crossed this is the last bug. Then I can bump the year and push
a new release tomorrow.
2021-12-31 18:24:54 +00:00
Jonathan Coates
a9519f68a1
Clarify term_resize event
Closes #1000, fixes #999.

Co-authored-by: Wojbie <Wojbie@gmail.com>
2021-12-31 18:16:36 +00:00
Jonathan Coates
f1a08a3362
Merge pull request #1002 from Toad-Dev/issue-1001
Fix hasTypeRemote not working with additional types. (#1001)
2021-12-31 18:14:14 +00:00
Toad-Dev
802949d888 Fix hasTypeRemote not working with additional peripheral types.
Fixes #1001. Looks like the culprit was a simple typo.
2021-12-26 21:18:40 -08:00
Jonathan Coates
e558b31b2b
Fix some typos in a dfpwm example 2021-12-21 22:25:16 +00:00
Jonathan Coates
afd82fbf1f
Add speaker support to the documentation website
Happy to pick a different piece of audio, but this seemed like a fun one
to me.
2021-12-21 22:20:57 +00:00
Jonathan Coates
f470478a0f
Bump CC:T version to 1.100
We're still a few days away from release, but don't think anything else
is going to change. And I /really/ don't want to have to write this
changelog (and then merge into later versions) on the 25th.
2021-12-21 14:55:01 +00:00
Jonathan Coates
aa009df740
Improve fs API introduction
Again, not perfect, but better than a single sentence.
2021-12-21 14:39:08 +00:00
Jonathan Coates
0c6c0badde
Move turtle docs into the Java code instead
Yeah, should have seen that coming
2021-12-21 12:00:13 +00:00
Jonathan Coates
bed2e0b658
Write an introduction to the turtle API
It's better at least, I just don't know if it's good.
2021-12-21 11:53:46 +00:00
Jonathan Coates
0f9ddac83c
Copy and paste the wiki guide on require
I wrote the original, so I don't need to feel guilty :)

Closes #565.
2021-12-21 00:55:16 +00:00
Jonathan Coates
932b77d7ee
Rewrite several doc introductions
Mostly focussing on rednet and modem here. Not sure if I made them any
better, we'll see!
2021-12-21 00:27:07 +00:00
Jonathan Coates
5eedea1bbb
Don't push non-pushable entities
Fixes #949
2021-12-20 17:58:39 +00:00