KhronosGroup / OpenGL-Registry

OpenGL, OpenGL ES, and OpenGL ES-SC API and Extension Registry
678 stars 274 forks source link

Is there anyway to delete default depth backbuffer in OpenGL platform #535

Closed Starrring closed 2 years ago

Starrring commented 2 years ago

Hi,

In OpenGL platform,We have a render pipeline, where the forward Render pass and most postprocessing passes(except the last one) are rendered into off-screen framebuffers,until the last postprocessing pass rendered into color backbuffer by using glBindFramebuffer(GL_FRAMEBUFFER, 0).My question is that, as the depth backbuffer,which is created by openGL initialize, is not necessary,is there any way to delete this? I found this post https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glDeleteRenderbuffers.xml ,which implys that the param zero will be silently ignores by glDeleteRenderbuffers.However, the GLuint of depth backbuffer is not aware of us,as it is created by openGL initialize.Maybe you have any idea to delete default depth backbuffer in OpenGL backbuffer ? I am sure it is not relative with hardware,as the vulkan platform don't exist this issue.

Thank you for your help! image image

NogginBops commented 2 years ago

This is handled in the context creation, so if it's not possible to create a context without a depth buffer using WGL or EGL then you can't avoid this. But I'm pretty sure you can make WGL create a context without a depth buffer.

pdaniell-nv commented 2 years ago

WGL advertises plenty of pixel formats that don't have depth or stencil on NVIDIA platforms, and probably other desktop platforms too. Using DescribePixelFormat to get the details on iPixelFormat=6, for example, will give you:

6 {
  dwFlags 0x00008024: {
    PFD_DRAW_TO_WINDOW
    PFD_SUPPORT_OPENGL
    PFD_SUPPORT_COMPOSITION
  }
  iPixelType 0: PFD_TYPE_RGBA
  cColorBits 32: (A 8<<24, R 8<<16, G 8<<8, B 8<<0)
  cAccumBits 64: (A 16, R 16, G 16, B 16), cDepthBits 0, cStencilBits 0
  iLayerType 0: PFD_MAIN_PLANE
  cAuxBuffers 4, dwLayerMask 0, dwVisibleMask 0, dwDamageMask 0
}

For questions like this you will get better response from the OpenGL forums: https://community.khronos.org/

Starrring commented 2 years ago

This is handled in the context creation, so if it's not possible to create a context without a depth buffer using WGL or EGL then you can't avoid this. But I'm pretty sure you can make WGL create a context without a depth buffer.

Hi,

Thank you for your help!

The context is created by eglCreateContext with EGLConfig, which is queryed from eglGetConfigAttrib. The problem is that I can't get EGL_DEPTH_SIZE with number 0 in mobile.How can I avoid this? image

Starrring commented 2 years ago

WGL advertises plenty of pixel formats that don't have depth or stencil on NVIDIA platforms, and probably other desktop platforms too. Using DescribePixelFormat to get the details on iPixelFormat=6, for example, will give you:

6 {
  dwFlags 0x00008024: {
    PFD_DRAW_TO_WINDOW
    PFD_SUPPORT_OPENGL
    PFD_SUPPORT_COMPOSITION
  }
  iPixelType 0: PFD_TYPE_RGBA
  cColorBits 32: (A 8<<24, R 8<<16, G 8<<8, B 8<<0)
  cAccumBits 64: (A 16, R 16, G 16, B 16), cDepthBits 0, cStencilBits 0
  iLayerType 0: PFD_MAIN_PLANE
  cAuxBuffers 4, dwLayerMask 0, dwVisibleMask 0, dwDamageMask 0
}

For questions like this you will get better response from the OpenGL forums: https://community.khronos.org/

Hi ,

Thank you for your guiding!

This is my first time wanting to consult with khronos team, so when I found a github with khronosGroup, I issued this question here.Sorry!!!

Meanwhile, thank you for your answer! But as above I list, the mobile platform seems not returen a EGLConfig with EGL_DEPTH_SIZE equal to 0.

I will try to issue this problem in the forums you linked. Thank you!!!