sp614x / optifine

1.8k stars 418 forks source link

Shaders do not work on Linux with Mesa #420

Open SuicSoft opened 7 years ago

SuicSoft commented 7 years ago

On Mesa (latest) the non-core OpenGL does not support GLSL versions higher than 1.3 (this is intentional).

I asked them on IRC about this and they say that if Minecraft wants a GLSL version higher than 1.3 it should request a for profile. So Optifine should request a core profile when shaders are used.

dark-penguin commented 4 years ago

Ummm this is strange, because it does not work for me on Kubuntu 18.04. Not even on Kubuntu 20.04, and it has much newer stuff. Maybe you have a newer graphics card, or maybe you are using radeon driver?.. (And which shaders exactly have you seen working?)

williambl commented 4 years ago

I'm using the R9 390X, which is riddled with so many problems on Linux that I'm surprised this one thing works well :p

As far as I know, I'm using amdgpu. lsmod shows both amdgpu and radeon kernel modules being loaded though, so I'm not sure what's going on there.

Off the top of my head, BSL and Sildur's are what I've used recently. I know Sildur's worked anyway, but I always used to get invalid program messages (even though it seemed fine visually) - I don't get those any more.

dark-penguin commented 4 years ago

I'm on R9 290, which is quite similar. I don't have radeon showing up in lsmod . I don't have it blacklisted, but I do have the kernel parameters to use AMDGPU rather than Radeon. (Can you rmmod radeon or rmmod amdgpu? Maybe one of them is not used?.. And to make sure, cat /var/log/Xorg.0.log |grep AMDGPU to make sure you are using it.)

Sildur's work even for me, and I did not try BSL. But projectLUMA, Lagless, and SEUS definitely do not work.

EDIT: that's assuming you're not on wayland... :)

williambl commented 4 years ago

image Ah, nevermind. looks like radeon is the one that's actually running, not amdgpu.

dark-penguin commented 4 years ago

Soooo the idea to switch to amdgpu is actually making things worse?.. %) But maybe the performance is better. Maybe I'll try to confirm this, and maybe do a comparison just for fun and "for science" if I'm in the mood for that. :)

aduskett commented 4 years ago

For what it's worth, I am running amdgpu on a 560x with Fedora32, and shaders do not work. The rest of the system works just fine without issues.

dark-penguin commented 4 years ago

Yeah, so indeed amdgpu does not work even on the latest drivers, but radeon does even on old ones.

@williambl , I don't think our cards are a pain on Linux. Quite the opposite, we have a choice between AMDGPU and radeon - and I don't think you can use radeon with newer cards. They are stuck with amdgpu and no shaders. :)

@aduskett , Sildur's shaders will work - I've tried them on a RX550 (on Debian Buster). Those are my favorite, so I'm happy as it is. :) Just disable "Sky blur".

williambl commented 4 years ago

@dark-penguin your card isn't a pain, but the 390x has stability issues - e.g. you need to turn off auto power management and force high performance mode 24/7 or it can crash the whole machine. It's weird, since they are practically the same card ¯\_ (ツ) _/¯

Anyway, I'm glad it works for some of us :)

dark-penguin commented 4 years ago

I've tried amdgpu (not "pro") on Ubuntu 20.04 with oibaf PPA. And it works. So I can confirm that "it's fixed in the newer versions", but the "newer" version of Mesa is 20.2.

@williambl I knew they are basically the same card, and I didn't think it could be that much different. :) Good thing I did not "upgrade" to it when I wanted to...

MightyCreak commented 4 years ago

Same here: [Shaders] Error: Invalid program "filename"

System info:

Screenshot of the shaders preferences: Capture d’écran de 2020-05-28 15-38-15

I'll try again once Mesa 20.1 will arrive in Fedora.

miiichael commented 4 years ago

