jdmclark / jkgfxmod

Graphics enhancement and compatibility tool for Dark Forces II
MIT License
74 stars 7 forks source link

Issue on post_to_srgb.frag when GLSL __VERSION__ > 130 #30

Closed rcbrufatto closed 4 years ago

rcbrufatto commented 5 years ago

When GLSL is > 1.30, I've faced screen flickering on JKGFX version prior v0.1.0 and blank screen from v0.1.0.

jkgm.log has the following:

opengl_state.cpp|34|error> jkgm/shaders/post_to_srgb.frag: Failed to compile shader: 0:32(24): error: sampler arrays indexed with non-constant expressions are forbidden in GLSL 1.30 and later

The simple fix, since I am pretty new to GLSL and the number of iterations are fairly small. I've manually unpacked the loop, see below:

+ bloom_samp += texture(bloom_fbuf[0], vp_texcoords) bloom_weight[0]; + bloom_sum += bloom_weight[0]; + bloom_samp += texture(bloom_fbuf[1], vp_texcoords) bloom_weight[1]; + bloom_sum += bloom_weight[1]; + bloom_samp += texture(bloom_fbuf[2], vp_texcoords) bloom_weight[2]; + bloom_sum += bloom_weight[2]; + bloom_samp += texture(bloom_fbuf[3], vp_texcoords) bloom_weight[3]; + bloom_sum += bloom_weight[3]; + / for(int i = 0; i < num_bloom_layers; ++i) { + bloom_samp += texture(bloom_fbuf[i], vp_texcoords) bloom_weight[i]; + bloom_sum += bloom_weight[i]; + }*/

My environment details:

Ubuntu 19.04 VM (VMWare Workstation compat v15) Linux 5.0.0-15-generic x86_64 wine-4.0.0 (ppa stable) glxinfo | grep -i version server glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 Version: 19.0.2 Max core profile version: 3.3 Max compat profile version: 3.3 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 2.0 OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.0.2 OpenGL core profile shading language version string: 3.30 OpenGL version string: 3.3 (Compatibility Profile) Mesa 19.0.2 OpenGL shading language version string: 3.30 OpenGL ES profile version string: OpenGL ES 2.0 Mesa 19.0.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

jdmclark commented 5 years ago

Hi @rcbrufatto

Thanks for reporting this issue. The shader in question is not compliant GLSL, but is erroneously accepted by nvidia's driver (see commit e218a5bd8906d55c3aee2087b069f9de6f58ef7f for another example of this happening). In addition to fixing this specific problem, some sort of regression test/build step should be added that checks the shaders using glslangValidator.

bobberb commented 4 years ago

@rcbrufatto running Linux as well. How does one implement this fix of yours? What is this "unpacked loop"?

Thank you.

rcbrufatto commented 4 years ago

Thanks, Jonathan! Sorry for the delay in the response folks.

@bobberb, check Jonathan's last commit linked.

Cheers, Rodolfo

On Fri, Oct 18, 2019 at 9:21 AM Jonathan Clark notifications@github.com wrote:

Closed #30 https://github.com/jdmclark/jkgfxmod/issues/30 via 0082851 https://github.com/jdmclark/jkgfxmod/commit/008285107d41aa0324ed8a33084b421baba05f66 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jdmclark/jkgfxmod/issues/30?email_source=notifications&email_token=AMEICQMRS6LOMUQDFREOIYDQPGS23A5CNFSM4HPUUTR2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOUJTUFPY#event-2724676287, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMEICQPN4SXD7O4NABZ64IDQPGS23ANCNFSM4HPUUTRQ .

--

\x48\x69\x73\x74\x6F\x72\x79\x20\x72\x65\x70\x65\x61\x74\x73\x20\x69\x74\x73\x65\x6C\x66\x2C\x20\x66\x69\x72\x73\x74\x20\x61\x73\x20\x74\x72\x61\x67\x65\x64\x79\x2C\x20\x73\x65\x63\x6F\x6E\x64\x20\x61\x73\x20\x66\x61\x72\x63\x65\x2E

bobberb commented 4 years ago

@rcbrufatto @jdmclark

Confirmed working on Linux 5.3.7, Mesa 19.3 (git, ACO), Wine 4.16

+++ added jknup and jkgfx2019 - my childhood in 1440p!