Skip to content

Commit

Permalink
Bug 1865830 - Implement CommandEncoder.clearBuffer. r=webgpu-reviewer…
Browse files Browse the repository at this point in the history
…s,webidl,emilio,ErichDonGubler

Differential Revision: https://phabricator.services.mozilla.com/D194233

UltraBlame original commit: 774b13e9f1e717fff8e4c72128434adba4e2d6b1
  • Loading branch information
marco-c committed Dec 7, 2023
1 parent d7ff59a commit 89ba098
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 0 deletions.
102 changes: 102 additions & 0 deletions dom/webgpu/CommandEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,108 @@ void
CommandEncoder
:
:
ClearBuffer
(
const
Buffer
&
aBuffer
const
uint64_t
aOffset
const
dom
:
:
Optional
<
uint64_t
>
&
aSize
)
{
uint64_t
sizeVal
=
0xdeaddead
;
uint64_t
*
size
=
nullptr
;
if
(
aSize
.
WasPassed
(
)
)
{
sizeVal
=
aSize
.
Value
(
)
;
size
=
&
sizeVal
;
}
ipc
:
:
ByteBuf
bb
;
ffi
:
:
wgpu_command_encoder_clear_buffer
(
aBuffer
.
mId
aOffset
size
ToFFI
(
&
bb
)
)
;
mBridge
-
>
SendCommandEncoderAction
(
mId
mParent
-
>
mId
std
:
:
move
(
bb
)
)
;
}
void
CommandEncoder
:
:
PushDebugGroup
(
const
Expand Down
22 changes: 22 additions & 0 deletions dom/webgpu/CommandEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,28 @@ aCopySize
)
;
void
ClearBuffer
(
const
Buffer
&
aBuffer
const
uint64_t
aOffset
const
dom
:
:
Optional
<
uint64_t
>
&
aSize
)
;
void
PushDebugGroup
(
const
Expand Down
15 changes: 15 additions & 0 deletions dom/webidl/WebGPU.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -3929,6 +3929,21 @@ GPUExtent3D
copySize
)
;
undefined
clearBuffer
(
GPUBuffer
buffer
optional
GPUSize64
offset
=
0
optional
GPUSize64
size
)
;
GPUCommandBuffer
finish
(
Expand Down
68 changes: 68 additions & 0 deletions gfx/wgpu_bindings/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7282,6 +7282,74 @@ action
no_mangle
]
pub
unsafe
extern
"
C
"
fn
wgpu_command_encoder_clear_buffer
(
dst
:
wgc
:
:
id
:
:
BufferId
offset
:
u64
size
:
Option
<
&
u64
>
bb
:
&
mut
ByteBuf
)
{
let
action
=
CommandEncoderAction
:
:
ClearBuffer
{
dst
offset
size
:
size
.
cloned
(
)
}
;
*
bb
=
make_byte_buf
(
&
action
)
;
}
#
[
no_mangle
]
pub
extern
"
C
Expand Down

0 comments on commit 89ba098

Please sign in to comment.