1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
denoland-deno/runtime/ops/webgpu.rs

405 lines
11 KiB
Rust

// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_webgpu::*;
pub fn init(rt: &mut deno_core::JsRuntime) {
{
let op_state = rt.op_state();
let mut state = op_state.borrow_mut();
let unstable_checker = state.borrow::<super::UnstableChecker>();
let unstable = unstable_checker.unstable;
state.put(Unstable(unstable));
}
super::reg_async(rt, "op_webgpu_request_adapter", op_webgpu_request_adapter);
super::reg_async(rt, "op_webgpu_request_device", op_webgpu_request_device);
super::reg_sync(rt, "op_webgpu_create_query_set", op_webgpu_create_query_set);
{
// buffer
super::reg_sync(
rt,
"op_webgpu_create_buffer",
buffer::op_webgpu_create_buffer,
);
super::reg_async(
rt,
"op_webgpu_buffer_get_map_async",
buffer::op_webgpu_buffer_get_map_async,
);
super::reg_sync(
rt,
"op_webgpu_buffer_get_mapped_range",
buffer::op_webgpu_buffer_get_mapped_range,
);
super::reg_sync(
rt,
"op_webgpu_buffer_unmap",
buffer::op_webgpu_buffer_unmap,
);
}
{
// texture
super::reg_sync(
rt,
"op_webgpu_create_texture",
texture::op_webgpu_create_texture,
);
super::reg_sync(
rt,
"op_webgpu_create_texture_view",
texture::op_webgpu_create_texture_view,
);
}
{
// sampler
super::reg_sync(
rt,
"op_webgpu_create_sampler",
sampler::op_webgpu_create_sampler,
);
}
{
// binding
super::reg_sync(
rt,
"op_webgpu_create_bind_group_layout",
binding::op_webgpu_create_bind_group_layout,
);
super::reg_sync(
rt,
"op_webgpu_create_pipeline_layout",
binding::op_webgpu_create_pipeline_layout,
);
super::reg_sync(
rt,
"op_webgpu_create_bind_group",
binding::op_webgpu_create_bind_group,
);
}
{
// pipeline
super::reg_sync(
rt,
"op_webgpu_create_compute_pipeline",
pipeline::op_webgpu_create_compute_pipeline,
);
super::reg_sync(
rt,
"op_webgpu_compute_pipeline_get_bind_group_layout",
pipeline::op_webgpu_compute_pipeline_get_bind_group_layout,
);
super::reg_sync(
rt,
"op_webgpu_create_render_pipeline",
pipeline::op_webgpu_create_render_pipeline,
);
super::reg_sync(
rt,
"op_webgpu_render_pipeline_get_bind_group_layout",
pipeline::op_webgpu_render_pipeline_get_bind_group_layout,
);
}
{
// command_encoder
super::reg_sync(
rt,
"op_webgpu_create_command_encoder",
command_encoder::op_webgpu_create_command_encoder,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_begin_render_pass",
command_encoder::op_webgpu_command_encoder_begin_render_pass,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_begin_compute_pass",
command_encoder::op_webgpu_command_encoder_begin_compute_pass,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_copy_buffer_to_buffer",
command_encoder::op_webgpu_command_encoder_copy_buffer_to_buffer,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_copy_buffer_to_texture",
command_encoder::op_webgpu_command_encoder_copy_buffer_to_texture,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_copy_texture_to_buffer",
command_encoder::op_webgpu_command_encoder_copy_texture_to_buffer,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_copy_texture_to_texture",
command_encoder::op_webgpu_command_encoder_copy_texture_to_texture,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_push_debug_group",
command_encoder::op_webgpu_command_encoder_push_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_pop_debug_group",
command_encoder::op_webgpu_command_encoder_pop_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_insert_debug_marker",
command_encoder::op_webgpu_command_encoder_insert_debug_marker,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_write_timestamp",
command_encoder::op_webgpu_command_encoder_write_timestamp,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_resolve_query_set",
command_encoder::op_webgpu_command_encoder_resolve_query_set,
);
super::reg_sync(
rt,
"op_webgpu_command_encoder_finish",
command_encoder::op_webgpu_command_encoder_finish,
);
}
{
// render_pass
super::reg_sync(
rt,
"op_webgpu_render_pass_set_viewport",
render_pass::op_webgpu_render_pass_set_viewport,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_set_scissor_rect",
render_pass::op_webgpu_render_pass_set_scissor_rect,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_set_blend_color",
render_pass::op_webgpu_render_pass_set_blend_color,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_set_stencil_reference",
render_pass::op_webgpu_render_pass_set_stencil_reference,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_begin_pipeline_statistics_query",
render_pass::op_webgpu_render_pass_begin_pipeline_statistics_query,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_end_pipeline_statistics_query",
render_pass::op_webgpu_render_pass_end_pipeline_statistics_query,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_write_timestamp",
render_pass::op_webgpu_render_pass_write_timestamp,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_execute_bundles",
render_pass::op_webgpu_render_pass_execute_bundles,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_end_pass",
render_pass::op_webgpu_render_pass_end_pass,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_set_bind_group",
render_pass::op_webgpu_render_pass_set_bind_group,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_push_debug_group",
render_pass::op_webgpu_render_pass_push_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_pop_debug_group",
render_pass::op_webgpu_render_pass_pop_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_insert_debug_marker",
render_pass::op_webgpu_render_pass_insert_debug_marker,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_set_pipeline",
render_pass::op_webgpu_render_pass_set_pipeline,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_set_index_buffer",
render_pass::op_webgpu_render_pass_set_index_buffer,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_set_vertex_buffer",
render_pass::op_webgpu_render_pass_set_vertex_buffer,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_draw",
render_pass::op_webgpu_render_pass_draw,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_draw_indexed",
render_pass::op_webgpu_render_pass_draw_indexed,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_draw_indirect",
render_pass::op_webgpu_render_pass_draw_indirect,
);
super::reg_sync(
rt,
"op_webgpu_render_pass_draw_indexed_indirect",
render_pass::op_webgpu_render_pass_draw_indexed_indirect,
);
}
{
// compute_pass
super::reg_sync(
rt,
"op_webgpu_compute_pass_set_pipeline",
compute_pass::op_webgpu_compute_pass_set_pipeline,
);
super::reg_sync(
rt,
"op_webgpu_compute_pass_dispatch",
compute_pass::op_webgpu_compute_pass_dispatch,
);
super::reg_sync(
rt,
"op_webgpu_compute_pass_dispatch_indirect",
compute_pass::op_webgpu_compute_pass_dispatch_indirect,
);
super::reg_sync(
rt,
"op_webgpu_compute_pass_end_pass",
compute_pass::op_webgpu_compute_pass_end_pass,
);
super::reg_sync(
rt,
"op_webgpu_compute_pass_set_bind_group",
compute_pass::op_webgpu_compute_pass_set_bind_group,
);
super::reg_sync(
rt,
"op_webgpu_compute_pass_push_debug_group",
compute_pass::op_webgpu_compute_pass_push_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_compute_pass_pop_debug_group",
compute_pass::op_webgpu_compute_pass_pop_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_compute_pass_insert_debug_marker",
compute_pass::op_webgpu_compute_pass_insert_debug_marker,
);
}
{
// bundle
super::reg_sync(
rt,
"op_webgpu_create_render_bundle_encoder",
bundle::op_webgpu_create_render_bundle_encoder,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_finish",
bundle::op_webgpu_render_bundle_encoder_finish,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_set_bind_group",
bundle::op_webgpu_render_bundle_encoder_set_bind_group,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_push_debug_group",
bundle::op_webgpu_render_bundle_encoder_push_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_pop_debug_group",
bundle::op_webgpu_render_bundle_encoder_pop_debug_group,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_insert_debug_marker",
bundle::op_webgpu_render_bundle_encoder_insert_debug_marker,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_set_pipeline",
bundle::op_webgpu_render_bundle_encoder_set_pipeline,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_set_index_buffer",
bundle::op_webgpu_render_bundle_encoder_set_index_buffer,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_set_vertex_buffer",
bundle::op_webgpu_render_bundle_encoder_set_vertex_buffer,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_draw",
bundle::op_webgpu_render_bundle_encoder_draw,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_draw_indexed",
bundle::op_webgpu_render_bundle_encoder_draw_indexed,
);
super::reg_sync(
rt,
"op_webgpu_render_bundle_encoder_draw_indirect",
bundle::op_webgpu_render_bundle_encoder_draw_indirect,
);
}
{
// queue
super::reg_sync(
rt,
"op_webgpu_queue_submit",
queue::op_webgpu_queue_submit,
);
super::reg_sync(
rt,
"op_webgpu_write_buffer",
queue::op_webgpu_write_buffer,
);
super::reg_sync(
rt,
"op_webgpu_write_texture",
queue::op_webgpu_write_texture,
);
}
{
// shader
super::reg_sync(
rt,
"op_webgpu_create_shader_module",
shader::op_webgpu_create_shader_module,
);
}
}