Bug 271874
| Summary: | [WebGL] remove workaround for multisampled blits to blitFramebuffer | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Mike Wyrzykowski <mwyrzykowski> |
| Component: | WebGL | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | dino, kbr, kkinnunen, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Mike Wyrzykowski
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/125593588>
Mike Wyrzykowski
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
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
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
Yes, that's it.
Mike Wyrzykowski
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
sorry, typo in the last sentence:
*our buffers are not multisampled when I encounter this validation failure
Kenneth Russell
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
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
I still need to construct a minimal repro, very possible I have something misconfigured.
Mike Wyrzykowski
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
Pull request: https://github.com/WebKit/WebKit/pull/26640
EWS
Committed 276860@main (70d8c3cd9ea0): <https://commits.webkit.org/276860@main>
Reviewed commits have been landed. Closing PR #26640 and removing active labels.