Skip to content

Commit

Permalink
Bug 1860921 - Revert Texture::Destroy() and add Texture::ForceDestroy…
Browse files Browse the repository at this point in the history
…() r=webgpu-reviewers,nical

This is a short term fix. Long term fix needs to be done by Bug 1860958.
Presenting WebGPU without readback needs a way to destroy Texture. Then Texture::ForceDestroy() is added for it.

Differential Revision: https://phabricator.services.mozilla.com/D191829
  • Loading branch information
sotaro committed Oct 25, 2023
1 parent ba0d5e5 commit 40d51be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dom/webgpu/CanvasContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void CanvasContext::SwapChainPresent() {
mBridge->SwapChainPresent(mTexture->mId, *mLastRemoteTextureId,
*mRemoteTextureOwnerId);
if (mUseExternalTextureInSwapChain) {
mTexture->Destroy();
mTexture->ForceDestroy();
mNewTextureRequested = true;
}
}
Expand Down
9 changes: 8 additions & 1 deletion dom/webgpu/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ already_AddRefed<TextureView> Texture::CreateView(
return view.forget();
}

void Texture::Destroy() { Cleanup(); }
void Texture::Destroy() {
// TODO: we don't have to implement it right now, but it's used by the
// examples

// XXX Bug 1860958.
}

void Texture::ForceDestroy() { Cleanup(); }

} // namespace mozilla::webgpu
1 change: 1 addition & 0 deletions dom/webgpu/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Texture final : public ObjectBase, public ChildOf<Device> {
already_AddRefed<TextureView> CreateView(
const dom::GPUTextureViewDescriptor& aDesc);
void Destroy();
void ForceDestroy();

uint32_t Width() const { return mSize.width; }
uint32_t Height() const { return mSize.height; }
Expand Down

0 comments on commit 40d51be

Please sign in to comment.