mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
[deno] add deviceStartCapture and deviceStopCapture
This is achieved by adding a new `Deno.webgpu` namespace which will be used for non-spec functionality, which for now will be marked as unstable (cherry picked from denoland/deno#28192)
This commit is contained in:
parent
48097412fc
commit
190050e296
@ -37,6 +37,8 @@ import {
|
||||
GPUTextureView,
|
||||
GPUExternalTexture,
|
||||
op_create_gpu,
|
||||
op_webgpu_device_start_capture,
|
||||
op_webgpu_device_stop_capture,
|
||||
} from "ext:core/ops";
|
||||
const {
|
||||
ObjectDefineProperty,
|
||||
@ -884,6 +886,19 @@ webidl.converters["GPUUncapturedErrorEventInit"] = webidl
|
||||
dictMembersGPUUncapturedErrorEventInit,
|
||||
);
|
||||
|
||||
function deviceStartCapture(device) {
|
||||
op_webgpu_device_start_capture(device);
|
||||
}
|
||||
|
||||
function deviceStopCapture(device) {
|
||||
op_webgpu_device_stop_capture(device);
|
||||
}
|
||||
|
||||
const denoNsWebGPU = {
|
||||
deviceStartCapture,
|
||||
deviceStopCapture,
|
||||
};
|
||||
|
||||
let gpu;
|
||||
function initGPU() {
|
||||
if (!gpu) {
|
||||
@ -896,6 +911,7 @@ function initGPU() {
|
||||
}
|
||||
|
||||
export {
|
||||
denoNsWebGPU,
|
||||
GPU,
|
||||
gpu,
|
||||
GPUAdapter,
|
||||
|
||||
@ -917,3 +917,21 @@ impl GPUDeviceLostInfo {
|
||||
"device was lost"
|
||||
}
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_webgpu_device_start_capture(#[cppgc] device: &GPUDevice) {
|
||||
unsafe {
|
||||
device
|
||||
.instance
|
||||
.device_start_graphics_debugger_capture(device.id);
|
||||
}
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_webgpu_device_stop_capture(#[cppgc] device: &GPUDevice) {
|
||||
unsafe {
|
||||
device
|
||||
.instance
|
||||
.device_stop_graphics_debugger_capture(device.id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,11 @@ pub type Instance = Arc<wgpu_core::global::Global>;
|
||||
deno_core::extension!(
|
||||
deno_webgpu,
|
||||
deps = [deno_webidl, deno_web],
|
||||
ops = [op_create_gpu],
|
||||
ops = [
|
||||
op_create_gpu,
|
||||
device::op_webgpu_device_start_capture,
|
||||
device::op_webgpu_device_stop_capture,
|
||||
],
|
||||
objects = [
|
||||
GPU,
|
||||
adapter::GPUAdapter,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user