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,
|
GPUTextureView,
|
||||||
GPUExternalTexture,
|
GPUExternalTexture,
|
||||||
op_create_gpu,
|
op_create_gpu,
|
||||||
|
op_webgpu_device_start_capture,
|
||||||
|
op_webgpu_device_stop_capture,
|
||||||
} from "ext:core/ops";
|
} from "ext:core/ops";
|
||||||
const {
|
const {
|
||||||
ObjectDefineProperty,
|
ObjectDefineProperty,
|
||||||
@ -884,6 +886,19 @@ webidl.converters["GPUUncapturedErrorEventInit"] = webidl
|
|||||||
dictMembersGPUUncapturedErrorEventInit,
|
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;
|
let gpu;
|
||||||
function initGPU() {
|
function initGPU() {
|
||||||
if (!gpu) {
|
if (!gpu) {
|
||||||
@ -896,6 +911,7 @@ function initGPU() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
denoNsWebGPU,
|
||||||
GPU,
|
GPU,
|
||||||
gpu,
|
gpu,
|
||||||
GPUAdapter,
|
GPUAdapter,
|
||||||
|
|||||||
@ -917,3 +917,21 @@ impl GPUDeviceLostInfo {
|
|||||||
"device was lost"
|
"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_core::extension!(
|
||||||
deno_webgpu,
|
deno_webgpu,
|
||||||
deps = [deno_webidl, deno_web],
|
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 = [
|
objects = [
|
||||||
GPU,
|
GPU,
|
||||||
adapter::GPUAdapter,
|
adapter::GPUAdapter,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user