summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/CommandEncoder.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /dom/webgpu/CommandEncoder.cpp
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webgpu/CommandEncoder.cpp')
-rw-r--r--dom/webgpu/CommandEncoder.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/dom/webgpu/CommandEncoder.cpp b/dom/webgpu/CommandEncoder.cpp
index f254c9d8b9..3775f63555 100644
--- a/dom/webgpu/CommandEncoder.cpp
+++ b/dom/webgpu/CommandEncoder.cpp
@@ -85,9 +85,16 @@ void CommandEncoder::Cleanup() {
return;
}
mValid = false;
- if (mBridge->IsOpen()) {
+
+ if (!mBridge) {
+ return;
+ }
+
+ if (mBridge->CanSend()) {
mBridge->SendCommandEncoderDrop(mId);
}
+
+ wgpu_client_free_command_encoder_id(mBridge->GetClient(), mId);
}
void CommandEncoder::TrackPresentationContext(CanvasContext* aTargetContext) {
@@ -103,7 +110,7 @@ void CommandEncoder::CopyBufferToBuffer(const Buffer& aSource,
const Buffer& aDestination,
BufferAddress aDestinationOffset,
BufferAddress aSize) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -118,7 +125,7 @@ void CommandEncoder::CopyBufferToTexture(
const dom::GPUImageCopyBuffer& aSource,
const dom::GPUImageCopyTexture& aDestination,
const dom::GPUExtent3D& aCopySize) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -136,7 +143,7 @@ void CommandEncoder::CopyTextureToBuffer(
const dom::GPUImageCopyTexture& aSource,
const dom::GPUImageCopyBuffer& aDestination,
const dom::GPUExtent3D& aCopySize) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -152,7 +159,7 @@ void CommandEncoder::CopyTextureToTexture(
const dom::GPUImageCopyTexture& aSource,
const dom::GPUImageCopyTexture& aDestination,
const dom::GPUExtent3D& aCopySize) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -181,7 +188,7 @@ void CommandEncoder::ClearBuffer(const Buffer& aBuffer, const uint64_t aOffset,
}
void CommandEncoder::PushDebugGroup(const nsAString& aString) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -191,7 +198,7 @@ void CommandEncoder::PushDebugGroup(const nsAString& aString) {
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
}
void CommandEncoder::PopDebugGroup() {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -200,7 +207,7 @@ void CommandEncoder::PopDebugGroup() {
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
}
void CommandEncoder::InsertDebugMarker(const nsAString& aString) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -230,7 +237,7 @@ already_AddRefed<RenderPassEncoder> CommandEncoder::BeginRenderPass(
}
void CommandEncoder::EndComputePass(ffi::WGPURecordedComputePass& aPass) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}
@@ -240,7 +247,7 @@ void CommandEncoder::EndComputePass(ffi::WGPURecordedComputePass& aPass) {
}
void CommandEncoder::EndRenderPass(ffi::WGPURecordedRenderPass& aPass) {
- if (!mBridge->IsOpen()) {
+ if (!mBridge->CanSend()) {
return;
}