renderdoc icon indicating copy to clipboard operation
renderdoc copied to clipboard

Add Support for Clip Control Extension (EXT_clip_control / glClipControlEXT)

Open cybereality opened this issue 1 year ago • 9 comments

Description

I am developing an app with OpenGL ES 3.0 and wish to implement reverse z buffer for high precision depth testing. You can see the article I am following if you are not familiar with this technique: https://nlguillemot.wordpress.com/2016/12/07/reversed-z-in-opengl/ . In order to use reverse-z, you need to change the GL clip range to 0.0 to 1.0 (similar to DirectX) rather than -1.0 to 1.0 on the z axis / depth buffer. In desktop GL 4.5 you can use the function glClipControl. For OpenGL ES 3.0 (e.g. on web or mobile) you would need the extension EXT_clip_control and the function glClipControlEXT. https://registry.khronos.org/OpenGL/extensions/EXT/EXT_clip_control.txt . It appears that RenderDoc does not support this extension, resulting in an "unsupported" warning message and the inability to capture a frame. What I am requesting is support for this extension and/or the ability to still capture while using it.

Environment

  • RenderDoc version: 1.32
  • Operating System: Ubuntu 24.04
  • Graphics API: OpenGL ES 3.0

cybereality avatar Jun 01 '24 02:06 cybereality

This extension was already supported on proper GL, but it looked like the alias hadn't been set up for GLES. I don't have a test case for it but that commit should work - let me know if it doesn't.

baldurk avatar Jun 04 '24 09:06 baldurk

Yeah, it works perfect!!! Thanks a bunch, huge help.

cybereality avatar Jun 04 '24 10:06 cybereality

Actually, wait. It's not 100% working. The extension is now supported, so I can run RenderDoc and capture frames. However, the capture is not completely accurate with respect to the depth buffer. See the two images. First one is the app running the moment the frame is captured. The second is the capture in RenderDoc (final backbuffer). So there is some mismatch to how it is handling the depth now.

OpenGL ES3.0 app: SSAO_Depth_App

Exact frame captured in RenderDoc: SSAO_Depth_Doc

cybereality avatar Jun 05 '24 03:06 cybereality

Can you share your application so that I can repro what's going on?

baldurk avatar Jun 05 '24 08:06 baldurk

The app is rather large and not public yet. But give me a day or so and I can build a small reproduction example.

cybereality avatar Jun 05 '24 09:06 cybereality

I found one other missing bit of GLES-equivalence handling on checking again for how the extension is used, so if you want you can try retesting with that change.

baldurk avatar Jun 05 '24 12:06 baldurk

I have this problem too. when using RenderDoc to debug Android OpenGL Application that enable gl_clip_control extension. RenderDoc stop capture function. Please fix this with my appreciate.

Chinayang1 avatar Jun 28 '24 10:06 Chinayang1

I have this problem too. when using RenderDoc to debug Android OpenGL Application that enable gl_clip_control extension. RenderDoc stop capture function. Please fix this with my appreciate.

Can you share more details about your reproduction case and which RenderDoc version you are using. The extension support would require using a recent nightly build. RenderDoc v1.33 does not have support for the extension.

Zorro666 avatar Jul 01 '24 09:07 Zorro666

I'm working on a minimum reproduction now. The app I'm using just has a bunch of other stuff I have to take out first, cause it's a mess. Can maybe take a look tomorrow. Thanks.

cybereality avatar Jul 01 '24 10:07 cybereality

So I put together a small project using the same setup as my larger project. I tested on the latest main pull from GitHub (as of like 1 hour ago) and it appears the issue is resolved.

ReverseZ.zip

But this is just a simple demo (it reads the depth and draws a full screen overlay) so it fixed my specific issue, though I'm not sure how to test it otherwise. You can run the app and press "D" to toggle the depth display. Previously, reading from this texture would have strange results in the RenderDoc capture (e.g. it would not match the display in the actual app).

Also, the code is some old testing stuff, so a bit messy, just search for "REVERSE Z" to see the relevant changes. Thanks.

cybereality avatar Jul 06 '24 23:07 cybereality

It sounds like it is working using the latest code from GitHub.

Where does the problem happen and if the problem still occurs we will need a reproduction project.

Zorro666 avatar Jul 08 '24 13:07 Zorro666

Closing this due to lack of activity from the reporter and no further information to investigate.

If you are the reporter and this bug is still a problem for you, or you are someone finding this issue and you believe this bug is still a problem and you have more information to share, please do not comment here and instead please open a new issue. You can reference this issue if you wish, but opening a new issue prevents confusion of accidentally linking two unrelated bugs and means that each issue can be handled in a clean process.

baldurk avatar Aug 08 '24 09:08 baldurk

Sorry for the delay. I was waiting for some response from the example app I posted last month. In any case, I was able to test RenderDoc v1.34 with my full application, and I can confirm this issue is completely resolved. Thanks.

cybereality avatar Aug 08 '24 13:08 cybereality

You said in the message with your example application that it was working, which as Jake said doesn't help identify any bug that may be present so if there were a bug we would need an application that reproduces it.

It sounds like it's working and maybe was working before too, so I'm glad it's resolved for you.

baldurk avatar Aug 08 '24 13:08 baldurk