mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-01 11:27:55 +00:00
Backed out 3 changesets (bug 1878308) for causing webgpu failures. CLOSED TREE
Backed out changeset 2887e360adb9 (bug 1878308) Backed out changeset c5f276e2774d (bug 1878308) Backed out changeset b3fb55591aa7 (bug 1878308)
This commit is contained in:
parent
c9013b3172
commit
4fe00e0322
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -6540,7 +6540,6 @@ dependencies = [
|
|||||||
name = "wgpu_bindings"
|
name = "wgpu_bindings"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
|
||||||
"bincode",
|
"bincode",
|
||||||
"d3d12",
|
"d3d12",
|
||||||
"log",
|
"log",
|
||||||
|
@ -230,7 +230,7 @@ already_AddRefed<RenderPassEncoder> CommandEncoder::BeginRenderPass(
|
|||||||
return pass.forget();
|
return pass.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::EndComputePass(ffi::WGPURecordedComputePass& aPass) {
|
void CommandEncoder::EndComputePass(ffi::WGPUComputePass& aPass) {
|
||||||
if (!mBridge->IsOpen()) {
|
if (!mBridge->IsOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -240,14 +240,14 @@ void CommandEncoder::EndComputePass(ffi::WGPURecordedComputePass& aPass) {
|
|||||||
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(byteBuf));
|
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(byteBuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::EndRenderPass(ffi::WGPURecordedRenderPass& aPass) {
|
void CommandEncoder::EndRenderPass(ffi::WGPURenderPass& aPass) {
|
||||||
if (!mBridge->IsOpen()) {
|
if (!mBridge->IsOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc::ByteBuf byteBuf;
|
ipc::ByteBuf byteBuf;
|
||||||
ffi::wgpu_render_pass_finish(&aPass, ToFFI(&byteBuf));
|
ffi::wgpu_render_pass_finish(&aPass, ToFFI(&byteBuf));
|
||||||
mBridge->SendRenderPass(mId, mParent->mId, std::move(byteBuf));
|
mBridge->SendCommandEncoderAction(mId, mParent->mId, std::move(byteBuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<CommandBuffer> CommandEncoder::Finish(
|
already_AddRefed<CommandBuffer> CommandEncoder::Finish(
|
||||||
|
@ -32,7 +32,7 @@ using GPUExtent3D = RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict;
|
|||||||
namespace webgpu {
|
namespace webgpu {
|
||||||
namespace ffi {
|
namespace ffi {
|
||||||
struct WGPUComputePass;
|
struct WGPUComputePass;
|
||||||
struct WGPURecordedRenderPass;
|
struct WGPURenderPass;
|
||||||
struct WGPUImageDataLayout;
|
struct WGPUImageDataLayout;
|
||||||
struct WGPUImageCopyTexture_TextureId;
|
struct WGPUImageCopyTexture_TextureId;
|
||||||
struct WGPUExtent3d;
|
struct WGPUExtent3d;
|
||||||
@ -72,8 +72,8 @@ class CommandEncoder final : public ObjectBase, public ChildOf<Device> {
|
|||||||
public:
|
public:
|
||||||
const auto& GetDevice() const { return mParent; };
|
const auto& GetDevice() const { return mParent; };
|
||||||
|
|
||||||
void EndComputePass(ffi::WGPURecordedComputePass& aPass);
|
void EndComputePass(ffi::WGPUComputePass& aPass);
|
||||||
void EndRenderPass(ffi::WGPURecordedRenderPass& aPass);
|
void EndRenderPass(ffi::WGPURenderPass& aPass);
|
||||||
|
|
||||||
void CopyBufferToBuffer(const Buffer& aSource, BufferAddress aSourceOffset,
|
void CopyBufferToBuffer(const Buffer& aSource, BufferAddress aSourceOffset,
|
||||||
const Buffer& aDestination,
|
const Buffer& aDestination,
|
||||||
|
@ -17,13 +17,13 @@ GPU_IMPL_CYCLE_COLLECTION(ComputePassEncoder, mParent, mUsedBindGroups,
|
|||||||
mUsedPipelines)
|
mUsedPipelines)
|
||||||
GPU_IMPL_JS_WRAP(ComputePassEncoder)
|
GPU_IMPL_JS_WRAP(ComputePassEncoder)
|
||||||
|
|
||||||
void ffiWGPUComputePassDeleter::operator()(ffi::WGPURecordedComputePass* raw) {
|
void ffiWGPUComputePassDeleter::operator()(ffi::WGPUComputePass* raw) {
|
||||||
if (raw) {
|
if (raw) {
|
||||||
ffi::wgpu_compute_pass_destroy(raw);
|
ffi::wgpu_compute_pass_destroy(raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ffi::WGPURecordedComputePass* BeginComputePass(
|
ffi::WGPUComputePass* BeginComputePass(
|
||||||
RawId aEncoderId, const dom::GPUComputePassDescriptor& aDesc) {
|
RawId aEncoderId, const dom::GPUComputePassDescriptor& aDesc) {
|
||||||
MOZ_RELEASE_ASSERT(aEncoderId);
|
MOZ_RELEASE_ASSERT(aEncoderId);
|
||||||
ffi::WGPUComputePassDescriptor desc = {};
|
ffi::WGPUComputePassDescriptor desc = {};
|
||||||
@ -31,7 +31,7 @@ ffi::WGPURecordedComputePass* BeginComputePass(
|
|||||||
webgpu::StringHelper label(aDesc.mLabel);
|
webgpu::StringHelper label(aDesc.mLabel);
|
||||||
desc.label = label.Get();
|
desc.label = label.Get();
|
||||||
|
|
||||||
return ffi::wgpu_command_encoder_begin_compute_pass(&desc);
|
return ffi::wgpu_command_encoder_begin_compute_pass(aEncoderId, &desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputePassEncoder::ComputePassEncoder(
|
ComputePassEncoder::ComputePassEncoder(
|
||||||
@ -49,16 +49,16 @@ void ComputePassEncoder::SetBindGroup(
|
|||||||
const dom::Sequence<uint32_t>& aDynamicOffsets) {
|
const dom::Sequence<uint32_t>& aDynamicOffsets) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
mUsedBindGroups.AppendElement(&aBindGroup);
|
mUsedBindGroups.AppendElement(&aBindGroup);
|
||||||
ffi::wgpu_recorded_compute_pass_set_bind_group(
|
ffi::wgpu_compute_pass_set_bind_group(mPass.get(), aSlot, aBindGroup.mId,
|
||||||
mPass.get(), aSlot, aBindGroup.mId, aDynamicOffsets.Elements(),
|
aDynamicOffsets.Elements(),
|
||||||
aDynamicOffsets.Length());
|
aDynamicOffsets.Length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputePassEncoder::SetPipeline(const ComputePipeline& aPipeline) {
|
void ComputePassEncoder::SetPipeline(const ComputePipeline& aPipeline) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
mUsedPipelines.AppendElement(&aPipeline);
|
mUsedPipelines.AppendElement(&aPipeline);
|
||||||
ffi::wgpu_recorded_compute_pass_set_pipeline(mPass.get(), aPipeline.mId);
|
ffi::wgpu_compute_pass_set_pipeline(mPass.get(), aPipeline.mId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ void ComputePassEncoder::DispatchWorkgroups(uint32_t workgroupCountX,
|
|||||||
uint32_t workgroupCountY,
|
uint32_t workgroupCountY,
|
||||||
uint32_t workgroupCountZ) {
|
uint32_t workgroupCountZ) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_compute_pass_dispatch_workgroups(
|
ffi::wgpu_compute_pass_dispatch_workgroups(
|
||||||
mPass.get(), workgroupCountX, workgroupCountY, workgroupCountZ);
|
mPass.get(), workgroupCountX, workgroupCountY, workgroupCountZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ void ComputePassEncoder::DispatchWorkgroups(uint32_t workgroupCountX,
|
|||||||
void ComputePassEncoder::DispatchWorkgroupsIndirect(
|
void ComputePassEncoder::DispatchWorkgroupsIndirect(
|
||||||
const Buffer& aIndirectBuffer, uint64_t aIndirectOffset) {
|
const Buffer& aIndirectBuffer, uint64_t aIndirectOffset) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_compute_pass_dispatch_workgroups_indirect(
|
ffi::wgpu_compute_pass_dispatch_workgroups_indirect(
|
||||||
mPass.get(), aIndirectBuffer.mId, aIndirectOffset);
|
mPass.get(), aIndirectBuffer.mId, aIndirectOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,20 +82,18 @@ void ComputePassEncoder::DispatchWorkgroupsIndirect(
|
|||||||
void ComputePassEncoder::PushDebugGroup(const nsAString& aString) {
|
void ComputePassEncoder::PushDebugGroup(const nsAString& aString) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
const NS_ConvertUTF16toUTF8 utf8(aString);
|
const NS_ConvertUTF16toUTF8 utf8(aString);
|
||||||
ffi::wgpu_recorded_compute_pass_push_debug_group(mPass.get(), utf8.get(),
|
ffi::wgpu_compute_pass_push_debug_group(mPass.get(), utf8.get(), 0);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ComputePassEncoder::PopDebugGroup() {
|
void ComputePassEncoder::PopDebugGroup() {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_compute_pass_pop_debug_group(mPass.get());
|
ffi::wgpu_compute_pass_pop_debug_group(mPass.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ComputePassEncoder::InsertDebugMarker(const nsAString& aString) {
|
void ComputePassEncoder::InsertDebugMarker(const nsAString& aString) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
const NS_ConvertUTF16toUTF8 utf8(aString);
|
const NS_ConvertUTF16toUTF8 utf8(aString);
|
||||||
ffi::wgpu_recorded_compute_pass_insert_debug_marker(mPass.get(), utf8.get(),
|
ffi::wgpu_compute_pass_insert_debug_marker(mPass.get(), utf8.get(), 0);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ struct GPUComputePassDescriptor;
|
|||||||
|
|
||||||
namespace webgpu {
|
namespace webgpu {
|
||||||
namespace ffi {
|
namespace ffi {
|
||||||
struct WGPURecordedComputePass;
|
struct WGPUComputePass;
|
||||||
} // namespace ffi
|
} // namespace ffi
|
||||||
|
|
||||||
class BindGroup;
|
class BindGroup;
|
||||||
@ -27,7 +27,7 @@ class CommandEncoder;
|
|||||||
class ComputePipeline;
|
class ComputePipeline;
|
||||||
|
|
||||||
struct ffiWGPUComputePassDeleter {
|
struct ffiWGPUComputePassDeleter {
|
||||||
void operator()(ffi::WGPURecordedComputePass*);
|
void operator()(ffi::WGPUComputePass*);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ComputePassEncoder final : public ObjectBase,
|
class ComputePassEncoder final : public ObjectBase,
|
||||||
@ -43,8 +43,7 @@ class ComputePassEncoder final : public ObjectBase,
|
|||||||
virtual ~ComputePassEncoder();
|
virtual ~ComputePassEncoder();
|
||||||
void Cleanup() {}
|
void Cleanup() {}
|
||||||
|
|
||||||
std::unique_ptr<ffi::WGPURecordedComputePass, ffiWGPUComputePassDeleter>
|
std::unique_ptr<ffi::WGPUComputePass, ffiWGPUComputePassDeleter> mPass;
|
||||||
mPass;
|
|
||||||
// keep all the used objects alive while the pass is recorded
|
// keep all the used objects alive while the pass is recorded
|
||||||
nsTArray<RefPtr<const BindGroup>> mUsedBindGroups;
|
nsTArray<RefPtr<const BindGroup>> mUsedBindGroups;
|
||||||
nsTArray<RefPtr<const ComputePipeline>> mUsedPipelines;
|
nsTArray<RefPtr<const ComputePipeline>> mUsedPipelines;
|
||||||
|
@ -18,7 +18,7 @@ GPU_IMPL_CYCLE_COLLECTION(RenderPassEncoder, mParent, mUsedBindGroups,
|
|||||||
mUsedRenderBundles)
|
mUsedRenderBundles)
|
||||||
GPU_IMPL_JS_WRAP(RenderPassEncoder)
|
GPU_IMPL_JS_WRAP(RenderPassEncoder)
|
||||||
|
|
||||||
void ffiWGPURenderPassDeleter::operator()(ffi::WGPURecordedRenderPass* raw) {
|
void ffiWGPURenderPassDeleter::operator()(ffi::WGPURenderPass* raw) {
|
||||||
if (raw) {
|
if (raw) {
|
||||||
ffi::wgpu_render_pass_destroy(raw);
|
ffi::wgpu_render_pass_destroy(raw);
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ static ffi::WGPUColor ConvertColor(
|
|||||||
return ffi::WGPUColor();
|
return ffi::WGPUColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
ffi::WGPURecordedRenderPass* BeginRenderPass(
|
ffi::WGPURenderPass* BeginRenderPass(
|
||||||
CommandEncoder* const aParent, const dom::GPURenderPassDescriptor& aDesc) {
|
CommandEncoder* const aParent, const dom::GPURenderPassDescriptor& aDesc) {
|
||||||
ffi::WGPURenderPassDescriptor desc = {};
|
ffi::WGPURenderPassDescriptor desc = {};
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ ffi::WGPURecordedRenderPass* BeginRenderPass(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ffi::wgpu_command_encoder_begin_render_pass(&desc);
|
return ffi::wgpu_command_encoder_begin_render_pass(aParent->mId, &desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderPassEncoder::RenderPassEncoder(CommandEncoder* const aParent,
|
RenderPassEncoder::RenderPassEncoder(CommandEncoder* const aParent,
|
||||||
@ -186,16 +186,16 @@ void RenderPassEncoder::SetBindGroup(
|
|||||||
const dom::Sequence<uint32_t>& aDynamicOffsets) {
|
const dom::Sequence<uint32_t>& aDynamicOffsets) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
mUsedBindGroups.AppendElement(&aBindGroup);
|
mUsedBindGroups.AppendElement(&aBindGroup);
|
||||||
ffi::wgpu_recorded_render_pass_set_bind_group(
|
ffi::wgpu_render_pass_set_bind_group(mPass.get(), aSlot, aBindGroup.mId,
|
||||||
mPass.get(), aSlot, aBindGroup.mId, aDynamicOffsets.Elements(),
|
aDynamicOffsets.Elements(),
|
||||||
aDynamicOffsets.Length());
|
aDynamicOffsets.Length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::SetPipeline(const RenderPipeline& aPipeline) {
|
void RenderPassEncoder::SetPipeline(const RenderPipeline& aPipeline) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
mUsedPipelines.AppendElement(&aPipeline);
|
mUsedPipelines.AppendElement(&aPipeline);
|
||||||
ffi::wgpu_recorded_render_pass_set_pipeline(mPass.get(), aPipeline.mId);
|
ffi::wgpu_render_pass_set_pipeline(mPass.get(), aPipeline.mId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,8 +207,8 @@ void RenderPassEncoder::SetIndexBuffer(const Buffer& aBuffer,
|
|||||||
const auto iformat = aIndexFormat == dom::GPUIndexFormat::Uint32
|
const auto iformat = aIndexFormat == dom::GPUIndexFormat::Uint32
|
||||||
? ffi::WGPUIndexFormat_Uint32
|
? ffi::WGPUIndexFormat_Uint32
|
||||||
: ffi::WGPUIndexFormat_Uint16;
|
: ffi::WGPUIndexFormat_Uint16;
|
||||||
ffi::wgpu_recorded_render_pass_set_index_buffer(mPass.get(), aBuffer.mId,
|
ffi::wgpu_render_pass_set_index_buffer(mPass.get(), aBuffer.mId, iformat,
|
||||||
iformat, aOffset, aSize);
|
aOffset, aSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,17 +216,16 @@ void RenderPassEncoder::SetVertexBuffer(uint32_t aSlot, const Buffer& aBuffer,
|
|||||||
uint64_t aOffset, uint64_t aSize) {
|
uint64_t aOffset, uint64_t aSize) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
mUsedBuffers.AppendElement(&aBuffer);
|
mUsedBuffers.AppendElement(&aBuffer);
|
||||||
ffi::wgpu_recorded_render_pass_set_vertex_buffer(
|
ffi::wgpu_render_pass_set_vertex_buffer(mPass.get(), aSlot, aBuffer.mId,
|
||||||
mPass.get(), aSlot, aBuffer.mId, aOffset, aSize);
|
aOffset, aSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::Draw(uint32_t aVertexCount, uint32_t aInstanceCount,
|
void RenderPassEncoder::Draw(uint32_t aVertexCount, uint32_t aInstanceCount,
|
||||||
uint32_t aFirstVertex, uint32_t aFirstInstance) {
|
uint32_t aFirstVertex, uint32_t aFirstInstance) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_draw(mPass.get(), aVertexCount,
|
ffi::wgpu_render_pass_draw(mPass.get(), aVertexCount, aInstanceCount,
|
||||||
aInstanceCount, aFirstVertex,
|
aFirstVertex, aFirstInstance);
|
||||||
aFirstInstance);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,24 +234,24 @@ void RenderPassEncoder::DrawIndexed(uint32_t aIndexCount,
|
|||||||
uint32_t aFirstIndex, int32_t aBaseVertex,
|
uint32_t aFirstIndex, int32_t aBaseVertex,
|
||||||
uint32_t aFirstInstance) {
|
uint32_t aFirstInstance) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_draw_indexed(mPass.get(), aIndexCount,
|
ffi::wgpu_render_pass_draw_indexed(mPass.get(), aIndexCount, aInstanceCount,
|
||||||
aInstanceCount, aFirstIndex,
|
aFirstIndex, aBaseVertex,
|
||||||
aBaseVertex, aFirstInstance);
|
aFirstInstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::DrawIndirect(const Buffer& aIndirectBuffer,
|
void RenderPassEncoder::DrawIndirect(const Buffer& aIndirectBuffer,
|
||||||
uint64_t aIndirectOffset) {
|
uint64_t aIndirectOffset) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_draw_indirect(
|
ffi::wgpu_render_pass_draw_indirect(mPass.get(), aIndirectBuffer.mId,
|
||||||
mPass.get(), aIndirectBuffer.mId, aIndirectOffset);
|
aIndirectOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::DrawIndexedIndirect(const Buffer& aIndirectBuffer,
|
void RenderPassEncoder::DrawIndexedIndirect(const Buffer& aIndirectBuffer,
|
||||||
uint64_t aIndirectOffset) {
|
uint64_t aIndirectOffset) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_draw_indexed_indirect(
|
ffi::wgpu_render_pass_draw_indexed_indirect(
|
||||||
mPass.get(), aIndirectBuffer.mId, aIndirectOffset);
|
mPass.get(), aIndirectBuffer.mId, aIndirectOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,16 +259,15 @@ void RenderPassEncoder::DrawIndexedIndirect(const Buffer& aIndirectBuffer,
|
|||||||
void RenderPassEncoder::SetViewport(float x, float y, float width, float height,
|
void RenderPassEncoder::SetViewport(float x, float y, float width, float height,
|
||||||
float minDepth, float maxDepth) {
|
float minDepth, float maxDepth) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_set_viewport(mPass.get(), x, y, width,
|
ffi::wgpu_render_pass_set_viewport(mPass.get(), x, y, width, height,
|
||||||
height, minDepth, maxDepth);
|
minDepth, maxDepth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::SetScissorRect(uint32_t x, uint32_t y, uint32_t width,
|
void RenderPassEncoder::SetScissorRect(uint32_t x, uint32_t y, uint32_t width,
|
||||||
uint32_t height) {
|
uint32_t height) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_set_scissor_rect(mPass.get(), x, y, width,
|
ffi::wgpu_render_pass_set_scissor_rect(mPass.get(), x, y, width, height);
|
||||||
height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,14 +275,13 @@ void RenderPassEncoder::SetBlendConstant(
|
|||||||
const dom::DoubleSequenceOrGPUColorDict& color) {
|
const dom::DoubleSequenceOrGPUColorDict& color) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::WGPUColor aColor = ConvertColor(color);
|
ffi::WGPUColor aColor = ConvertColor(color);
|
||||||
ffi::wgpu_recorded_render_pass_set_blend_constant(mPass.get(), &aColor);
|
ffi::wgpu_render_pass_set_blend_constant(mPass.get(), &aColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::SetStencilReference(uint32_t reference) {
|
void RenderPassEncoder::SetStencilReference(uint32_t reference) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_set_stencil_reference(mPass.get(),
|
ffi::wgpu_render_pass_set_stencil_reference(mPass.get(), reference);
|
||||||
reference);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,27 +293,26 @@ void RenderPassEncoder::ExecuteBundles(
|
|||||||
mUsedRenderBundles.AppendElement(bundle);
|
mUsedRenderBundles.AppendElement(bundle);
|
||||||
renderBundles.AppendElement(bundle->mId);
|
renderBundles.AppendElement(bundle->mId);
|
||||||
}
|
}
|
||||||
ffi::wgpu_recorded_render_pass_execute_bundles(
|
ffi::wgpu_render_pass_execute_bundles(mPass.get(), renderBundles.Elements(),
|
||||||
mPass.get(), renderBundles.Elements(), renderBundles.Length());
|
renderBundles.Length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::PushDebugGroup(const nsAString& aString) {
|
void RenderPassEncoder::PushDebugGroup(const nsAString& aString) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
const NS_ConvertUTF16toUTF8 utf8(aString);
|
const NS_ConvertUTF16toUTF8 utf8(aString);
|
||||||
ffi::wgpu_recorded_render_pass_push_debug_group(mPass.get(), utf8.get(), 0);
|
ffi::wgpu_render_pass_push_debug_group(mPass.get(), utf8.get(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void RenderPassEncoder::PopDebugGroup() {
|
void RenderPassEncoder::PopDebugGroup() {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
ffi::wgpu_recorded_render_pass_pop_debug_group(mPass.get());
|
ffi::wgpu_render_pass_pop_debug_group(mPass.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void RenderPassEncoder::InsertDebugMarker(const nsAString& aString) {
|
void RenderPassEncoder::InsertDebugMarker(const nsAString& aString) {
|
||||||
if (mValid) {
|
if (mValid) {
|
||||||
const NS_ConvertUTF16toUTF8 utf8(aString);
|
const NS_ConvertUTF16toUTF8 utf8(aString);
|
||||||
ffi::wgpu_recorded_render_pass_insert_debug_marker(mPass.get(), utf8.get(),
|
ffi::wgpu_render_pass_insert_debug_marker(mPass.get(), utf8.get(), 0);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class RenderPipeline;
|
|||||||
class TextureView;
|
class TextureView;
|
||||||
|
|
||||||
struct ffiWGPURenderPassDeleter {
|
struct ffiWGPURenderPassDeleter {
|
||||||
void operator()(ffi::WGPURecordedRenderPass*);
|
void operator()(ffi::WGPURenderPass*);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenderPassEncoder final : public ObjectBase,
|
class RenderPassEncoder final : public ObjectBase,
|
||||||
@ -51,7 +51,7 @@ class RenderPassEncoder final : public ObjectBase,
|
|||||||
virtual ~RenderPassEncoder();
|
virtual ~RenderPassEncoder();
|
||||||
void Cleanup() {}
|
void Cleanup() {}
|
||||||
|
|
||||||
std::unique_ptr<ffi::WGPURecordedRenderPass, ffiWGPURenderPassDeleter> mPass;
|
std::unique_ptr<ffi::WGPURenderPass, ffiWGPURenderPassDeleter> mPass;
|
||||||
// keep all the used objects alive while the pass is recorded
|
// keep all the used objects alive while the pass is recorded
|
||||||
nsTArray<RefPtr<const BindGroup>> mUsedBindGroups;
|
nsTArray<RefPtr<const BindGroup>> mUsedBindGroups;
|
||||||
nsTArray<RefPtr<const Buffer>> mUsedBuffers;
|
nsTArray<RefPtr<const Buffer>> mUsedBuffers;
|
||||||
|
@ -44,8 +44,6 @@ parent:
|
|||||||
async DeviceActionWithAck(RawId selfId, ByteBuf buf) returns (bool dummy);
|
async DeviceActionWithAck(RawId selfId, ByteBuf buf) returns (bool dummy);
|
||||||
async TextureAction(RawId selfId, RawId aDeviceId, ByteBuf buf);
|
async TextureAction(RawId selfId, RawId aDeviceId, ByteBuf buf);
|
||||||
async CommandEncoderAction(RawId selfId, RawId aDeviceId, ByteBuf buf);
|
async CommandEncoderAction(RawId selfId, RawId aDeviceId, ByteBuf buf);
|
||||||
async RenderPass(RawId selfId, RawId aDeviceId, ByteBuf buf);
|
|
||||||
async ComputePass(RawId selfId, RawId aDeviceId, ByteBuf buf);
|
|
||||||
async BumpImplicitBindGroupLayout(RawId pipelineId, bool isCompute, uint32_t index, RawId assignId);
|
async BumpImplicitBindGroupLayout(RawId pipelineId, bool isCompute, uint32_t index, RawId assignId);
|
||||||
|
|
||||||
async DeviceCreateBuffer(RawId deviceId, RawId bufferId, GPUBufferDescriptor desc, UnsafeSharedMemoryHandle shm);
|
async DeviceCreateBuffer(RawId deviceId, RawId bufferId, GPUBufferDescriptor desc, UnsafeSharedMemoryHandle shm);
|
||||||
|
@ -1341,24 +1341,6 @@ ipc::IPCResult WebGPUParent::RecvCommandEncoderAction(
|
|||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc::IPCResult WebGPUParent::RecvRenderPass(RawId aEncoderId, RawId aDeviceId,
|
|
||||||
const ipc::ByteBuf& aByteBuf) {
|
|
||||||
ErrorBuffer error;
|
|
||||||
ffi::wgpu_server_render_pass(mContext.get(), aEncoderId, ToFFI(&aByteBuf),
|
|
||||||
error.ToFFI());
|
|
||||||
ForwardError(aDeviceId, error);
|
|
||||||
return IPC_OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
ipc::IPCResult WebGPUParent::RecvComputePass(RawId aEncoderId, RawId aDeviceId,
|
|
||||||
const ipc::ByteBuf& aByteBuf) {
|
|
||||||
ErrorBuffer error;
|
|
||||||
ffi::wgpu_server_compute_pass(mContext.get(), aEncoderId, ToFFI(&aByteBuf),
|
|
||||||
error.ToFFI());
|
|
||||||
ForwardError(aDeviceId, error);
|
|
||||||
return IPC_OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
ipc::IPCResult WebGPUParent::RecvBumpImplicitBindGroupLayout(RawId aPipelineId,
|
ipc::IPCResult WebGPUParent::RecvBumpImplicitBindGroupLayout(RawId aPipelineId,
|
||||||
bool aIsCompute,
|
bool aIsCompute,
|
||||||
uint32_t aIndex,
|
uint32_t aIndex,
|
||||||
|
@ -118,10 +118,6 @@ class WebGPUParent final : public PWebGPUParent, public SupportsWeakPtr {
|
|||||||
const ipc::ByteBuf& aByteBuf);
|
const ipc::ByteBuf& aByteBuf);
|
||||||
ipc::IPCResult RecvCommandEncoderAction(RawId aEncoderId, RawId aDeviceId,
|
ipc::IPCResult RecvCommandEncoderAction(RawId aEncoderId, RawId aDeviceId,
|
||||||
const ipc::ByteBuf& aByteBuf);
|
const ipc::ByteBuf& aByteBuf);
|
||||||
ipc::IPCResult RecvRenderPass(RawId aEncoderId, RawId aDeviceId,
|
|
||||||
const ipc::ByteBuf& aByteBuf);
|
|
||||||
ipc::IPCResult RecvComputePass(RawId aEncoderId, RawId aDeviceId,
|
|
||||||
const ipc::ByteBuf& aByteBuf);
|
|
||||||
ipc::IPCResult RecvBumpImplicitBindGroupLayout(RawId aPipelineId,
|
ipc::IPCResult RecvBumpImplicitBindGroupLayout(RawId aPipelineId,
|
||||||
bool aIsCompute,
|
bool aIsCompute,
|
||||||
uint32_t aIndex,
|
uint32_t aIndex,
|
||||||
|
@ -68,4 +68,3 @@ parking_lot = "0.12"
|
|||||||
serde = "1"
|
serde = "1"
|
||||||
nsstring = { path = "../../xpcom/rust/nsstring" }
|
nsstring = { path = "../../xpcom/rust/nsstring" }
|
||||||
static_prefs = { path = "../../modules/libpref/init/static_prefs" }
|
static_prefs = { path = "../../modules/libpref/init/static_prefs" }
|
||||||
arrayvec = "0.7"
|
|
||||||
|
@ -769,8 +769,9 @@ pub struct ComputePassTimestampWrites<'a> {
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
|
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
|
||||||
|
encoder_id: id::CommandEncoderId,
|
||||||
desc: &ComputePassDescriptor,
|
desc: &ComputePassDescriptor,
|
||||||
) -> *mut crate::command::RecordedComputePass {
|
) -> *mut wgc::command::ComputePass {
|
||||||
let &ComputePassDescriptor {
|
let &ComputePassDescriptor {
|
||||||
label,
|
label,
|
||||||
timestamp_writes,
|
timestamp_writes,
|
||||||
@ -794,24 +795,27 @@ pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
|
|||||||
});
|
});
|
||||||
let timestamp_writes = timestamp_writes.as_ref();
|
let timestamp_writes = timestamp_writes.as_ref();
|
||||||
|
|
||||||
let pass = crate::command::RecordedComputePass::new(&wgc::command::ComputePassDescriptor {
|
let pass = wgc::command::ComputePass::new(
|
||||||
label,
|
encoder_id,
|
||||||
timestamp_writes,
|
&wgc::command::ComputePassDescriptor {
|
||||||
});
|
label,
|
||||||
|
timestamp_writes,
|
||||||
|
},
|
||||||
|
);
|
||||||
Box::into_raw(Box::new(pass))
|
Box::into_raw(Box::new(pass))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wgpu_compute_pass_finish(
|
pub unsafe extern "C" fn wgpu_compute_pass_finish(
|
||||||
pass: *mut crate::command::RecordedComputePass,
|
pass: *mut wgc::command::ComputePass,
|
||||||
output: &mut ByteBuf,
|
output: &mut ByteBuf,
|
||||||
) {
|
) {
|
||||||
let command = Box::from_raw(pass);
|
let command = Box::from_raw(pass).into_command();
|
||||||
*output = make_byte_buf(&command);
|
*output = make_byte_buf(&command);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: *mut crate::command::RecordedComputePass) {
|
pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: *mut wgc::command::ComputePass) {
|
||||||
let _ = Box::from_raw(pass);
|
let _ = Box::from_raw(pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,8 +838,9 @@ pub struct RenderPassTimestampWrites<'a> {
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
|
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
|
||||||
|
encoder_id: id::CommandEncoderId,
|
||||||
desc: &RenderPassDescriptor,
|
desc: &RenderPassDescriptor,
|
||||||
) -> *mut crate::command::RecordedRenderPass {
|
) -> *mut wgc::command::RenderPass {
|
||||||
let &RenderPassDescriptor {
|
let &RenderPassDescriptor {
|
||||||
label,
|
label,
|
||||||
color_attachments,
|
color_attachments,
|
||||||
@ -868,27 +873,30 @@ pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|format| Some(format.clone()))
|
.map(|format| Some(format.clone()))
|
||||||
.collect();
|
.collect();
|
||||||
let pass = crate::command::RecordedRenderPass::new(&wgc::command::RenderPassDescriptor {
|
let pass = wgc::command::RenderPass::new(
|
||||||
label,
|
encoder_id,
|
||||||
color_attachments: Cow::Owned(color_attachments),
|
&wgc::command::RenderPassDescriptor {
|
||||||
depth_stencil_attachment: depth_stencil_attachment.as_ref(),
|
label,
|
||||||
timestamp_writes,
|
color_attachments: Cow::Owned(color_attachments),
|
||||||
occlusion_query_set,
|
depth_stencil_attachment: depth_stencil_attachment.as_ref(),
|
||||||
});
|
timestamp_writes,
|
||||||
|
occlusion_query_set,
|
||||||
|
},
|
||||||
|
);
|
||||||
Box::into_raw(Box::new(pass))
|
Box::into_raw(Box::new(pass))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wgpu_render_pass_finish(
|
pub unsafe extern "C" fn wgpu_render_pass_finish(
|
||||||
pass: *mut crate::command::RecordedRenderPass,
|
pass: *mut wgc::command::RenderPass,
|
||||||
output: &mut ByteBuf,
|
output: &mut ByteBuf,
|
||||||
) {
|
) {
|
||||||
let command = Box::from_raw(pass);
|
let command = Box::from_raw(pass).into_command();
|
||||||
*output = make_byte_buf(&command);
|
*output = make_byte_buf(&command);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut crate::command::RecordedRenderPass) {
|
pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut wgc::command::RenderPass) {
|
||||||
let _ = Box::from_raw(pass);
|
let _ = Box::from_raw(pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,6 @@ use wgc::id;
|
|||||||
pub use wgc::command::{compute_ffi::*, render_ffi::*};
|
pub use wgc::command::{compute_ffi::*, render_ffi::*};
|
||||||
|
|
||||||
pub mod client;
|
pub mod client;
|
||||||
pub mod command;
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
|
||||||
|
@ -395,9 +395,7 @@ pub extern "C" fn wgpu_server_device_create_shader_module(
|
|||||||
if let Some(err) = error {
|
if let Some(err) = error {
|
||||||
out_message.set_error(&err, &source_str[..]);
|
out_message.set_error(&err, &source_str[..]);
|
||||||
let err_type = match &err {
|
let err_type = match &err {
|
||||||
CreateShaderModuleError::Device(DeviceError::OutOfMemory) => {
|
CreateShaderModuleError::Device(DeviceError::OutOfMemory) => ErrorBufferType::OutOfMemory,
|
||||||
ErrorBufferType::OutOfMemory
|
|
||||||
}
|
|
||||||
CreateShaderModuleError::Device(DeviceError::Lost) => ErrorBufferType::DeviceLost,
|
CreateShaderModuleError::Device(DeviceError::Lost) => ErrorBufferType::DeviceLost,
|
||||||
_ => ErrorBufferType::Validation,
|
_ => ErrorBufferType::Validation,
|
||||||
};
|
};
|
||||||
@ -567,10 +565,9 @@ pub extern "C" fn wgpu_server_get_device_fence_handle(
|
|||||||
if device_id.backend() == wgt::Backend::Dx12 {
|
if device_id.backend() == wgt::Backend::Dx12 {
|
||||||
let mut handle = ptr::null_mut();
|
let mut handle = ptr::null_mut();
|
||||||
let dx12_device = unsafe {
|
let dx12_device = unsafe {
|
||||||
global.device_as_hal::<wgc::api::Dx12, _, Option<d3d12::Device>>(
|
global.device_as_hal::<wgc::api::Dx12, _, Option<d3d12::Device>>(device_id, |hal_device| {
|
||||||
device_id,
|
hal_device.map(|device| device.raw_device().clone())
|
||||||
|hal_device| hal_device.map(|device| device.raw_device().clone()),
|
})
|
||||||
)
|
|
||||||
};
|
};
|
||||||
let dx12_device = match dx12_device {
|
let dx12_device = match dx12_device {
|
||||||
Some(device) => device,
|
Some(device) => device,
|
||||||
@ -580,10 +577,9 @@ pub extern "C" fn wgpu_server_get_device_fence_handle(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let dx12_fence = unsafe {
|
let dx12_fence = unsafe {
|
||||||
global.device_fence_as_hal::<wgc::api::Dx12, _, Option<d3d12::Fence>>(
|
global.device_fence_as_hal::<wgc::api::Dx12, _, Option<d3d12::Fence>>(device_id, |hal_fence| {
|
||||||
device_id,
|
hal_fence.map(|fence| fence.raw_fence().clone())
|
||||||
|hal_fence| hal_fence.map(|fence| fence.raw_fence().clone()),
|
})
|
||||||
)
|
|
||||||
};
|
};
|
||||||
let dx12_fence = match dx12_fence {
|
let dx12_fence = match dx12_fence {
|
||||||
Some(fence) => fence,
|
Some(fence) => fence,
|
||||||
@ -1042,32 +1038,6 @@ pub unsafe extern "C" fn wgpu_server_command_encoder_action(
|
|||||||
gfx_select!(self_id => global.command_encoder_action(self_id, action, error_buf));
|
gfx_select!(self_id => global.command_encoder_action(self_id, action, error_buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub unsafe extern "C" fn wgpu_server_render_pass(
|
|
||||||
global: &Global,
|
|
||||||
encoder_id: id::CommandEncoderId,
|
|
||||||
byte_buf: &ByteBuf,
|
|
||||||
error_buf: ErrorBuffer,
|
|
||||||
) {
|
|
||||||
let pass = bincode::deserialize(byte_buf.as_slice()).unwrap();
|
|
||||||
let action = crate::command::replay_render_pass(encoder_id, &pass).into_command();
|
|
||||||
|
|
||||||
gfx_select!(encoder_id => global.command_encoder_action(encoder_id, action, error_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub unsafe extern "C" fn wgpu_server_compute_pass(
|
|
||||||
global: &Global,
|
|
||||||
encoder_id: id::CommandEncoderId,
|
|
||||||
byte_buf: &ByteBuf,
|
|
||||||
error_buf: ErrorBuffer,
|
|
||||||
) {
|
|
||||||
let pass = bincode::deserialize(byte_buf.as_slice()).unwrap();
|
|
||||||
let action = crate::command::replay_compute_pass(encoder_id, &pass).into_command();
|
|
||||||
|
|
||||||
gfx_select!(encoder_id => global.command_encoder_action(encoder_id, action, error_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wgpu_server_device_create_encoder(
|
pub extern "C" fn wgpu_server_device_create_encoder(
|
||||||
global: &Global,
|
global: &Global,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user