mupen64plus / mupen64plus-video-glide64mk2

Video plugin for Mupen64Plus 2.0 based on 10th anniversary release code from gonetz
28 stars 37 forks source link

GLES2 compatibility issues #19

Open inactive123 opened 9 years ago

inactive123 commented 9 years ago

There are still some issues with the GLES 2.0 Glitch64 backend for Glide64 as can be found in the current repo (and my fork of it too in Mupen64 libretro, but I digress)...

line 275 in Glitch64/OGLESCombiner.cpp:

sprintf(s, "gl_FragDepth = dot(texture2D(texture0, vec2(gl_TexCoord[0])), vec4(31_64_32, 6332, 31, 0))%g + %g; \n", zscale/2/65535.0, 1-zscale/2);

You can't assume gl_FragDepth to be there on GLES 2.0.

http://stackoverflow.com/questions/9503538/can-an-opengl-es-fragment-shader-change-the-depth-value-of-a-fragment

"No -- gl_FragDepth (which is part of the desktop version of GLSL) is not present in OpenGL ES."

There's an extension called EXT_frag_depth that might be available on certain GPU's GL driver implementations.

https://www.khronos.org/registry/gles/extensions/EXT/EXT_frag_depth.txt

In the case it's there, gl_FragDepthEXT can be used.

(1) Should the GLSL keyword be gl_FragDepth or gl_FragDepthEXT?

RESOLVED: OpenGL has discussed this in the past and the agreement was that
we should use gl_FragDepthEXT.

Obviously, instead of relying on a certain GL extension to be there which might not always be the case, we should instead come up with a more general-purpose solution for this.