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

GLES2 WebGL depth texture not draw #36786

Closed
danilw opened this issue Mar 4, 2020 · 6 comments
Closed

GLES2 WebGL depth texture not draw #36786

danilw opened this issue Mar 4, 2020 · 6 comments

Comments

@danilw
Copy link

danilw commented Mar 4, 2020

Godot version:
3.2 stable

OS/device including version:
Chrome 78 /Firefox 70, Linux and Windows

Issue description:
GLES2 Depth texture not work when it supported by device/hardware(webbrowser)

Docs https://docs.godotengine.org/en/3.2/tutorials/misc/gles2_gles3_differences.html :

While GLES2 supports DEPTH_TEXTURE in shaders, it may not work on some old hardware (especially mobile).

it means Godot do check if device support Depth, and use it when supported.
I have support depth texture in GLES2 in webbrowser, Godot do not use it.
Webgl does Depth support https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_depth_texture

Steps to reproduce:

  1. open this link example project in browser, depth not draw
  2. open webbrowser console write
var canvas = document.createElement('canvas');var gl = canvas.getContext("webgl");console.log(gl.getSupportedExtensions());

WEBGL_depth_texture listed

1

Minimal reproduction project:
source zip link

@akien-mga
Copy link
Member

Web

Please provide details about the OS and browser(s).

@danilw
Copy link
Author

danilw commented Mar 4, 2020

Web

Please provide details about the OS and browser(s).

Chrome 78 /Firefox 70, only Linux

@Calinou
Copy link
Member

Calinou commented Mar 4, 2020

@danilw Which graphics card and driver are you using? You can check the list of supported extensions here.

@danilw
Copy link
Author

danilw commented Mar 4, 2020

@Calinou look my screenshot in first post, please
this is not video card, I have AMD Vega and Nvidia with latest drivers, GLES2 Depth work in native Godot builds(GLES2) and in webbrowser (in WebGL outside Godot web build, in Godot web it does not work)

in Godot web build Depth work only in WebGL2 build(GLES3)

I have test it in Windows webbrowsers, same Depth does not work in GLES2 Godot in Web

@clayjohn
Copy link
Member

clayjohn commented Mar 4, 2020

This is expected behaviour. Take a look at the error you get when running the scene you provided:

GL ERROR :GL_INVALID_OPERATION : glDrawElements: Source and destination textures of the draw are the same.

Certain hardware (and platforms, including webgl) do not support reading from a bound depth texture. The WEBGL_depth_texture extension means your hardware supports using the depth texture. It says nothing about reading and writing at the same time.

That note in the docs is particularly pointing to this situation. Godot allows you to read from the depth_texture, however, your hardware (in this case platform) just doesn't support it. The only way to "fix" this would be to go back to the previous hardware and not allow anyone to use the depth_texture in shaders because it cannot be supported on all hardware and platforms.

@danilw
Copy link
Author

danilw commented Mar 4, 2020

okey I see, thanks for clarification
can be closed I think

@danilw danilw closed this as completed Mar 4, 2020
@akien-mga akien-mga added archived and removed bug labels Mar 4, 2020
@akien-mga akien-mga removed this from the 4.0 milestone Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants