Bug 1860921 - Revert Texture::Destroy() and add Texture::ForceDestroy() 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
This commit is contained in:
sotaro 2023-10-25 09:43:58 +00:00
Родитель ba0d5e580e
Коммит 40d51bef58
3 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -201,7 +201,7 @@ void CanvasContext::SwapChainPresent() {
mBridge->SwapChainPresent(mTexture->mId, *mLastRemoteTextureId,
*mRemoteTextureOwnerId);
if (mUseExternalTextureInSwapChain) {
mTexture->Destroy();
mTexture->ForceDestroy();
mNewTextureRequested = true;
}
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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; }