leon-o / iris-flw-compat

Enable Flywheel's optimizations when using shaderpacks.
MIT License
39 stars 21 forks source link

Blocks in contraptions don't render when shaderpack real-time shadows are enabled #59

Closed adueppen closed 5 months ago

adueppen commented 11 months ago

I'm using:

This is running on Linux, with an AMD RX 6800 XT GPU. When the real-time shadows in this or any other shaderpack are enabled, contraptions fail to render any ordinary blocks that are part of them. Disabling this mod fixes the issue, but at the expense of reasonable framerates.

Mod enabled: 2023-07-14_00 21 55

Mod disabled: 2023-07-14_00 21 01

MaximilianHollis commented 11 months ago

I can confirm these findings with rendering set to instancing on fabric 1.19.2. In addition, there is some serious log spam: image

image and the Complementary Re-imagined shaderpack.

fentriesjava commented 8 months ago

this is still an issue with 0.2.1, at least on fabric

also running on linux with a 6800 XT. did anyone either of you find a workaround?

amyfromearth commented 7 months ago

Confirmed this is happening for me as well.

Arikelliott commented 7 months ago

Happening on my end as well. RX 6800 XT on Linux. Currently playing the Create Astral modpack. Viewing a contraption while shaders are enabled brings my framerate down into single digits, gives me the GL_INVALID_OPERATION in glDrawElements error repeatedly in my logs, and most blocks in the contraptions don't render.

Disabling real-time shadows does seem to fix it, at least in the Complimentary-based shaderpacks (I haven't tested any others yet).

Currently using:

branan commented 7 months ago

I've been googling around for exactly the same Create Astral issue. I'm away from my home PC for a couple more days for the US holiday, but will test if disabling real-time shadows also fixes the issue for me.

EDIT: I should also be able to play around with RenderDoc a bit. If I have any luck fixing things I'll put up a PR

branan commented 7 months ago

I was able to confirm that turning off real-time shadows fixes the issue for me. I was unfortunately not able to get any debugging done - both RenderDoc and ApiTrace cause java to crash immediately if I try to launch minecraft with them loaded.

If anybody can give me tips for running Minecraft in RenderDoc or ApiTrace on Linux, I'll happily spend more time debugging this. But unfortunately I am sort of stuck.

branan commented 6 months ago

I got ApiTrace working, and managed to track this down :sunglasses:

The issue is that Create's ContraptionProgram hardcodes one of its samplers, which causes a conflict with Iris.

I've tested rebuilding Create with that sampler set to 31 (just to get it way out of the range that Iris might use), and that got dynamic shadow working for me!

I think the correct fix for this is probably to try to use a Mixin to override the Iris list of reserved samplers, but that is far beyond my java skills to implement as a quick PR to this repo without doing a lot more learning about how Mixins work.

EDIT: On second thought, I think just modifying The builder method to always add 4 to the reserved list is probably more robust. Mixins are still dark magic that's outside of my java knowledge, but overriding methods seems better documented than replacing constants? If I can figure it out I'll put up a PR

branan commented 6 months ago

Sorry for the issue update spam, but I dug through the Mixin docs and got this fixed!

The PR is in #86, but for anyone who feels like trusting a jar from a stranger on the internet, you can replace iris-flywheel-compat-1.18.2-0.2.0.jar in your mods folder with my version

Arikelliott commented 6 months ago

My good friend, you're amazing.

I can confirm the fix is working on my end. I tested with the same set of shaders as last time, all are working fine even with realtime shadows re-enabled.

CharmeQuark commented 6 months ago

Sorry for the issue update spam, but I dug through the Mixin docs and got this fixed!

The PR is in #86, but for anyone who feels like trusting a jar from a stranger on the internet, you can replace iris-flywheel-compat-1.18.2-0.2.0.jar in your mods folder with my version

WIll this work as a replacement for the Oculus equivalent compatibility mod?