Skip to content

Conversation

@slipher
Copy link
Member

@slipher slipher commented Sep 18, 2025

  • Clean up unused code
  • Fix an instance where GL_fboShim was not used
  • Add optional target argument for R_BindFBO (lifted from Implement MSAA #1480)
  • Add BlitFramebuffer function to FBO shim

The last 2 things are needed for FBO blitting. I need FBO blitting to fix #1783, while it is also used in #1480 so I'm trying to reuse the code from there. But I've tried to make R_BindFBO more robust by making GL_DRAW_FRAMEBUFFER the default instead of GL_FRAMEBUFFER because with the latter, you get issues that it matters what order you do the bindings in because it overwrites both READ and DRAW framebuffers.

// void (*glBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;

/* Unused for now, part of GL_EXT_framebuffer_multisample:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistence you can edit the comment accordingly like you did below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undid the change to that other comment.

@illwieckz
Copy link
Member

  • Remove unused FBO code and add groundwork for FBO blit functions: LGTM.
  • Remove references to GL renderbuffers: LGTM.
  • Substitute GL_FRAMEBUFFER -> GL_DRAW_FRAMEBUFFER: LGTM.
  • Optional target parameter for R_BindFBO: LGTM.
  • Add BlitFramebuffer function to GL_fboShim: LGTM.
  • Fix missing 'FBO shim' for glFramebufferTexture3D: LGTM.

slipher and others added 6 commits September 25, 2025 09:45
We don't use renderbuffers. The renderbuffer size limit does not apply
to an FBO.
Replace GL_FRAMEBUFFER with GL_DRAW_FRAMEBUFFER everywhere. Binding
GL_FRAMEBUFFER to x is defined as binding GL_DRAW_FRAMEBUFFER to x then
binding GL_READ_FRAMEBUFFER to x. Currently we only use the DRAW aspect.
The double binding can be a nuisance when adding functionality (blit)
that needs the read aspect.
Co-Authored-By: VReaperV <reaper9977@gmail.com>
Strangely, we didn't use any functions from EXT_framebuffer_blit before
this, despite it being a required extension (if ARB_framebuffer_blit is
unavailable) and a comment saying "our code is known to require
EXT_framebuffer_blit".
Provide the alternative function to use if GL_ARB_framebuffer_object is
not available but GL_EXT_framebuffer_object is. The missing shim could
result in a crash if the former extension is not available and dynamic
lights are enabled.
@slipher slipher merged commit 3393b52 into DaemonEngine:master Sep 25, 2025
9 checks passed
@slipher slipher deleted the fbo-cleanup-blit branch September 25, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants