RESOLVED FIXED271874
[WebGL] remove workaround for multisampled blits to blitFramebuffer
https://bugs.webkit.org/show_bug.cgi?id=271874
Summary [WebGL] remove workaround for multisampled blits to blitFramebuffer
Mike Wyrzykowski
Reported 2024-03-28 20:00:09 PDT
There is code inside blitFramebuffer which says: bool sameBounds = srcX0 == dstX0 && srcY0 == dstY0 && srcX1 == dstX1 && srcY1 == dstY1; and if that is not true, validation fails and no bait occurs. So why are src and dst specified independently?
Attachments
Radar WebKit Bug Importer
Comment 1 2024-03-28 20:00:38 PDT
Mike Wyrzykowski
Comment 2 2024-03-28 20:11:36 PDT
blitFramebuffer says the sizes must be equal, not the rectangles being copied from: https://registry.khronos.org/webgl/specs/latest/2.0/#5.40 webgl/2.0.0/conformance2/rendering/blitframebuffer-test.html fails after correcting the validation, which implies the test is invalid.
Kenneth Russell
Comment 3 2024-03-29 16:21:27 PDT
This is a limitation in the OpenGL ES 3.0 spec; when blitting from a multisampled framebuffer to a single-sampled one (doing a resolve operation), the source and destination rectangles have to be exactly the same. I haven't looked up the exact page in the spec, but the manual page here: https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glBlitFramebuffer.xhtml describes this limitation in the "Errors" section.
Mike Wyrzykowski
Comment 4 2024-03-29 16:27:15 PDT
This language? GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the formats of draw and read buffers are not identical, or the source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds.
Kenneth Russell
Comment 5 2024-03-29 16:31:17 PDT
Yes, that's it.
Mike Wyrzykowski
Comment 6 2024-03-29 16:31:40 PDT
but shouldn't: if (readBuffer->getResourceSamples() > 0 && !sameBounds) read: if (readBuffer->getResourceSamples() > 1 && !sameBounds) since the default value of RenderPassDesc::sampleCount is 1? uint32_t sampleCount = 1; and FramebufferMtl returns that value? int FramebufferMtl::getSamples() const { return mRenderPassDesc.sampleCount; } are buffers are not multisampled when we hit this
Mike Wyrzykowski
Comment 7 2024-03-29 16:33:08 PDT
sorry, typo in the last sentence: *our buffers are not multisampled when I encounter this validation failure
Kenneth Russell
Comment 8 2024-03-29 16:35:13 PDT
There's some weirdness in the OpenGL ES spec where a multisampled renderbuffer with number of samples ==1 is not the same thing as a single-sampled renderbuffer. Would need to dig to find more details. This test's been passing for a while on multiple implementations; did something new crop up?
Mike Wyrzykowski
Comment 9 2024-03-29 16:39:04 PDT
Yes, we tried to copy a single sampled FBO to another single sampled FBO since equal sized rectangles at different offsets and it fails validation at that location.
Mike Wyrzykowski
Comment 10 2024-03-29 16:39:27 PDT
I still need to construct a minimal repro, very possible I have something misconfigured.
Mike Wyrzykowski
Comment 11 2024-03-29 20:47:10 PDT
I root caused the issue. Indeed the source framebuffer was multisampled, which is why I ran into this validation error. I'll undo the local WebKit change to the validation logic and then the test should be passing again
Mike Wyrzykowski
Comment 12 2024-03-29 21:02:57 PDT
EWS
Comment 13 2024-03-30 13:42:38 PDT
Committed 276860@main (70d8c3cd9ea0): <https://commits.webkit.org/276860@main> Reviewed commits have been landed. Closing PR #26640 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.