Most versions of SEUS have never worked very well on AMD GPUs. Maybe try one of the more actively-maintained shaders? eg. chocapic13/BSL and their derivatives. Or wait until Sonic Ether releases a public version of SEUS. BTW there are a bunch of shader-specific options behind that "Shader Options" button in the lower-right corner.

eiglow commented 4 years ago

SEUS Renewed also doesn't work for me, but every other shader I've tried works well enough. That includes BBVanillaReborn, BSL, Sildur's Enhanced Default, and Sildur's Vibrant Shaders. They also perform quite well on my Vega 56 as long as I force it to its highest performance state. This is with Mesa 20.2-devel and Kernel 5.7.6, on Fedora 32.

rhjdvsgsgks commented 4 years ago

i found a environment value force_glsl_extensions_warn=true form this video , after set that seus renewed (and some shaders based on it) work for me , but still a bunch of shaders completely not working (like iterationT and Continuum RT) . on the other hand , nothing to do with this environment value , some shaders still works but have some bugs , such as seus ptgi (no shadow) and Continuum 2.1 Alpha ( strange on high place as the picture below , it should be like this video if no bugs ) 2020-07-14_23 21 00 2020-07-14_22 59 19 2020-07-14_22 59 06

i'm using 5700xt with mesa 20.1.3 on wayland (minecraft run with xwayland) , kernel modules is amdgpu (not radeon) , minecraft 1.15.2 with fabric 0.8.9+build.203 + Optifabric 1.0.0 + preview_OptiFine_1.15.2_HD_U_G1_pre30

rhjdvsgsgks commented 4 years ago

i found a environment value force_glsl_extensions_warn=true form this video , after set that seus renewed (and some shaders based on it) work for me , but still a bunch of shaders completely not working (like iterationT and Continuum RT) . on the other hand , nothing to do with this environment value , some shaders still works but have some bugs , such as seus ptgi (no shadow) and Continuum 2.1 Alpha ( strange on high place as the picture below , it should be like this video if no bugs ) 2020-07-14_23 21 00 2020-07-14_22 59 19 2020-07-14_22 59 06

i'm using 5700xt with mesa 20.1.3 on wayland (minecraft run with xwayland) , kernel modules is amdgpu (not radeon) , minecraft 1.15.2 with fabric 0.8.9+build.203 + Optifabric 1.0.0 + preview_OptiFine_1.15.2_HD_U_G1_pre30

after update mesa to 20.3.0 ( and update fabric to 0.9.2 build 206 ) , Continuum 2.1 Alpha seems work fine even on high place , the blue and red corner was not appear anymore . but after this update , force_glsl_extensions_warn=true will cause game crash at the beginning ( as the report at here ) , so i had to rurn it off , therefore seus renewed (and some shaders based on it) can't work anymore 2020-08-28_23 01 49 2020-08-28_23 08 07

rhjdvsgsgks commented 3 years ago

in the resent version of mesa (20.3.0-devel (git-eb104e949e)) , force_glsl_extensions_warn will not crash game anymore, and some poblem has already fixed too (such as godray passthrough the block and no shadow of trees) , but it still have some poblem on the reflection of water when using ptgi e12, the reflection of trees in the water will only showed as some voxel pixel

pic

and here is the log maybe related to it

[Render thread/ERROR] [ne.op.sh.SMCLog/]: [Shaders] OpenGL error: 1282 (Invalid operation), program: shadow, at: shadow translucent
[Render thread/ERROR] [minecraft/GlDebugTextUtils]: OpenGL API ERROR: 5 (GL_INVALID_OPERATION in glMultiDrawArrays(mode=GL_QUADS vs geometry shader input GL_TRIANGLES))
java.lang.Exception: Stack trace
    at org.lwjgl.opengl.GL11C.glGetError(Native Method) ~[lwjgl-opengl-3.2.2.jar:build 10] {}
    at org.lwjgl.opengl.GL11.glGetError(GL11.java:2729) ~[lwjgl-opengl-3.2.2.jar:build 10] {}
    at com.mojang.blaze3d.platform.GlStateManager.func_227629_Q_(GlStateManager.java:1764) ~[?:?] {re:classloading,xf:OptiFine:default}
    at net.optifine.shaders.Shaders.checkGLError(Shaders.java:1930) ~[?:?] {re:classloading}
    at net.optifine.shaders.ShadersRender.renderShadowMap(ShadersRender.java:357) ~[?:?] {re:classloading}
    at net.optifine.shaders.Shaders.beginRender(Shaders.java:4256) ~[?:?] {re:classloading}
    at net.minecraft.client.renderer.GameRenderer.func_228378_a_(GameRenderer.java:935) ~[?:?] {re:classloading,pl:accesstransformer:B,xf:OptiFine:default}
    at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:691) ~[?:?] {re:classloading,pl:accesstransformer:B,xf:OptiFine:default}
    at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:951) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:582) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:184) ~[minecraft-1.16.1-client.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {}
    at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) ~[forge-1.16.1-32.0.108-launcher.jar:32.0] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-6.1.1.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-6.1.1.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-6.1.1.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-6.1.1.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-6.1.1.jar:?] {}
    at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:50) [ForgeWrapper-1.4.2.jar:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {}
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:196) [NewLaunch.jar:?] {}
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:231) [NewLaunch.jar:?] {}
    at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?] {}
    at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?] {}

and still a lot of shaders completely not working (like iterationT , Continuum RT and ptgi hrr) as before.

JAicewizard commented 3 years ago

does continuum non-rt work with the new Mesa? A long time ago I went through the continuum shader debugging it a bit, and a lot of the shader code for continuum was completely incorrect and not following the specifications. The only reason it worked is because windows drivers accepted old shader code in newer versions of opengl. After fixing that I got it running, but it was still incorrect, with lots of artifacts and looking at the sun/a dark shadow basically made the screen black/white(not grayscale). I am hoping both of those issues are fixed now.

rhjdvsgsgks commented 3 years ago

yes, Continuum 2.1 Alpha 10 seems work fine with force_glsl_extensions_warn=true , and that environment variable is used to let mesa "accepted old shader code in newer versions of opengl."(as you said before)

rhjdvsgsgks commented 3 years ago

hey everyone i write a simple patch that can let ptgi hrr work with mesa 20.3.0-devel (git-eb104e949e)

diff --color -r SEUS_PTGI_HRR_Test/shaders/composite7.fsh SEUS_PTGI_HRR_Test_fix/shaders/composite7.fsh
246c246
<       float writeMask = (pixSourceCoord % DOWNSCALE_FACTOR_MULT == 0 ? 1.0 : 0.0);
---
>       float writeMask = (pixSourceCoord % DOWNSCALE_FACTOR_MULT == ivec2(0,0) ? 1.0 : 0.0);

pic seems like in ptgi hrr the size of water reflection voxel pixel is 2 times ptgi e12 pic and no shadow in this version edit: both ptgi hrr and e12 dont have shadow in 1.15.2 with optifine g1 pre30 and have shadow in 1.16.1 with optifine g2

JAicewizard commented 3 years ago

hmm I cant seem to run continuum 2.0.4 with force_glsl_extensions_warn=true and 20.3.0-devel (git-a1d6c03e2f), just a black screen and the same errors as without force_glsl_extensions_warn=true

rhjdvsgsgks commented 3 years ago

@JAicewizard you should trying newer version of mesa than that, this bug seems fixed in recent version

JAicewizard commented 3 years ago

a1d6c03e2f is the third most recent commit, eb104... is from october 28th, the version I am running should include that patch. Maybe the continuum 2.0 shader doesn't run for a different reason than this patch addresses, I cant try 2.1 but I hope that resolves it.

rhjdvsgsgks commented 3 years ago

@JAicewizard sorry, i didn't noticed merge time (not commit time) before, i will try continuum 2.0.4 later and feedback to you :D

