forked from mirrors/gecko-dev
Backed out 3 changesets (bug 1861985, bug 1860958) for causing build bustages in RefPtr.h CLOSED TREE
Backed out changeset 13f07117425f (bug 1861985) Backed out changeset 0bdc4c60018e (bug 1861985) Backed out changeset 5e6f2b2e19c6 (bug 1860958)
This commit is contained in:
parent
709e423bb2
commit
b428472b9e
22 changed files with 140 additions and 223 deletions
|
|
@ -203,7 +203,7 @@ void CanvasContext::SwapChainPresent() {
|
|||
mBridge->SwapChainPresent(mTexture->mId, *mLastRemoteTextureId,
|
||||
*mRemoteTextureOwnerId);
|
||||
if (mUseExternalTextureInSwapChain) {
|
||||
mTexture->Destroy();
|
||||
mTexture->ForceDestroy();
|
||||
mNewTextureRequested = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,14 +16,22 @@ GPU_IMPL_CYCLE_COLLECTION(CommandBuffer, mParent)
|
|||
GPU_IMPL_JS_WRAP(CommandBuffer)
|
||||
|
||||
CommandBuffer::CommandBuffer(Device* const aParent, RawId aId,
|
||||
nsTArray<WeakPtr<CanvasContext>>&& aTargetContexts,
|
||||
RefPtr<CommandEncoder>&& aEncoder)
|
||||
nsTArray<WeakPtr<CanvasContext>>&& aTargetContexts)
|
||||
: ChildOf(aParent), mId(aId), mTargetContexts(std::move(aTargetContexts)) {
|
||||
mEncoder = std::move(aEncoder);
|
||||
MOZ_RELEASE_ASSERT(aId);
|
||||
}
|
||||
|
||||
void CommandBuffer::Cleanup() { mEncoder = nullptr; }
|
||||
CommandBuffer::~CommandBuffer() { Cleanup(); }
|
||||
|
||||
void CommandBuffer::Cleanup() {
|
||||
if (mValid && mParent) {
|
||||
mValid = false;
|
||||
auto bridge = mParent->GetBridge();
|
||||
if (bridge && bridge->IsOpen()) {
|
||||
bridge->SendCommandBufferDrop(mId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Maybe<RawId> CommandBuffer::Commit() {
|
||||
if (!mValid) {
|
||||
|
|
|
|||
|
|
@ -22,23 +22,17 @@ class CommandBuffer final : public ObjectBase, public ChildOf<Device> {
|
|||
GPU_DECL_JS_WRAP(CommandBuffer)
|
||||
|
||||
CommandBuffer(Device* const aParent, RawId aId,
|
||||
nsTArray<WeakPtr<CanvasContext>>&& aTargetContexts,
|
||||
RefPtr<CommandEncoder>&& aEncoder);
|
||||
nsTArray<WeakPtr<CanvasContext>>&& aTargetContexts);
|
||||
|
||||
Maybe<RawId> Commit();
|
||||
|
||||
private:
|
||||
CommandBuffer() = delete;
|
||||
~CommandBuffer() = default;
|
||||
~CommandBuffer();
|
||||
void Cleanup();
|
||||
|
||||
const RawId mId;
|
||||
const nsTArray<WeakPtr<CanvasContext>> mTargetContexts;
|
||||
// Command buffers and encoders share the same identity (this is a
|
||||
// simplifcation currently made by wgpu). To avoid dropping the same ID twice,
|
||||
// the wgpu resource lifetime is tied to the encoder which is held alive by
|
||||
// the command buffer.
|
||||
RefPtr<CommandEncoder> mEncoder;
|
||||
};
|
||||
|
||||
} // namespace mozilla::webgpu
|
||||
|
|
|
|||
|
|
@ -80,12 +80,11 @@ CommandEncoder::CommandEncoder(Device* const aParent,
|
|||
CommandEncoder::~CommandEncoder() { Cleanup(); }
|
||||
|
||||
void CommandEncoder::Cleanup() {
|
||||
if (!mValid) {
|
||||
return;
|
||||
}
|
||||
mValid = false;
|
||||
if (mBridge->IsOpen()) {
|
||||
mBridge->SendCommandEncoderDrop(mId);
|
||||
if (mValid) {
|
||||
mValid = false;
|
||||
if (mBridge->IsOpen()) {
|
||||
mBridge->SendCommandEncoderDrop(mId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -94,102 +93,88 @@ void CommandEncoder::CopyBufferToBuffer(const Buffer& aSource,
|
|||
const Buffer& aDestination,
|
||||
BufferAddress aDestinationOffset,
|
||||
BufferAddress aSize) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
ipc::ByteBuf bb;
|
||||
ffi::wgpu_command_encoder_copy_buffer_to_buffer(
|
||||
aSource.mId, aSourceOffset, aDestination.mId, aDestinationOffset, aSize,
|
||||
ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
ffi::wgpu_command_encoder_copy_buffer_to_buffer(
|
||||
aSource.mId, aSourceOffset, aDestination.mId, aDestinationOffset, aSize,
|
||||
ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
|
||||
void CommandEncoder::CopyBufferToTexture(
|
||||
const dom::GPUImageCopyBuffer& aSource,
|
||||
const dom::GPUImageCopyTexture& aDestination,
|
||||
const dom::GPUExtent3D& aCopySize) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
}
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
ipc::ByteBuf bb;
|
||||
ffi::WGPUImageDataLayout src_layout = {};
|
||||
CommandEncoder::ConvertTextureDataLayoutToFFI(aSource, &src_layout);
|
||||
ffi::wgpu_command_encoder_copy_buffer_to_texture(
|
||||
aSource.mBuffer->mId, &src_layout, ConvertTextureCopyView(aDestination),
|
||||
ConvertExtent(aCopySize), ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
ffi::WGPUImageDataLayout src_layout = {};
|
||||
CommandEncoder::ConvertTextureDataLayoutToFFI(aSource, &src_layout);
|
||||
ffi::wgpu_command_encoder_copy_buffer_to_texture(
|
||||
aSource.mBuffer->mId, &src_layout, ConvertTextureCopyView(aDestination),
|
||||
ConvertExtent(aCopySize), ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
|
||||
const auto& targetContext = aDestination.mTexture->mTargetContext;
|
||||
if (targetContext) {
|
||||
mTargetContexts.AppendElement(targetContext);
|
||||
const auto& targetContext = aDestination.mTexture->mTargetContext;
|
||||
if (targetContext) {
|
||||
mTargetContexts.AppendElement(targetContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
void CommandEncoder::CopyTextureToBuffer(
|
||||
const dom::GPUImageCopyTexture& aSource,
|
||||
const dom::GPUImageCopyBuffer& aDestination,
|
||||
const dom::GPUExtent3D& aCopySize) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
ipc::ByteBuf bb;
|
||||
ffi::WGPUImageDataLayout dstLayout = {};
|
||||
CommandEncoder::ConvertTextureDataLayoutToFFI(aDestination, &dstLayout);
|
||||
ffi::wgpu_command_encoder_copy_texture_to_buffer(
|
||||
ConvertTextureCopyView(aSource), aDestination.mBuffer->mId, &dstLayout,
|
||||
ConvertExtent(aCopySize), ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
ffi::WGPUImageDataLayout dstLayout = {};
|
||||
CommandEncoder::ConvertTextureDataLayoutToFFI(aDestination, &dstLayout);
|
||||
ffi::wgpu_command_encoder_copy_texture_to_buffer(
|
||||
ConvertTextureCopyView(aSource), aDestination.mBuffer->mId, &dstLayout,
|
||||
ConvertExtent(aCopySize), ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
void CommandEncoder::CopyTextureToTexture(
|
||||
const dom::GPUImageCopyTexture& aSource,
|
||||
const dom::GPUImageCopyTexture& aDestination,
|
||||
const dom::GPUExtent3D& aCopySize) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
}
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
ipc::ByteBuf bb;
|
||||
ffi::wgpu_command_encoder_copy_texture_to_texture(
|
||||
ConvertTextureCopyView(aSource), ConvertTextureCopyView(aDestination),
|
||||
ConvertExtent(aCopySize), ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
ffi::wgpu_command_encoder_copy_texture_to_texture(
|
||||
ConvertTextureCopyView(aSource), ConvertTextureCopyView(aDestination),
|
||||
ConvertExtent(aCopySize), ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
|
||||
const auto& targetContext = aDestination.mTexture->mTargetContext;
|
||||
if (targetContext) {
|
||||
mTargetContexts.AppendElement(targetContext);
|
||||
const auto& targetContext = aDestination.mTexture->mTargetContext;
|
||||
if (targetContext) {
|
||||
mTargetContexts.AppendElement(targetContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandEncoder::PushDebugGroup(const nsAString& aString) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
ipc::ByteBuf bb;
|
||||
NS_ConvertUTF16toUTF8 marker(aString);
|
||||
ffi::wgpu_command_encoder_push_debug_group(&marker, ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
NS_ConvertUTF16toUTF8 marker(aString);
|
||||
ffi::wgpu_command_encoder_push_debug_group(&marker, ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
void CommandEncoder::PopDebugGroup() {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
ipc::ByteBuf bb;
|
||||
ffi::wgpu_command_encoder_pop_debug_group(ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
ffi::wgpu_command_encoder_pop_debug_group(ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
void CommandEncoder::InsertDebugMarker(const nsAString& aString) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
ipc::ByteBuf bb;
|
||||
NS_ConvertUTF16toUTF8 marker(aString);
|
||||
ffi::wgpu_command_encoder_insert_debug_marker(&marker, ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
NS_ConvertUTF16toUTF8 marker(aString);
|
||||
ffi::wgpu_command_encoder_insert_debug_marker(&marker, ToFFI(&bb));
|
||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(bb));
|
||||
}
|
||||
|
||||
already_AddRefed<ComputePassEncoder> CommandEncoder::BeginComputePass(
|
||||
|
|
@ -215,9 +200,10 @@ already_AddRefed<RenderPassEncoder> CommandEncoder::BeginRenderPass(
|
|||
return pass.forget();
|
||||
}
|
||||
|
||||
void CommandEncoder::EndComputePass(ffi::WGPUComputePass& aPass) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
void CommandEncoder::EndComputePass(ffi::WGPUComputePass& aPass,
|
||||
ErrorResult& aRv) {
|
||||
if (!mValid || !mBridge->IsOpen()) {
|
||||
return aRv.ThrowInvalidStateError("Command encoder is not valid");
|
||||
}
|
||||
|
||||
ipc::ByteBuf byteBuf;
|
||||
|
|
@ -225,9 +211,10 @@ void CommandEncoder::EndComputePass(ffi::WGPUComputePass& aPass) {
|
|||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(byteBuf));
|
||||
}
|
||||
|
||||
void CommandEncoder::EndRenderPass(ffi::WGPURenderPass& aPass) {
|
||||
if (!mBridge->IsOpen()) {
|
||||
return;
|
||||
void CommandEncoder::EndRenderPass(ffi::WGPURenderPass& aPass,
|
||||
ErrorResult& aRv) {
|
||||
if (!mValid || !mBridge->IsOpen()) {
|
||||
return aRv.ThrowInvalidStateError("Command encoder is not valid");
|
||||
}
|
||||
|
||||
ipc::ByteBuf byteBuf;
|
||||
|
|
@ -237,12 +224,13 @@ void CommandEncoder::EndRenderPass(ffi::WGPURenderPass& aPass) {
|
|||
|
||||
already_AddRefed<CommandBuffer> CommandEncoder::Finish(
|
||||
const dom::GPUCommandBufferDescriptor& aDesc) {
|
||||
// WebGPUChild::CommandEncoderFinish handles the case where the IPC channel
|
||||
// closed.
|
||||
RawId id = mBridge->CommandEncoderFinish(mId, mParent->mId, aDesc);
|
||||
RefPtr<CommandEncoder> me(this);
|
||||
RawId id = 0;
|
||||
if (mValid && mBridge->IsOpen()) {
|
||||
mValid = false;
|
||||
id = mBridge->CommandEncoderFinish(mId, mParent->mId, aDesc);
|
||||
}
|
||||
RefPtr<CommandBuffer> comb =
|
||||
new CommandBuffer(mParent, id, std::move(mTargetContexts), std::move(me));
|
||||
new CommandBuffer(mParent, id, std::move(mTargetContexts));
|
||||
return comb.forget();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ class CommandEncoder final : public ObjectBase, public ChildOf<Device> {
|
|||
public:
|
||||
const auto& GetDevice() const { return mParent; };
|
||||
|
||||
void EndComputePass(ffi::WGPUComputePass& aPass);
|
||||
void EndRenderPass(ffi::WGPURenderPass& aPass);
|
||||
void EndComputePass(ffi::WGPUComputePass& aPass, ErrorResult& aRv);
|
||||
void EndRenderPass(ffi::WGPURenderPass& aPass, ErrorResult& aRv);
|
||||
|
||||
void CopyBufferToBuffer(const Buffer& aSource, BufferAddress aSourceOffset,
|
||||
const Buffer& aDestination,
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ void ComputePassEncoder::InsertDebugMarker(const nsAString& aString) {
|
|||
}
|
||||
}
|
||||
|
||||
void ComputePassEncoder::End() {
|
||||
void ComputePassEncoder::End(ErrorResult& aRv) {
|
||||
if (mValid) {
|
||||
mValid = false;
|
||||
auto* pass = mPass.forget();
|
||||
MOZ_ASSERT(pass);
|
||||
mParent->EndComputePass(*pass);
|
||||
mParent->EndComputePass(*pass, aRv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class ComputePassEncoder final : public ObjectBase,
|
|||
void PopDebugGroup();
|
||||
void InsertDebugMarker(const nsAString& aString);
|
||||
|
||||
void End();
|
||||
void End(ErrorResult& aRv);
|
||||
};
|
||||
|
||||
} // namespace webgpu
|
||||
|
|
|
|||
|
|
@ -318,12 +318,12 @@ void RenderPassEncoder::InsertDebugMarker(const nsAString& aString) {
|
|||
}
|
||||
}
|
||||
|
||||
void RenderPassEncoder::End() {
|
||||
void RenderPassEncoder::End(ErrorResult& aRv) {
|
||||
if (mValid) {
|
||||
mValid = false;
|
||||
auto* pass = mPass.forget();
|
||||
MOZ_ASSERT(pass);
|
||||
mParent->EndRenderPass(*pass);
|
||||
mParent->EndRenderPass(*pass, aRv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class RenderPassEncoder final : public ObjectBase,
|
|||
void ExecuteBundles(
|
||||
const dom::Sequence<OwningNonNull<RenderBundle>>& aBundles);
|
||||
|
||||
void End();
|
||||
void End(ErrorResult& aRv);
|
||||
};
|
||||
|
||||
} // namespace webgpu
|
||||
|
|
|
|||
|
|
@ -45,26 +45,18 @@ Texture::Texture(Device* const aParent, RawId aId,
|
|||
MOZ_RELEASE_ASSERT(aId);
|
||||
}
|
||||
|
||||
void Texture::Cleanup() {
|
||||
if (!mParent) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto bridge = mParent->GetBridge();
|
||||
if (bridge && bridge->IsOpen()) {
|
||||
bridge->SendTextureDrop(mId);
|
||||
}
|
||||
|
||||
// After cleanup is called, no other method should ever be called on the
|
||||
// object so we don't have to null-check mParent in other places.
|
||||
// This serves the purpose of preventing SendTextureDrop from happening
|
||||
// twice. TODO: Does it matter for breaking cycles too? Cleanup is called
|
||||
// by the macros that deal with cycle colleciton.
|
||||
mParent = nullptr;
|
||||
}
|
||||
|
||||
Texture::~Texture() { Cleanup(); }
|
||||
|
||||
void Texture::Cleanup() {
|
||||
if (mValid && mParent) {
|
||||
mValid = false;
|
||||
auto bridge = mParent->GetBridge();
|
||||
if (bridge && bridge->IsOpen()) {
|
||||
bridge->SendTextureDrop(mId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<TextureView> Texture::CreateView(
|
||||
const dom::GPUTextureViewDescriptor& aDesc) {
|
||||
auto bridge = mParent->GetBridge();
|
||||
|
|
@ -78,10 +70,12 @@ already_AddRefed<TextureView> Texture::CreateView(
|
|||
}
|
||||
|
||||
void Texture::Destroy() {
|
||||
auto bridge = mParent->GetBridge();
|
||||
if (bridge && bridge->IsOpen()) {
|
||||
bridge->SendTextureDestroy(mId, mParent->GetId());
|
||||
}
|
||||
// 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; }
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ parent:
|
|||
async BufferUnmap(RawId deviceId, RawId bufferId, bool flush);
|
||||
async BufferDestroy(RawId selfId);
|
||||
async BufferDrop(RawId selfId);
|
||||
async TextureDestroy(RawId selfId, RawId deviceId);
|
||||
async TextureDrop(RawId selfId);
|
||||
async TextureViewDrop(RawId selfId);
|
||||
async SamplerDrop(RawId selfId);
|
||||
|
|
@ -64,6 +63,7 @@ parent:
|
|||
|
||||
async CommandEncoderFinish(RawId selfId, RawId deviceId, GPUCommandBufferDescriptor desc);
|
||||
async CommandEncoderDrop(RawId selfId);
|
||||
async CommandBufferDrop(RawId selfId);
|
||||
async RenderBundleDrop(RawId selfId);
|
||||
async QueueSubmit(RawId selfId, RawId aDeviceId, RawId[] commandBuffers);
|
||||
async QueueOnSubmittedWorkDone(RawId selfId) returns (void_t ok);
|
||||
|
|
|
|||
|
|
@ -441,22 +441,13 @@ RawId WebGPUChild::DeviceCreateCommandEncoder(
|
|||
RawId WebGPUChild::CommandEncoderFinish(
|
||||
RawId aSelfId, RawId aDeviceId,
|
||||
const dom::GPUCommandBufferDescriptor& aDesc) {
|
||||
if (!SendCommandEncoderFinish(aSelfId, aDeviceId, aDesc)) {
|
||||
MOZ_CRASH("IPC failure");
|
||||
}
|
||||
// We rely on knowledge that `CommandEncoderId` == `CommandBufferId`
|
||||
// TODO: refactor this to truly behave as if the encoder is being finished,
|
||||
// and a new command buffer ID is being created from it. Resolve the ID
|
||||
// type aliasing at the place that introduces it: `wgpu-core`.
|
||||
|
||||
if (!IsOpen()) {
|
||||
// The GPU process went down. This will be handled elsewhere so pretend
|
||||
// the message was sent successfully. There is nothing we can do with
|
||||
// the produced handle so all we need is to make sure it isn't invalid
|
||||
// (it must not be zero).
|
||||
return aSelfId;
|
||||
}
|
||||
|
||||
if (!SendCommandEncoderFinish(aSelfId, aDeviceId, aDesc)) {
|
||||
MOZ_CRASH("IPC failure");
|
||||
}
|
||||
return aSelfId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -708,23 +708,13 @@ ipc::IPCResult WebGPUParent::RecvBufferDestroy(RawId aBufferId) {
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
void WebGPUParent::RemoveExternalTexture(RawId aTextureId) {
|
||||
ipc::IPCResult WebGPUParent::RecvTextureDrop(RawId aTextureId) {
|
||||
ffi::wgpu_server_texture_drop(mContext.get(), aTextureId);
|
||||
|
||||
auto it = mExternalTextures.find(aTextureId);
|
||||
if (it != mExternalTextures.end()) {
|
||||
mExternalTextures.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUParent::RecvTextureDestroy(RawId aTextureId,
|
||||
RawId aDeviceId) {
|
||||
ffi::wgpu_server_texture_destroy(mContext.get(), aTextureId);
|
||||
RemoveExternalTexture(aTextureId);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUParent::RecvTextureDrop(RawId aTextureId) {
|
||||
ffi::wgpu_server_texture_drop(mContext.get(), aTextureId);
|
||||
RemoveExternalTexture(aTextureId);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
@ -760,6 +750,11 @@ ipc::IPCResult WebGPUParent::RecvCommandEncoderDrop(RawId aEncoderId) {
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUParent::RecvCommandBufferDrop(RawId aCommandBufferId) {
|
||||
ffi::wgpu_server_command_buffer_drop(mContext.get(), aCommandBufferId);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
ipc::IPCResult WebGPUParent::RecvRenderBundleDrop(RawId aBundleId) {
|
||||
ffi::wgpu_server_render_bundle_drop(mContext.get(), aBundleId);
|
||||
return IPC_OK();
|
||||
|
|
@ -1176,16 +1171,9 @@ ipc::IPCResult WebGPUParent::RecvSwapChainPresent(
|
|||
static_cast<uint32_t>(size.height),
|
||||
1,
|
||||
};
|
||||
|
||||
{
|
||||
ErrorBuffer error;
|
||||
ffi::wgpu_server_encoder_copy_texture_to_buffer(
|
||||
mContext.get(), aCommandEncoderId, &texView, bufferId, &bufLayout,
|
||||
&extent, error.ToFFI());
|
||||
if (ForwardError(data->mDeviceId, error)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
}
|
||||
ffi::wgpu_server_encoder_copy_texture_to_buffer(
|
||||
mContext.get(), aCommandEncoderId, &texView, bufferId, &bufLayout,
|
||||
&extent);
|
||||
ffi::WGPUCommandBufferDescriptor commandDesc = {};
|
||||
{
|
||||
ErrorBuffer error;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ class WebGPUParent final : public PWebGPUParent {
|
|||
ipc::IPCResult RecvBufferUnmap(RawId aDeviceId, RawId aBufferId, bool aFlush);
|
||||
ipc::IPCResult RecvBufferDestroy(RawId aBufferId);
|
||||
ipc::IPCResult RecvBufferDrop(RawId aBufferId);
|
||||
ipc::IPCResult RecvTextureDestroy(RawId aTextureId, RawId aDeviceId);
|
||||
ipc::IPCResult RecvTextureDrop(RawId aTextureId);
|
||||
ipc::IPCResult RecvTextureViewDrop(RawId aTextureViewId);
|
||||
ipc::IPCResult RecvSamplerDrop(RawId aSamplerId);
|
||||
|
|
@ -170,8 +169,6 @@ class WebGPUParent final : public PWebGPUParent {
|
|||
uint8_t* aUserData);
|
||||
void DeallocBufferShmem(RawId aBufferId);
|
||||
|
||||
void RemoveExternalTexture(RawId aTextureId);
|
||||
|
||||
virtual ~WebGPUParent();
|
||||
void MaintainDevices();
|
||||
void LoseDevice(const RawId aDeviceId, Maybe<uint8_t> aReason,
|
||||
|
|
|
|||
|
|
@ -52,11 +52,6 @@ fail-if = [
|
|||
"os == 'mac'",
|
||||
]
|
||||
|
||||
["test_double_encoder_finish.html"]
|
||||
fail-if = [
|
||||
"os == 'linux' && os_version == '18.04'",
|
||||
]
|
||||
|
||||
["test_enabled.html"]
|
||||
|
||||
["test_error_scope.html"]
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
ok(
|
||||
SpecialPowers.getBoolPref("dom.webgpu.enabled"),
|
||||
"Pref should be enabled."
|
||||
);
|
||||
|
||||
const func = async function () {
|
||||
const adapter = await navigator.gpu.requestAdapter();
|
||||
const device = await adapter.requestDevice();
|
||||
const encoder = device.createCommandEncoder();
|
||||
|
||||
const command_buffer = encoder.finish();
|
||||
ok(command_buffer !== undefined, "command_buffer !== undefined");
|
||||
|
||||
const invalid_command_buffer = encoder.finish();
|
||||
ok(
|
||||
invalid_command_buffer !== undefined,
|
||||
"invalid_command_buffer !== undefined"
|
||||
);
|
||||
};
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
func()
|
||||
.catch(e => ok(false, "Unhandled exception " + e))
|
||||
.finally(() => SimpleTest.finish());
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -922,6 +922,7 @@ interface GPUComputePassEncoder {
|
|||
[Pref="dom.webgpu.indirect-dispatch.enabled"]
|
||||
undefined dispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
||||
|
||||
[Throws]
|
||||
undefined end();
|
||||
};
|
||||
GPUComputePassEncoder includes GPUObjectBase;
|
||||
|
|
@ -950,6 +951,7 @@ interface GPURenderPassEncoder {
|
|||
//undefined endOcclusionQuery();
|
||||
|
||||
undefined executeBundles(sequence<GPURenderBundle> bundles);
|
||||
[Throws]
|
||||
undefined end();
|
||||
};
|
||||
GPURenderPassEncoder includes GPUObjectBase;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ mod foreign {
|
|||
},
|
||||
resource::{
|
||||
BufferAccessError, CreateBufferError, CreateSamplerError, CreateTextureError,
|
||||
CreateTextureViewError, DestroyError,
|
||||
CreateTextureViewError,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -653,10 +653,4 @@ mod foreign {
|
|||
ErrorBufferType::Validation
|
||||
}
|
||||
}
|
||||
|
||||
impl HasErrorBufferType for DestroyError {
|
||||
fn error_type(&self) -> ErrorBufferType {
|
||||
ErrorBufferType::Validation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -982,6 +982,11 @@ pub extern "C" fn wgpu_server_encoder_drop(global: &Global, self_id: id::Command
|
|||
gfx_select!(self_id => global.command_encoder_drop(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_command_buffer_drop(global: &Global, self_id: id::CommandBufferId) {
|
||||
gfx_select!(self_id => global.command_buffer_drop(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_render_bundle_drop(global: &Global, self_id: id::RenderBundleId) {
|
||||
gfx_select!(self_id => global.render_bundle_drop(self_id));
|
||||
|
|
@ -995,15 +1000,12 @@ pub unsafe extern "C" fn wgpu_server_encoder_copy_texture_to_buffer(
|
|||
dst_buffer: wgc::id::BufferId,
|
||||
dst_layout: &crate::ImageDataLayout,
|
||||
size: &wgt::Extent3d,
|
||||
mut error_buf: ErrorBuffer,
|
||||
) {
|
||||
let destination = wgc::command::ImageCopyBuffer {
|
||||
buffer: dst_buffer,
|
||||
layout: dst_layout.into_wgt(),
|
||||
};
|
||||
if let Err(err) = gfx_select!(self_id => global.command_encoder_copy_texture_to_buffer(self_id, source, &destination, size)) {
|
||||
error_buf.init(err);
|
||||
}
|
||||
gfx_select!(self_id => global.command_encoder_copy_texture_to_buffer(self_id, source, &destination, size)).unwrap();
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
|
|
@ -1098,14 +1100,6 @@ pub extern "C" fn wgpu_server_render_pipeline_drop(global: &Global, self_id: id:
|
|||
gfx_select!(self_id => global.render_pipeline_drop(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_texture_destroy(
|
||||
global: &Global,
|
||||
self_id: id::TextureId,
|
||||
) {
|
||||
let _ = gfx_select!(self_id => global.texture_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_texture_drop(global: &Global, self_id: id::TextureId) {
|
||||
gfx_select!(self_id => global.texture_drop(self_id, false));
|
||||
|
|
|
|||
|
|
@ -535,3 +535,7 @@
|
|||
[:]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[cts.https.html?q=webgpu:api,validation,queue,destroyed,texture:writeTexture:*]
|
||||
[:]
|
||||
expected: FAIL
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@
|
|||
|
||||
|
||||
[cts.https.html?q=webgpu:api,validation,queue,writeTexture:texture_state:*]
|
||||
[:textureState="destroyed"]
|
||||
expected: FAIL
|
||||
|
||||
[:textureState="invalid"]
|
||||
expected:
|
||||
if os == "win": [PASS, FAIL]
|
||||
|
|
|
|||
Loading…
Reference in a new issue