2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2018-06-13 20:43:48 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "TextureView.h"
|
|
|
|
|
|
|
|
#include "Device.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace webgpu {
|
|
|
|
|
2019-10-02 19:46:03 +03:00
|
|
|
GPU_IMPL_CYCLE_COLLECTION(TextureView, mParent)
|
|
|
|
GPU_IMPL_JS_WRAP(TextureView)
|
2018-06-13 20:43:48 +03:00
|
|
|
|
2020-02-24 23:12:16 +03:00
|
|
|
TextureView::TextureView(Texture* const aParent, RawId aId)
|
|
|
|
: ChildOf(aParent), mId(aId) {}
|
|
|
|
|
|
|
|
TextureView::~TextureView() { Cleanup(); }
|
|
|
|
|
|
|
|
void TextureView::Cleanup() {
|
|
|
|
if (mValid && mParent && mParent->mParent) {
|
|
|
|
mValid = false;
|
|
|
|
WebGPUChild* bridge = mParent->mParent->mBridge;
|
|
|
|
if (bridge && bridge->IsOpen()) {
|
2020-03-23 10:54:08 +03:00
|
|
|
bridge->SendTextureViewDestroy(mId);
|
2020-02-24 23:12:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-22 10:31:51 +03:00
|
|
|
|
2018-06-13 20:43:48 +03:00
|
|
|
} // namespace webgpu
|
|
|
|
} // namespace mozilla
|