rhjdvsgsgks commented 3 years ago

@JAicewizard i tried it, seems like continuum 2.0.4 also not work for me(black screen, same as you) edit: im tring to fix it, at least it not blackscreen anymore XD pic

rhjdvsgsgks commented 3 years ago

after adding allow_glsl_extension_directive_midshader=true , iterationT works, but still some error in the log

pic

JAicewizard commented 3 years ago

This is what I got using continuum 2.0.2. I send the code to continuum graphics at aug 2019, their response was (paraphrasing) "we don't do any development for 2.0.2 anymore, we might add a hotfix for 2.0 after 2.1 is done. We will consider this in 2.1" Basically all I did was replace types with proper up-to-date types, and maybe some small fixes but it was a while ago. This also explains why 2.1 does work (I hope), they applied basically what I did but to 2.1.

continuum Continuum-2.0.2.zip

rhjdvsgsgks commented 3 years ago

after applying this patch, continuum 2.0.4 works

diff --color -r continuum-2.0.4/shaders/composite1.fsh continuum-2.0.4_fix/shaders/composite1.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/composite1.vsh continuum-2.0.4_fix/shaders/composite1.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/composite2.fsh continuum-2.0.4_fix/shaders/composite2.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/composite2.vsh continuum-2.0.4_fix/shaders/composite2.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/composite3.fsh continuum-2.0.4_fix/shaders/composite3.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/composite3.vsh continuum-2.0.4_fix/shaders/composite3.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/composite.fsh continuum-2.0.4_fix/shaders/composite.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/composite.vsh continuum-2.0.4_fix/shaders/composite.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/deferred.fsh continuum-2.0.4_fix/shaders/deferred.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/deferred.vsh continuum-2.0.4_fix/shaders/deferred.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/final.fsh continuum-2.0.4_fix/shaders/final.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/final.vsh continuum-2.0.4_fix/shaders/final.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_armor_glint.fsh continuum-2.0.4_fix/shaders/gbuffers_armor_glint.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_armor_glint.vsh continuum-2.0.4_fix/shaders/gbuffers_armor_glint.vsh
8c8
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_basic.fsh continuum-2.0.4_fix/shaders/gbuffers_basic.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_basic.vsh continuum-2.0.4_fix/shaders/gbuffers_basic.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_block.fsh continuum-2.0.4_fix/shaders/gbuffers_block.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_block.vsh continuum-2.0.4_fix/shaders/gbuffers_block.vsh
8c8
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_clouds.fsh continuum-2.0.4_fix/shaders/gbuffers_clouds.fsh
1c1
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_clouds.vsh continuum-2.0.4_fix/shaders/gbuffers_clouds.vsh
1c1
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_entities.fsh continuum-2.0.4_fix/shaders/gbuffers_entities.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_entities.vsh continuum-2.0.4_fix/shaders/gbuffers_entities.vsh
8c8
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_hand.fsh continuum-2.0.4_fix/shaders/gbuffers_hand.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_hand.vsh continuum-2.0.4_fix/shaders/gbuffers_hand.vsh
8c8
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_hand_water.fsh continuum-2.0.4_fix/shaders/gbuffers_hand_water.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_hand_water.vsh continuum-2.0.4_fix/shaders/gbuffers_hand_water.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_skybasic.fsh continuum-2.0.4_fix/shaders/gbuffers_skybasic.fsh
1c1
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_skybasic.vsh continuum-2.0.4_fix/shaders/gbuffers_skybasic.vsh
1c1
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_skytextured.fsh continuum-2.0.4_fix/shaders/gbuffers_skytextured.fsh
1c1
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_skytextured.vsh continuum-2.0.4_fix/shaders/gbuffers_skytextured.vsh
1c1
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_terrain.fsh continuum-2.0.4_fix/shaders/gbuffers_terrain.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_terrain.vsh continuum-2.0.4_fix/shaders/gbuffers_terrain.vsh
8c8
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_textured.fsh continuum-2.0.4_fix/shaders/gbuffers_textured.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_textured.vsh continuum-2.0.4_fix/shaders/gbuffers_textured.vsh
8c8
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_water.fsh continuum-2.0.4_fix/shaders/gbuffers_water.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_water.vsh continuum-2.0.4_fix/shaders/gbuffers_water.vsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_weather.fsh continuum-2.0.4_fix/shaders/gbuffers_weather.fsh
7c7
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/gbuffers_weather.vsh continuum-2.0.4_fix/shaders/gbuffers_weather.vsh
8c8
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/shadow.fsh continuum-2.0.4_fix/shaders/shadow.fsh
1c1
< #version 120
---
> #version 130
diff --color -r continuum-2.0.4/shaders/shadow.vsh continuum-2.0.4_fix/shaders/shadow.vsh
1c1
< #version 120
---
> #version 130

