Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken rendering of shaders on AMD cards #240

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

joshua-software-dev
Copy link

This fix has been tested with the following shader packs:

BSL_v8.2.zip
MakeUp-UltraFast-8.6g.zip
Sildur's+Enhanced+Default+v1.141+Fast.zip

with the following hardware configurations:

i7 6700HQ + Nvidia GTX 1070, driver version 497.29, w/ Windows 10 OpenJDK 8
AMD Ryzen 5600x + AMD RX 6900 XT, amdgpu driver on mesa 22.2.3-1, w/ Arch Linux GraalVM EE 22.3.0 JDK 8 and 11
i5-3210M + iGPU [Max OpenGL Level = 4.2], i915 driver on mesa 22.2.3-1, w/ Arch Linux OpenJDK 8

on all configurations, I saw correct rendering of all tested shaders. Earlier reports from me that there may have been some incorrect rendering were due to incompatibilities with flywheel. After removing flywheel, all shaders rendered accurately in my limited investigation. Of the tested shaders, BSL and MakeUp both worked without errors even with flywheel installed. Silder's, however causes a ton of log spam and has various graphical issues (see log example posted here: #226 (comment)). This is a regression compared to v1.2.6, which did not spam the log with errors (and render broadly incorrectly) while flywheel was installed and Silder's shader was loaded. However, MakeUp had many issues with layered transparency and replections (ex: water behind glass), and incorrect underwater rendering with flywheel in 1.2.6. These particular problems are resolved in 1.4.3 with this fix, so its unclear if changes to centerDepth.fsh are to blame. This is especially true given that reported incompatibilities between Silder's shaders and flywheel exist even in newer minecraft versions (see Sildurs-shaders/sildurs-shaders.github.io#242)

TL;DR: I think this fix is safe to merge for all hardware given that it worked correctly when tested on AMD, Intel, and Nvidia systems. It has exposed potential new bugs needing addressing (and the possibility that the this fix is causing them has not been 100% ruled out), but it is an improvement over the current 1.4.3 state.

The changed file can even be merged into existing 1.4.3 jar files to provide the fix, should this PR not get merged or take some time to get merged for the impatient.

@joshua-software-dev
Copy link
Author

For those who need help applying the fix:
https://github.com/joshua-software-dev/Oculus/releases/tag/1.4.3-amdpatched

@ZZZank
Copy link

ZZZank commented Dec 3, 2022

it worked, on my Vega8. love it.

@michaelgosling
Copy link

works on my machine! now if only 1.4.3 didnt cause chest color bugs...

@Asek3
Copy link
Owner

Asek3 commented Jan 5, 2023

Was fixed in 1.4.5

@Asek3 Asek3 closed this Jan 5, 2023
@kiririnou
Copy link

Issue is still present on 1.4.5.
Downgrading to fixed 1.4.3 from @joshua-software-dev above still works.

OS: Windows 8.1 (6.3)
CPU: 4x AMD A8-6410 APU with AMD Radeon R5 Graphics
GPU: AMD Radeon(TM) R5 Graphics (Supports OpenGL 4.5.13493 Compatibility Profile Context 22.19.693.1536)
Minecraft version: 1.16.5
Rubidium version: 0.2.11

