Bug 1754130 - Support presenting a WebGLFramebuffer to its own swap chain without opaque FB. r=aosmond,jgilbert
Most of the support for presenting a WebGLFramebuffer to a swap chain existed as part of the mechanism for opaque WebXR framebuffer support. However, such "opaque" framebuffer are meant to be opaque in the sense that their attachments can't be inspected or changed, which does not provide the requisite level of control for efficiently implementing Canvas2D snapshots. To this end, the existing Present mechanism is slightly extended to allow presenting to the swap chain already present in WebGLFramebuffer without the existence of a corresponding MozFramebuffer. This also fixes a bug in that AsWebgl() was no longer being utilized in CanvasRenderer, such that a new mechanism that routed GetFrontBuffer() was needed to fix the code rot. There are also some efforts to remove a couple redundant copies I noticed in profiles along the way. Differential Revision: https://phabricator.services.mozilla.com/D138119
This commit is contained in:
@@ -368,13 +368,7 @@ void ClientWebGLContext::Run(Args&&... args) const {
|
||||
|
||||
// ------------------------- Composition, etc -------------------------
|
||||
|
||||
void ClientWebGLContext::OnBeforePaintTransaction() {
|
||||
const RefPtr<layers::ImageBridgeChild> imageBridge =
|
||||
layers::ImageBridgeChild::GetSingleton();
|
||||
|
||||
const auto texType = layers::TexTypeForWebgl(imageBridge);
|
||||
Present(nullptr, texType);
|
||||
}
|
||||
void ClientWebGLContext::OnBeforePaintTransaction() { Present(nullptr); }
|
||||
|
||||
void ClientWebGLContext::EndComposition() {
|
||||
// Mark ourselves as no longer invalidated.
|
||||
@@ -383,6 +377,15 @@ void ClientWebGLContext::EndComposition() {
|
||||
|
||||
// -
|
||||
|
||||
void ClientWebGLContext::Present(WebGLFramebufferJS* const xrFb,
|
||||
const bool webvr) {
|
||||
const RefPtr<layers::ImageBridgeChild> imageBridge =
|
||||
layers::ImageBridgeChild::GetSingleton();
|
||||
|
||||
const auto texType = layers::TexTypeForWebgl(imageBridge);
|
||||
Present(xrFb, texType, webvr);
|
||||
}
|
||||
|
||||
void ClientWebGLContext::Present(WebGLFramebufferJS* const xrFb,
|
||||
const layers::TextureType type,
|
||||
const bool webvr) {
|
||||
|
||||
Reference in New Issue
Block a user