or execute this command in continuum-2.0.4/shaders/

sed -i 's/version\ 120/version\ 130/g' *.*

since switch-case was been added in glsl 1.3, but version in these files is 1.2, so simply replace 120 with 130 can fix the blackscreen pic

EyesWithoutFace commented 3 years ago

I still can't get any shaders to work and minecraft optifine verifies running OpenGL 4.6 amd rx6800xt latest mesa-git I don't see how the following commands above can help my issue if they're trying to force a newer version of OpenGL.

Any suggestions are appreciated cannot get shaders active in modpacks or vanilla.

rhjdvsgsgks commented 3 years ago

i wrote a tiny patch for SEUS PTGI HRR Test 2.1 GFME v1.2(a modded version of ptgi), after that shadow will not stop working anymore

diff shaders/program/shadow.gsh.glsl.bak shaders/program/shadow.gsh.glsl 
40c40
<       vec3 worldPosDiff[3] = vec3[3](vWorldPos[0] - vWorldPos[1],
---
>       vec4 worldPosDiff[3] = vec4[3](vWorldPos[0] - vWorldPos[1],

before before after after

GeForceLegend commented 3 years ago

i wrote a tiny patch for SEUS PTGI HRR Test 2.1 GFME v1.2(a modded version of ptgi), after that shadow will not stop working anymore

diff shaders/program/shadow.gsh.glsl.bak shaders/program/shadow.gsh.glsl 
40c40
<       vec3 worldPosDiff[3] = vec3[3](vWorldPos[0] - vWorldPos[1],
---
>       vec4 worldPosDiff[3] = vec4[3](vWorldPos[0] - vWorldPos[1],

before before after after

@rhjdvsgsgks Thanks for patch, but I prefer to use this one vec3 worldPosDiff[3] = vec3[3](vWorldPos[0].xyz - vWorldPos[1].xyz, vWorldPos[1].xyz - vWorldPos[2].xyz, vWorldPos[2].xyz - vWorldPos[0].xyz);

rhjdvsgsgks commented 3 years ago

Thanks for patch, but I prefer to use this one vec3 worldPosDiff[3] = vec3[3](vWorldPos[0].xyz - vWorldPos[1].xyz, vWorldPos[1].xyz - vWorldPos[2].xyz, vWorldPos[2].xyz - vWorldPos[0].xyz);

thanks for your advice, I'm new in glsl, and your solution is indeed better.

rhjdvsgsgks commented 2 years ago

there is a little patch to make iterationT 2.0 shader working on mesa driver

diff --git a/shaders/composite.fsh b/shaders/composite.fsh
index 632468b..b1d666c 100644
--- a/shaders/composite.fsh
+++ b/shaders/composite.fsh
@@ -1,4 +1,4 @@
-#version 450
+#version 450 compatibility

 layout(location = 0) out vec4 compositeOutput1;
 layout(location = 1) out vec4 compositeOutput2;
diff --git a/shaders/gbuffers_water.vsh b/shaders/gbuffers_water.vsh
index afc4f7b..da08efc 100644
--- a/shaders/gbuffers_water.vsh
+++ b/shaders/gbuffers_water.vsh
@@ -21,6 +21,7 @@ layout(location = 10) in vec4 mc_Entity;
 out vec4 color;
 out vec4 texcoord;
 out vec3 worldNormal;
+out float distance;

 out vec4 viewPos;
 out vec3 worldPosition;
@@ -35,6 +36,7 @@ out float materialIDs;

 void main() {
    viewPos = gl_ModelViewMatrix * gl_Vertex;
+   distance = sqrt(viewPos.x * viewPos.x + viewPos.y * viewPos.y + viewPos.z * viewPos.z);
    gl_Position = gl_ProjectionMatrix * viewPos;
    #include "/lib/SphericalWorld.glsl"
    #ifdef TAA
diff --git a/shaders/world-1/gbuffers_water.vsh b/shaders/world-1/gbuffers_water.vsh
index afc4f7b..da08efc 100644
--- a/shaders/world-1/gbuffers_water.vsh
+++ b/shaders/world-1/gbuffers_water.vsh
@@ -21,6 +21,7 @@ layout(location = 10) in vec4 mc_Entity;
 out vec4 color;
 out vec4 texcoord;
 out vec3 worldNormal;
+out float distance;

 out vec4 viewPos;
 out vec3 worldPosition;
@@ -35,6 +36,7 @@ out float materialIDs;

 void main() {
    viewPos = gl_ModelViewMatrix * gl_Vertex;
+   distance = sqrt(viewPos.x * viewPos.x + viewPos.y * viewPos.y + viewPos.z * viewPos.z);
    gl_Position = gl_ProjectionMatrix * viewPos;
    #include "/lib/SphericalWorld.glsl"
    #ifdef TAA
diff --git a/shaders/world1/composite.fsh b/shaders/world1/composite.fsh
index 147b39d..543560e 100644
--- a/shaders/world1/composite.fsh
+++ b/shaders/world1/composite.fsh
@@ -1,4 +1,4 @@
-#version 450
+#version 450 compatibility

 layout(location = 0) out vec4 compositeOutput1;
 layout(location = 1) out vec4 compositeOutput2;
diff --git a/shaders/world1/gbuffers_water.vsh b/shaders/world1/gbuffers_water.vsh
index afc4f7b..da08efc 100644
--- a/shaders/world1/gbuffers_water.vsh
+++ b/shaders/world1/gbuffers_water.vsh
@@ -21,6 +21,7 @@ layout(location = 10) in vec4 mc_Entity;
 out vec4 color;
 out vec4 texcoord;
 out vec3 worldNormal;
+out float distance;

 out vec4 viewPos;
 out vec3 worldPosition;
@@ -35,6 +36,7 @@ out float materialIDs;

 void main() {
    viewPos = gl_ModelViewMatrix * gl_Vertex;
+   distance = sqrt(viewPos.x * viewPos.x + viewPos.y * viewPos.y + viewPos.z * viewPos.z);
    gl_Position = gl_ProjectionMatrix * viewPos;
    #include "/lib/SphericalWorld.glsl"
    #ifdef TAA

because there is no texture2D(sampler2D, vec2) function in core profile, only

ivec4 texture2D(isampler2D, vec2)
ivec4 texture2D(isampler2D, vec2, float)
uvec4 texture2D(usampler2D, vec2)
uvec4 texture2D(usampler2D, vec2, float)

available. so, its required to use compatibility profile.

and author also forgot to output distance in vertex shader, after complete it water will works

before: after:

hirobrin356 commented 2 years ago

Screenshot_2022-06-08-17-42-56-380_net kdt pojavlaunch debug Ш Screenshot_2022-06-08-17-39-34-852_net kdt pojavlaunch debug Шейдеры багуют все шейдеры на open 3.0

hirobrin356 commented 2 years ago

Чёрные полосы на xiaomi redmi 9 4/64 64bit