[17:47:57] [main/WARN]: Shader compilation log for centerDepthSmooth.fsh: Fragment shader failed to compile with the following errors:
ERROR: 0:12: error(#133) Reserved word: output
ERROR: 0:12: error(#132) Syntax error: "output" parse error
ERROR: error(#273) 2 compilation errors.  No code generated


[17:47:57] [main/ERROR]: Failed to create shader rendering pipeline, disabling shaders!
java.lang.RuntimeException: Failed to compile FRAGMENT shader for program centerDepthSmooth.fsh
	at net.coderbot.iris.gl.program.ProgramBuilder.buildShader(ProgramBuilder.java:99) ~[?:?]
	at net.coderbot.iris.gl.program.ProgramBuilder.begin(ProgramBuilder.java:50) ~[?:?]
	at net.coderbot.iris.postprocess.CenterDepthSampler.<init>(CenterDepthSampler.java:63) ~[?:?]
	at net.coderbot.iris.pipeline.DeferredWorldRenderingPipeline.<init>(DeferredWorldRenderingPipeline.java:222) ~[?:?]
	at net.coderbot.iris.Iris.createPipeline(Iris.java:651) [?:?]
	at net.coderbot.iris.Iris$$Lambda$2889/1950158148.apply(Unknown Source) [?:?]
	at net.coderbot.iris.pipeline.PipelineManager.preparePipeline(PipelineManager.java:34) [?:?]
	at net.coderbot.iris.Iris.reload(Iris.java:594) [?:?]
	at net.coderbot.iris.apiimpl.IrisApiV0ConfigImpl.setShadersEnabledAndApply(IrisApiV0ConfigImpl.java:28) [?:?]
	at net.coderbot.iris.gui.screen.ShaderPackScreen.applyChanges(ShaderPackScreen.java:522) [?:?]
	at net.coderbot.iris.gui.screen.ShaderPackScreen.lambda$init$1(ShaderPackScreen.java:207) [?:?]
	at net.coderbot.iris.gui.screen.ShaderPackScreen$$Lambda$10585/1836484966.onPress(Unknown Source) [?:?]
	at net.minecraft.client.gui.widget.button.Button.func_230930_b_(SourceFile:33) [?:?]
	at net.minecraft.client.gui.widget.button.AbstractButton.func_230982_a_(SourceFile:16) [?:?]
	at net.minecraft.client.gui.widget.Widget.func_231044_a_(Widget.java:136) [?:?]
	at net.minecraft.client.gui.INestedGuiEventHandler.func_231044_a_(SourceFile:27) [?:?]
	at net.minecraft.client.MouseHelper.func_198033_b(MouseHelper.java:87) [?:?]
	at net.minecraft.client.MouseHelper$$Lambda$8808/1379026902.run(Unknown Source) [?:?]
	at net.minecraft.client.gui.screen.Screen.func_231153_a_(Screen.java:427) [?:?]
	at net.minecraft.client.MouseHelper.func_198023_a(MouseHelper.java:85) [?:?]
	at net.minecraft.client.MouseHelper.func_228030_c_(MouseHelper.java:181) [?:?]
	at net.minecraft.client.MouseHelper$$Lambda$8807/1933312427.run(Unknown Source) [?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(SourceFile:94) [?:?]
	at net.minecraft.client.MouseHelper.func_228028_b_(MouseHelper.java:180) [?:?]
	at net.minecraft.client.MouseHelper$$Lambda$7211/739409071.invoke(Unknown Source) [?:?]
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) [lwjgl-glfw-3.2.2.jar:build 10]
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10]
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) [lwjgl-glfw-3.2.2.jar:build 10]
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(SourceFile:102) [?:?]
	at net.minecraft.client.MainWindow.func_227802_e_(MainWindow.java:306) [?:?]
	at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:997) [?:?]
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?]
	at net.minecraft.client.main.Main.main(Main.java:184) [?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37) [forge-1.16.5-36.2.39.jar:36.2]
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$495/523331047.call(Unknown Source) [forge-1.16.5-36.2.39.jar:36.2]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?]
Caused by: java.lang.RuntimeException: Shader compilation failed, see log for details
	at net.coderbot.iris.gl.shader.GlShader.createShader(GlShader.java:46) ~[?:?]
	at net.coderbot.iris.gl.shader.GlShader.<init>(GlShader.java:25) ~[?:?]
	at net.coderbot.iris.gl.program.ProgramBuilder.buildShader(ProgramBuilder.java:97) ~[?:?]
	... 43 more

@Asek3 Asek3 reopened this Sep 5, 2023
@Asek3 Asek3 merged commit bb4c510 into Asek3:1.16.5 Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants