Skip to content

igl | opengl | Add IContext::readBuffer()#398

Closed
vinsentli wants to merge 1 commit into
facebook:mainfrom
vinsentli:iglReadBuffer
Closed

igl | opengl | Add IContext::readBuffer()#398
vinsentli wants to merge 1 commit into
facebook:mainfrom
vinsentli:iglReadBuffer

Conversation

@vinsentli

Copy link
Copy Markdown
Contributor

No description provided.

@meta-codesync

meta-codesync Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@corporateshark has imported this pull request. If you are a Meta employee, you can view this in D108393540.

@meta-codesync meta-codesync Bot closed this in 098e2b7 Jun 12, 2026
@meta-codesync

meta-codesync Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@corporateshark merged this pull request in 098e2b7.

@meta-codesync meta-codesync Bot added the Merged label Jun 12, 2026
meta-codesync Bot pushed a commit that referenced this pull request Jun 14, 2026
Summary:
This PR dependents on PR:#398

Pull Request resolved: #399

Test Plan:
Added a unit test `MSAATextureAttachmentOGLTest.ResolveMSAAWithMRT` in `xplat/graphics/igl/public/src/igl/tests/ogl/MSAATextureAttachment.cpp` that exercises the new multiple-render-target resolve path in `RenderCommandEncoder::endEncoding()`.

The test builds a framebuffer with two color attachments, each backed by an MSAA texture and paired with its own resolve texture, records an empty render pass (clear + `MsaaResolve` store action on both attachments), and calls `endEncoding()` followed by `submit()`. This drives `endEncoding()` through:
- the regular blit of color attachment 0,
- the `hasMRT` detection loop,
- the per-attachment `readBuffer()` / `drawBuffers()` selection + `blitFramebuffer()` loop for attachment 1, and
- the `readBuffer()` / `drawBuffers()` restore loop.

The test asserts `context_->checkForErrors() == GL_NO_ERROR` afterwards, verifying the MRT resolve issues no invalid GL operations. It is guarded on the `MultiSample`, `ReadWriteFramebuffer`, and `MultipleRenderTargets` device features (the read/draw framebuffer split and `drawBuffers()` the path relies on).

```
buck2 test fbsource//xplat/graphics/igl/public/src/igl:iglOpenGLTestsFbcode -- --regex 'MSAATextureAttachmentOGLTest'
```

Result: `MSAATextureAttachmentOGLTest.ResolveMSAAWithMRT` runs and passes (no GL errors); the pre-existing `CreateMSAARenderbuffer` still passes and `ResolveMSAA` is skipped as before (the OpenGL backend does not advertise the `MultiSampleResolve` feature).

Also verified the library still compiles on all OpenGL flavors:
```
buck2 build fbsource//xplat/graphics/igl/public/src/igl/opengl:openglFbcode
buck2 build fbsource//xplat/graphics/igl/public/src/igl/opengl:openglAndroid
buck2 build fbsource//xplat/graphics/igl/public/src/igl/opengl:openglAppleMac
```

Reviewed By: rudybear

Differential Revision: D108481125

Pulled By: corporateshark

fbshipit-source-id: d371651283d3520f40029de217410e347a58554e
@vinsentli vinsentli deleted the iglReadBuffer branch June 15, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants