mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
chores: enforce type ResourceId across codebase (#9837)
This commit is contained in:
parent
197305908b
commit
91ca58fb26
23 changed files with 141 additions and 119 deletions
|
@ -12,6 +12,7 @@ use deno_core::Op;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use futures::future::FutureExt;
|
use futures::future::FutureExt;
|
||||||
use futures::future::TryFuture;
|
use futures::future::TryFuture;
|
||||||
|
@ -122,7 +123,7 @@ impl From<tokio::net::TcpStream> for TcpStream {
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
struct Record {
|
struct Record {
|
||||||
promise_id: u32,
|
promise_id: u32,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
result: i32,
|
result: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +163,7 @@ fn create_js_runtime() -> JsRuntime {
|
||||||
|
|
||||||
fn op_listen(
|
fn op_listen(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_rid: u32,
|
_rid: ResourceId,
|
||||||
_bufs: &mut [ZeroCopyBuf],
|
_bufs: &mut [ZeroCopyBuf],
|
||||||
) -> Result<u32, Error> {
|
) -> Result<u32, Error> {
|
||||||
debug!("listen");
|
debug!("listen");
|
||||||
|
@ -176,7 +177,7 @@ fn op_listen(
|
||||||
|
|
||||||
fn op_close(
|
fn op_close(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
_bufs: &mut [ZeroCopyBuf],
|
_bufs: &mut [ZeroCopyBuf],
|
||||||
) -> Result<u32, Error> {
|
) -> Result<u32, Error> {
|
||||||
debug!("close rid={}", rid);
|
debug!("close rid={}", rid);
|
||||||
|
@ -189,7 +190,7 @@ fn op_close(
|
||||||
|
|
||||||
async fn op_accept(
|
async fn op_accept(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
_bufs: BufVec,
|
_bufs: BufVec,
|
||||||
) -> Result<u32, Error> {
|
) -> Result<u32, Error> {
|
||||||
debug!("accept rid={}", rid);
|
debug!("accept rid={}", rid);
|
||||||
|
@ -206,7 +207,7 @@ async fn op_accept(
|
||||||
|
|
||||||
async fn op_read(
|
async fn op_read(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
mut bufs: BufVec,
|
mut bufs: BufVec,
|
||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
assert_eq!(bufs.len(), 1, "Invalid number of arguments");
|
assert_eq!(bufs.len(), 1, "Invalid number of arguments");
|
||||||
|
@ -222,7 +223,7 @@ async fn op_read(
|
||||||
|
|
||||||
async fn op_write(
|
async fn op_write(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
bufs: BufVec,
|
bufs: BufVec,
|
||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
assert_eq!(bufs.len(), 1, "Invalid number of arguments");
|
assert_eq!(bufs.len(), 1, "Invalid number of arguments");
|
||||||
|
|
|
@ -21,6 +21,7 @@ use deno_core::JsRuntime;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
|
|
||||||
use reqwest::header::HeaderMap;
|
use reqwest::header::HeaderMap;
|
||||||
|
@ -210,7 +211,7 @@ where
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FetchSendArgs {
|
pub struct FetchSendArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn op_fetch_send(
|
pub async fn op_fetch_send(
|
||||||
|
@ -278,7 +279,7 @@ pub async fn op_fetch_send(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FetchRequestWriteArgs {
|
pub struct FetchRequestWriteArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn op_fetch_request_write(
|
pub async fn op_fetch_request_write(
|
||||||
|
@ -308,7 +309,7 @@ pub async fn op_fetch_request_write(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FetchResponseReadArgs {
|
pub struct FetchResponseReadArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn op_fetch_response_read(
|
pub async fn op_fetch_response_read(
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -73,7 +74,7 @@ struct GPUBindGroupLayoutEntry {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateBindGroupLayoutArgs {
|
pub struct CreateBindGroupLayoutArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
entries: Vec<GPUBindGroupLayoutEntry>,
|
entries: Vec<GPUBindGroupLayoutEntry>,
|
||||||
}
|
}
|
||||||
|
@ -215,7 +216,7 @@ pub fn op_webgpu_create_bind_group_layout(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreatePipelineLayoutArgs {
|
pub struct CreatePipelineLayoutArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
bind_group_layouts: Vec<u32>,
|
bind_group_layouts: Vec<u32>,
|
||||||
}
|
}
|
||||||
|
@ -277,7 +278,7 @@ struct GPUBindGroupEntry {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateBindGroupArgs {
|
pub struct CreateBindGroupArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
layout: u32,
|
layout: u32,
|
||||||
entries: Vec<GPUBindGroupEntry>,
|
entries: Vec<GPUBindGroupEntry>,
|
||||||
|
|
|
@ -6,6 +6,7 @@ use deno_core::futures::channel::oneshot;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{BufVec, Resource};
|
use deno_core::{BufVec, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -34,7 +35,7 @@ impl Resource for WebGPUBufferMapped {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateBufferArgs {
|
pub struct CreateBufferArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
size: u64,
|
size: u64,
|
||||||
usage: u32,
|
usage: u32,
|
||||||
|
@ -77,8 +78,8 @@ pub fn op_webgpu_create_buffer(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BufferGetMapAsyncArgs {
|
pub struct BufferGetMapAsyncArgs {
|
||||||
buffer_rid: u32,
|
buffer_rid: ResourceId,
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
mode: u32,
|
mode: u32,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
size: u64,
|
size: u64,
|
||||||
|
@ -168,7 +169,7 @@ pub async fn op_webgpu_buffer_get_map_async(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BufferGetMappedRangeArgs {
|
pub struct BufferGetMappedRangeArgs {
|
||||||
buffer_rid: u32,
|
buffer_rid: ResourceId,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
size: u64,
|
size: u64,
|
||||||
}
|
}
|
||||||
|
@ -209,8 +210,8 @@ pub fn op_webgpu_buffer_get_mapped_range(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BufferUnmapArgs {
|
pub struct BufferUnmapArgs {
|
||||||
buffer_rid: u32,
|
buffer_rid: ResourceId,
|
||||||
mapped_rid: u32,
|
mapped_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_buffer_unmap(
|
pub fn op_webgpu_buffer_unmap(
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -33,7 +34,7 @@ impl Resource for WebGPURenderBundle {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateRenderBundleEncoderArgs {
|
pub struct CreateRenderBundleEncoderArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
color_formats: Vec<String>,
|
color_formats: Vec<String>,
|
||||||
depth_stencil_format: Option<String>,
|
depth_stencil_format: Option<String>,
|
||||||
|
@ -92,7 +93,7 @@ pub fn op_webgpu_create_render_bundle_encoder(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderFinishArgs {
|
pub struct RenderBundleEncoderFinishArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +132,7 @@ pub fn op_webgpu_render_bundle_encoder_finish(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderSetBindGroupArgs {
|
pub struct RenderBundleEncoderSetBindGroupArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
index: u32,
|
index: u32,
|
||||||
bind_group: u32,
|
bind_group: u32,
|
||||||
dynamic_offsets_data: Option<Vec<u32>>,
|
dynamic_offsets_data: Option<Vec<u32>>,
|
||||||
|
@ -190,7 +191,7 @@ pub fn op_webgpu_render_bundle_encoder_set_bind_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderPushDebugGroupArgs {
|
pub struct RenderBundleEncoderPushDebugGroupArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
group_label: String,
|
group_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +219,7 @@ pub fn op_webgpu_render_bundle_encoder_push_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderPopDebugGroupArgs {
|
pub struct RenderBundleEncoderPopDebugGroupArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_render_bundle_encoder_pop_debug_group(
|
pub fn op_webgpu_render_bundle_encoder_pop_debug_group(
|
||||||
|
@ -243,7 +244,7 @@ pub fn op_webgpu_render_bundle_encoder_pop_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderInsertDebugMarkerArgs {
|
pub struct RenderBundleEncoderInsertDebugMarkerArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
marker_label: String,
|
marker_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +272,7 @@ pub fn op_webgpu_render_bundle_encoder_insert_debug_marker(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderSetPipelineArgs {
|
pub struct RenderBundleEncoderSetPipelineArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
pipeline: u32,
|
pipeline: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +301,7 @@ pub fn op_webgpu_render_bundle_encoder_set_pipeline(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderSetIndexBufferArgs {
|
pub struct RenderBundleEncoderSetIndexBufferArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
buffer: u32,
|
buffer: u32,
|
||||||
index_format: String,
|
index_format: String,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
|
@ -337,7 +338,7 @@ pub fn op_webgpu_render_bundle_encoder_set_index_buffer(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderSetVertexBufferArgs {
|
pub struct RenderBundleEncoderSetVertexBufferArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
slot: u32,
|
slot: u32,
|
||||||
buffer: u32,
|
buffer: u32,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
|
@ -372,7 +373,7 @@ pub fn op_webgpu_render_bundle_encoder_set_vertex_buffer(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderDrawArgs {
|
pub struct RenderBundleEncoderDrawArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
vertex_count: u32,
|
vertex_count: u32,
|
||||||
instance_count: u32,
|
instance_count: u32,
|
||||||
first_vertex: u32,
|
first_vertex: u32,
|
||||||
|
@ -403,7 +404,7 @@ pub fn op_webgpu_render_bundle_encoder_draw(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderDrawIndexedArgs {
|
pub struct RenderBundleEncoderDrawIndexedArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
index_count: u32,
|
index_count: u32,
|
||||||
instance_count: u32,
|
instance_count: u32,
|
||||||
first_index: u32,
|
first_index: u32,
|
||||||
|
@ -436,7 +437,7 @@ pub fn op_webgpu_render_bundle_encoder_draw_indexed(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderBundleEncoderDrawIndirectArgs {
|
pub struct RenderBundleEncoderDrawIndirectArgs {
|
||||||
render_bundle_encoder_rid: u32,
|
render_bundle_encoder_rid: ResourceId,
|
||||||
indirect_buffer: u32,
|
indirect_buffer: u32,
|
||||||
indirect_offset: u64,
|
indirect_offset: u64,
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -41,7 +42,7 @@ fn serialize_store_op(store_op: String) -> wgpu_core::command::StoreOp {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateCommandEncoderArgs {
|
pub struct CreateCommandEncoderArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
_measure_execution_time: Option<bool>, // not yet implemented
|
_measure_execution_time: Option<bool>, // not yet implemented
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ struct GPURenderPassDepthStencilAttachment {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderBeginRenderPassArgs {
|
pub struct CommandEncoderBeginRenderPassArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
color_attachments: Vec<GPURenderPassColorAttachment>,
|
color_attachments: Vec<GPURenderPassColorAttachment>,
|
||||||
depth_stencil_attachment: Option<GPURenderPassDepthStencilAttachment>,
|
depth_stencil_attachment: Option<GPURenderPassDepthStencilAttachment>,
|
||||||
|
@ -243,7 +244,7 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderBeginComputePassArgs {
|
pub struct CommandEncoderBeginComputePassArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +281,7 @@ pub fn op_webgpu_command_encoder_begin_compute_pass(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderCopyBufferToBufferArgs {
|
pub struct CommandEncoderCopyBufferToBufferArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
source: u32,
|
source: u32,
|
||||||
source_offset: u64,
|
source_offset: u64,
|
||||||
destination: u32,
|
destination: u32,
|
||||||
|
@ -351,7 +352,7 @@ pub struct GPUImageCopyTexture {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderCopyBufferToTextureArgs {
|
pub struct CommandEncoderCopyBufferToTextureArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
source: GPUImageCopyBuffer,
|
source: GPUImageCopyBuffer,
|
||||||
destination: GPUImageCopyTexture,
|
destination: GPUImageCopyTexture,
|
||||||
copy_size: super::texture::GPUExtent3D,
|
copy_size: super::texture::GPUExtent3D,
|
||||||
|
@ -414,7 +415,7 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderCopyTextureToBufferArgs {
|
pub struct CommandEncoderCopyTextureToBufferArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
source: GPUImageCopyTexture,
|
source: GPUImageCopyTexture,
|
||||||
destination: GPUImageCopyBuffer,
|
destination: GPUImageCopyBuffer,
|
||||||
copy_size: super::texture::GPUExtent3D,
|
copy_size: super::texture::GPUExtent3D,
|
||||||
|
@ -476,7 +477,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderCopyTextureToTextureArgs {
|
pub struct CommandEncoderCopyTextureToTextureArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
source: GPUImageCopyTexture,
|
source: GPUImageCopyTexture,
|
||||||
destination: GPUImageCopyTexture,
|
destination: GPUImageCopyTexture,
|
||||||
copy_size: super::texture::GPUExtent3D,
|
copy_size: super::texture::GPUExtent3D,
|
||||||
|
@ -542,7 +543,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderPushDebugGroupArgs {
|
pub struct CommandEncoderPushDebugGroupArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
group_label: String,
|
group_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +569,7 @@ pub fn op_webgpu_command_encoder_push_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderPopDebugGroupArgs {
|
pub struct CommandEncoderPopDebugGroupArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_command_encoder_pop_debug_group(
|
pub fn op_webgpu_command_encoder_pop_debug_group(
|
||||||
|
@ -591,7 +592,7 @@ pub fn op_webgpu_command_encoder_pop_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderInsertDebugMarkerArgs {
|
pub struct CommandEncoderInsertDebugMarkerArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
marker_label: String,
|
marker_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +619,7 @@ pub fn op_webgpu_command_encoder_insert_debug_marker(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderWriteTimestampArgs {
|
pub struct CommandEncoderWriteTimestampArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
query_set: u32,
|
query_set: u32,
|
||||||
query_index: u32,
|
query_index: u32,
|
||||||
}
|
}
|
||||||
|
@ -653,7 +654,7 @@ pub fn op_webgpu_command_encoder_write_timestamp(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderResolveQuerySetArgs {
|
pub struct CommandEncoderResolveQuerySetArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
query_set: u32,
|
query_set: u32,
|
||||||
first_query: u32,
|
first_query: u32,
|
||||||
query_count: u32,
|
query_count: u32,
|
||||||
|
@ -698,7 +699,7 @@ pub fn op_webgpu_command_encoder_resolve_query_set(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CommandEncoderFinishArgs {
|
pub struct CommandEncoderFinishArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -24,7 +25,7 @@ impl Resource for WebGPUComputePass {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassSetPipelineArgs {
|
pub struct ComputePassSetPipelineArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
pipeline: u32,
|
pipeline: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ pub fn op_webgpu_compute_pass_set_pipeline(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassDispatchArgs {
|
pub struct ComputePassDispatchArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
x: u32,
|
x: u32,
|
||||||
y: u32,
|
y: u32,
|
||||||
z: u32,
|
z: u32,
|
||||||
|
@ -82,7 +83,7 @@ pub fn op_webgpu_compute_pass_dispatch(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassDispatchIndirectArgs {
|
pub struct ComputePassDispatchIndirectArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
indirect_buffer: u32,
|
indirect_buffer: u32,
|
||||||
indirect_offset: u64,
|
indirect_offset: u64,
|
||||||
}
|
}
|
||||||
|
@ -113,7 +114,7 @@ pub fn op_webgpu_compute_pass_dispatch_indirect(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassBeginPipelineStatisticsQueryArgs {
|
pub struct ComputePassBeginPipelineStatisticsQueryArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
query_set: u32,
|
query_set: u32,
|
||||||
query_index: u32,
|
query_index: u32,
|
||||||
}
|
}
|
||||||
|
@ -146,7 +147,7 @@ pub fn op_webgpu_compute_pass_begin_pipeline_statistics_query(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassEndPipelineStatisticsQueryArgs {
|
pub struct ComputePassEndPipelineStatisticsQueryArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_compute_pass_end_pipeline_statistics_query(
|
pub fn op_webgpu_compute_pass_end_pipeline_statistics_query(
|
||||||
|
@ -171,7 +172,7 @@ pub fn op_webgpu_compute_pass_end_pipeline_statistics_query(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassWriteTimestampArgs {
|
pub struct ComputePassWriteTimestampArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
query_set: u32,
|
query_set: u32,
|
||||||
query_index: u32,
|
query_index: u32,
|
||||||
}
|
}
|
||||||
|
@ -204,8 +205,8 @@ pub fn op_webgpu_compute_pass_write_timestamp(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassEndPassArgs {
|
pub struct ComputePassEndPassArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_compute_pass_end_pass(
|
pub fn op_webgpu_compute_pass_end_pass(
|
||||||
|
@ -240,7 +241,7 @@ pub fn op_webgpu_compute_pass_end_pass(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassSetBindGroupArgs {
|
pub struct ComputePassSetBindGroupArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
index: u32,
|
index: u32,
|
||||||
bind_group: u32,
|
bind_group: u32,
|
||||||
dynamic_offsets_data: Option<Vec<u32>>,
|
dynamic_offsets_data: Option<Vec<u32>>,
|
||||||
|
@ -286,7 +287,7 @@ pub fn op_webgpu_compute_pass_set_bind_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassPushDebugGroupArgs {
|
pub struct ComputePassPushDebugGroupArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
group_label: String,
|
group_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +316,7 @@ pub fn op_webgpu_compute_pass_push_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassPopDebugGroupArgs {
|
pub struct ComputePassPopDebugGroupArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_compute_pass_pop_debug_group(
|
pub fn op_webgpu_compute_pass_pop_debug_group(
|
||||||
|
@ -338,7 +339,7 @@ pub fn op_webgpu_compute_pass_pop_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePassInsertDebugMarkerArgs {
|
pub struct ComputePassInsertDebugMarkerArgs {
|
||||||
compute_pass_rid: u32,
|
compute_pass_rid: ResourceId,
|
||||||
marker_label: String,
|
marker_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ use deno_core::error::{bad_resource_id, not_supported};
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{BufVec, Resource};
|
use deno_core::{BufVec, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -280,7 +281,7 @@ struct GPULimits {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RequestDeviceArgs {
|
pub struct RequestDeviceArgs {
|
||||||
adapter_rid: u32,
|
adapter_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
non_guaranteed_features: Option<Vec<String>>,
|
non_guaranteed_features: Option<Vec<String>>,
|
||||||
non_guaranteed_limits: Option<GPULimits>,
|
non_guaranteed_limits: Option<GPULimits>,
|
||||||
|
@ -451,7 +452,7 @@ pub async fn op_webgpu_request_device(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateQuerySetArgs {
|
pub struct CreateQuerySetArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
_label: Option<String>, // not yet implemented
|
_label: Option<String>, // not yet implemented
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
kind: String,
|
kind: String,
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -152,7 +153,7 @@ struct GPUProgrammableStage {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateComputePipelineArgs {
|
pub struct CreateComputePipelineArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
layout: Option<u32>,
|
layout: Option<u32>,
|
||||||
compute: GPUProgrammableStage,
|
compute: GPUProgrammableStage,
|
||||||
|
@ -221,7 +222,7 @@ pub fn op_webgpu_create_compute_pipeline(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ComputePipelineGetBindGroupLayoutArgs {
|
pub struct ComputePipelineGetBindGroupLayoutArgs {
|
||||||
compute_pipeline_rid: u32,
|
compute_pipeline_rid: ResourceId,
|
||||||
index: u32,
|
index: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +353,7 @@ struct GPUFragmentState {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateRenderPipelineArgs {
|
pub struct CreateRenderPipelineArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
layout: Option<u32>,
|
layout: Option<u32>,
|
||||||
vertex: GPUVertexState,
|
vertex: GPUVertexState,
|
||||||
|
@ -611,7 +612,7 @@ pub fn op_webgpu_create_render_pipeline(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPipelineGetBindGroupLayoutArgs {
|
pub struct RenderPipelineGetBindGroupLayoutArgs {
|
||||||
render_pipeline_rid: u32,
|
render_pipeline_rid: ResourceId,
|
||||||
index: u32,
|
index: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ type WebGPUQueue = super::WebGPUDevice;
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct QueueSubmitArgs {
|
pub struct QueueSubmitArgs {
|
||||||
queue_rid: u32,
|
queue_rid: ResourceId,
|
||||||
command_buffers: Vec<u32>,
|
command_buffers: Vec<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ struct GPUImageDataLayout {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct QueueWriteBufferArgs {
|
pub struct QueueWriteBufferArgs {
|
||||||
queue_rid: u32,
|
queue_rid: ResourceId,
|
||||||
buffer: u32,
|
buffer: u32,
|
||||||
buffer_offset: u64,
|
buffer_offset: u64,
|
||||||
data_offset: usize,
|
data_offset: usize,
|
||||||
|
@ -100,7 +101,7 @@ pub fn op_webgpu_write_buffer(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct QueueWriteTextureArgs {
|
pub struct QueueWriteTextureArgs {
|
||||||
queue_rid: u32,
|
queue_rid: ResourceId,
|
||||||
destination: super::command_encoder::GPUImageCopyTexture,
|
destination: super::command_encoder::GPUImageCopyTexture,
|
||||||
data_layout: GPUImageDataLayout,
|
data_layout: GPUImageDataLayout,
|
||||||
size: super::texture::GPUExtent3D,
|
size: super::texture::GPUExtent3D,
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -24,7 +25,7 @@ impl Resource for WebGPURenderPass {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetViewportArgs {
|
pub struct RenderPassSetViewportArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
x: f32,
|
x: f32,
|
||||||
y: f32,
|
y: f32,
|
||||||
width: f32,
|
width: f32,
|
||||||
|
@ -59,7 +60,7 @@ pub fn op_webgpu_render_pass_set_viewport(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetScissorRectArgs {
|
pub struct RenderPassSetScissorRectArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
x: u32,
|
x: u32,
|
||||||
y: u32,
|
y: u32,
|
||||||
width: u32,
|
width: u32,
|
||||||
|
@ -99,7 +100,7 @@ pub struct GPUColor {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetBlendColorArgs {
|
pub struct RenderPassSetBlendColorArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
color: GPUColor,
|
color: GPUColor,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +130,7 @@ pub fn op_webgpu_render_pass_set_blend_color(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetStencilReferenceArgs {
|
pub struct RenderPassSetStencilReferenceArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
reference: u32,
|
reference: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ pub fn op_webgpu_render_pass_set_stencil_reference(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassBeginPipelineStatisticsQueryArgs {
|
pub struct RenderPassBeginPipelineStatisticsQueryArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
query_set: u32,
|
query_set: u32,
|
||||||
query_index: u32,
|
query_index: u32,
|
||||||
}
|
}
|
||||||
|
@ -187,7 +188,7 @@ pub fn op_webgpu_render_pass_begin_pipeline_statistics_query(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassEndPipelineStatisticsQueryArgs {
|
pub struct RenderPassEndPipelineStatisticsQueryArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_render_pass_end_pipeline_statistics_query(
|
pub fn op_webgpu_render_pass_end_pipeline_statistics_query(
|
||||||
|
@ -212,7 +213,7 @@ pub fn op_webgpu_render_pass_end_pipeline_statistics_query(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassWriteTimestampArgs {
|
pub struct RenderPassWriteTimestampArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
query_set: u32,
|
query_set: u32,
|
||||||
query_index: u32,
|
query_index: u32,
|
||||||
}
|
}
|
||||||
|
@ -245,7 +246,7 @@ pub fn op_webgpu_render_pass_write_timestamp(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassExecuteBundlesArgs {
|
pub struct RenderPassExecuteBundlesArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
bundles: Vec<u32>,
|
bundles: Vec<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,8 +284,8 @@ pub fn op_webgpu_render_pass_execute_bundles(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassEndPassArgs {
|
pub struct RenderPassEndPassArgs {
|
||||||
command_encoder_rid: u32,
|
command_encoder_rid: ResourceId,
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_render_pass_end_pass(
|
pub fn op_webgpu_render_pass_end_pass(
|
||||||
|
@ -314,7 +315,7 @@ pub fn op_webgpu_render_pass_end_pass(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetBindGroupArgs {
|
pub struct RenderPassSetBindGroupArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
index: u32,
|
index: u32,
|
||||||
bind_group: u32,
|
bind_group: u32,
|
||||||
dynamic_offsets_data: Option<Vec<u32>>,
|
dynamic_offsets_data: Option<Vec<u32>>,
|
||||||
|
@ -373,7 +374,7 @@ pub fn op_webgpu_render_pass_set_bind_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassPushDebugGroupArgs {
|
pub struct RenderPassPushDebugGroupArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
group_label: String,
|
group_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +403,7 @@ pub fn op_webgpu_render_pass_push_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassPopDebugGroupArgs {
|
pub struct RenderPassPopDebugGroupArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_webgpu_render_pass_pop_debug_group(
|
pub fn op_webgpu_render_pass_pop_debug_group(
|
||||||
|
@ -425,7 +426,7 @@ pub fn op_webgpu_render_pass_pop_debug_group(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassInsertDebugMarkerArgs {
|
pub struct RenderPassInsertDebugMarkerArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
marker_label: String,
|
marker_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +455,7 @@ pub fn op_webgpu_render_pass_insert_debug_marker(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetPipelineArgs {
|
pub struct RenderPassSetPipelineArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
pipeline: u32,
|
pipeline: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +484,7 @@ pub fn op_webgpu_render_pass_set_pipeline(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetIndexBufferArgs {
|
pub struct RenderPassSetIndexBufferArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
buffer: u32,
|
buffer: u32,
|
||||||
index_format: String,
|
index_format: String,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
|
@ -517,7 +518,7 @@ pub fn op_webgpu_render_pass_set_index_buffer(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassSetVertexBufferArgs {
|
pub struct RenderPassSetVertexBufferArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
slot: u32,
|
slot: u32,
|
||||||
buffer: u32,
|
buffer: u32,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
|
@ -552,7 +553,7 @@ pub fn op_webgpu_render_pass_set_vertex_buffer(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassDrawArgs {
|
pub struct RenderPassDrawArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
vertex_count: u32,
|
vertex_count: u32,
|
||||||
instance_count: u32,
|
instance_count: u32,
|
||||||
first_vertex: u32,
|
first_vertex: u32,
|
||||||
|
@ -583,7 +584,7 @@ pub fn op_webgpu_render_pass_draw(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassDrawIndexedArgs {
|
pub struct RenderPassDrawIndexedArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
index_count: u32,
|
index_count: u32,
|
||||||
instance_count: u32,
|
instance_count: u32,
|
||||||
first_index: u32,
|
first_index: u32,
|
||||||
|
@ -616,7 +617,7 @@ pub fn op_webgpu_render_pass_draw_indexed(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassDrawIndirectArgs {
|
pub struct RenderPassDrawIndirectArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
indirect_buffer: u32,
|
indirect_buffer: u32,
|
||||||
indirect_offset: u64,
|
indirect_offset: u64,
|
||||||
}
|
}
|
||||||
|
@ -647,7 +648,7 @@ pub fn op_webgpu_render_pass_draw_indirect(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RenderPassDrawIndexedIndirectArgs {
|
pub struct RenderPassDrawIndexedIndirectArgs {
|
||||||
render_pass_rid: u32,
|
render_pass_rid: ResourceId,
|
||||||
indirect_buffer: u32,
|
indirect_buffer: u32,
|
||||||
indirect_offset: u64,
|
indirect_offset: u64,
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -64,7 +65,7 @@ pub fn serialize_compare_function(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateSamplerArgs {
|
pub struct CreateSamplerArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
address_mode_u: Option<String>,
|
address_mode_u: Option<String>,
|
||||||
address_mode_v: Option<String>,
|
address_mode_v: Option<String>,
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -21,7 +22,7 @@ impl Resource for WebGPUShaderModule {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateShaderModuleArgs {
|
pub struct CreateShaderModuleArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
code: Option<String>,
|
code: Option<String>,
|
||||||
_source_map: Option<()>, // not yet implemented
|
_source_map: Option<()>, // not yet implemented
|
||||||
|
|
|
@ -4,6 +4,7 @@ use deno_core::error::AnyError;
|
||||||
use deno_core::error::{bad_resource_id, not_supported};
|
use deno_core::error::{bad_resource_id, not_supported};
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -133,7 +134,7 @@ pub struct GPUExtent3D {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateTextureArgs {
|
pub struct CreateTextureArgs {
|
||||||
device_rid: u32,
|
device_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
size: GPUExtent3D,
|
size: GPUExtent3D,
|
||||||
mip_level_count: Option<u32>,
|
mip_level_count: Option<u32>,
|
||||||
|
@ -194,7 +195,7 @@ pub fn op_webgpu_create_texture(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateTextureViewArgs {
|
pub struct CreateTextureViewArgs {
|
||||||
texture_rid: u32,
|
texture_rid: ResourceId,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
format: Option<String>,
|
format: Option<String>,
|
||||||
dimension: Option<String>,
|
dimension: Option<String>,
|
||||||
|
|
|
@ -18,6 +18,7 @@ use deno_core::JsRuntime;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
|
|
||||||
use http::{Method, Request, Uri};
|
use http::{Method, Request, Uri};
|
||||||
|
@ -214,7 +215,7 @@ where
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SendArgs {
|
pub struct SendArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
kind: String,
|
kind: String,
|
||||||
text: Option<String>,
|
text: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -245,7 +246,7 @@ pub async fn op_ws_send(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CloseArgs {
|
pub struct CloseArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
code: Option<u16>,
|
code: Option<u16>,
|
||||||
reason: Option<String>,
|
reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -277,7 +278,7 @@ pub async fn op_ws_close(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct NextEventArgs {
|
pub struct NextEventArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn op_ws_next_event(
|
pub async fn op_ws_next_event(
|
||||||
|
|
|
@ -13,6 +13,7 @@ use deno_core::serde_json::Value;
|
||||||
use deno_core::BufVec;
|
use deno_core::BufVec;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_crypto::rand::thread_rng;
|
use deno_crypto::rand::thread_rng;
|
||||||
use deno_crypto::rand::Rng;
|
use deno_crypto::rand::Rng;
|
||||||
|
@ -208,7 +209,7 @@ async fn op_open_async(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SeekArgs {
|
pub struct SeekArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
offset: i64,
|
offset: i64,
|
||||||
whence: i32,
|
whence: i32,
|
||||||
}
|
}
|
||||||
|
@ -273,7 +274,7 @@ async fn op_seek_async(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FdatasyncArgs {
|
pub struct FdatasyncArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_fdatasync_sync(
|
fn op_fdatasync_sync(
|
||||||
|
@ -317,7 +318,7 @@ async fn op_fdatasync_async(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FsyncArgs {
|
pub struct FsyncArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_fsync_sync(
|
fn op_fsync_sync(
|
||||||
|
@ -361,7 +362,7 @@ async fn op_fsync_async(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FstatArgs {
|
pub struct FstatArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_fstat_sync(
|
fn op_fstat_sync(
|
||||||
|
@ -1313,7 +1314,7 @@ async fn op_read_link_async(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FtruncateArgs {
|
pub struct FtruncateArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
len: i32,
|
len: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1585,7 +1586,7 @@ async fn op_make_temp_file_async(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FutimeArgs {
|
pub struct FutimeArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
atime: (i64, u32),
|
atime: (i64, u32),
|
||||||
mtime: (i64, u32),
|
mtime: (i64, u32),
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,9 @@ use deno_core::CancelHandle;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
|
|
||||||
use notify::event::Event as NotifyEvent;
|
use notify::event::Event as NotifyEvent;
|
||||||
use notify::Error as NotifyError;
|
use notify::Error as NotifyError;
|
||||||
use notify::EventKind;
|
use notify::EventKind;
|
||||||
|
@ -126,7 +128,7 @@ fn op_fs_events_open(
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct PollArgs {
|
pub struct PollArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn op_fs_events_poll(
|
async fn op_fs_events_poll(
|
||||||
|
|
|
@ -14,6 +14,7 @@ use deno_core::JsRuntime;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -459,7 +460,7 @@ impl StdFileResource {
|
||||||
|
|
||||||
pub fn with<F, R>(
|
pub fn with<F, R>(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
mut f: F,
|
mut f: F,
|
||||||
) -> Result<R, AnyError>
|
) -> Result<R, AnyError>
|
||||||
where
|
where
|
||||||
|
@ -521,7 +522,7 @@ impl Resource for StdFileResource {
|
||||||
|
|
||||||
fn op_read_sync(
|
fn op_read_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
bufs: &mut [ZeroCopyBuf],
|
bufs: &mut [ZeroCopyBuf],
|
||||||
) -> Result<u32, AnyError> {
|
) -> Result<u32, AnyError> {
|
||||||
StdFileResource::with(state, rid, move |r| match r {
|
StdFileResource::with(state, rid, move |r| match r {
|
||||||
|
@ -535,7 +536,7 @@ fn op_read_sync(
|
||||||
|
|
||||||
async fn op_read_async(
|
async fn op_read_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
mut bufs: BufVec,
|
mut bufs: BufVec,
|
||||||
) -> Result<u32, AnyError> {
|
) -> Result<u32, AnyError> {
|
||||||
let buf = &mut bufs[0];
|
let buf = &mut bufs[0];
|
||||||
|
@ -566,7 +567,7 @@ async fn op_read_async(
|
||||||
|
|
||||||
fn op_write_sync(
|
fn op_write_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
bufs: &mut [ZeroCopyBuf],
|
bufs: &mut [ZeroCopyBuf],
|
||||||
) -> Result<u32, AnyError> {
|
) -> Result<u32, AnyError> {
|
||||||
StdFileResource::with(state, rid, move |r| match r {
|
StdFileResource::with(state, rid, move |r| match r {
|
||||||
|
@ -580,7 +581,7 @@ fn op_write_sync(
|
||||||
|
|
||||||
async fn op_write_async(
|
async fn op_write_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
bufs: BufVec,
|
bufs: BufVec,
|
||||||
) -> Result<u32, AnyError> {
|
) -> Result<u32, AnyError> {
|
||||||
let buf = &bufs[0];
|
let buf = &bufs[0];
|
||||||
|
@ -609,7 +610,7 @@ async fn op_write_async(
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct ShutdownArgs {
|
struct ShutdownArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn op_shutdown(
|
async fn op_shutdown(
|
||||||
|
|
|
@ -19,6 +19,7 @@ use deno_core::CancelTryFuture;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
@ -55,7 +56,7 @@ pub fn init(rt: &mut deno_core::JsRuntime) {
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub(crate) struct AcceptArgs {
|
pub(crate) struct AcceptArgs {
|
||||||
pub rid: u32,
|
pub rid: ResourceId,
|
||||||
pub transport: String,
|
pub transport: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ async fn op_accept(
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub(crate) struct ReceiveArgs {
|
pub(crate) struct ReceiveArgs {
|
||||||
pub rid: u32,
|
pub rid: ResourceId,
|
||||||
pub transport: String,
|
pub transport: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +182,7 @@ async fn op_datagram_receive(
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct SendArgs {
|
struct SendArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
transport: String,
|
transport: String,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
transport_args: ArgsEnum,
|
transport_args: ArgsEnum,
|
||||||
|
|
|
@ -16,6 +16,7 @@ use deno_core::BufVec;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -34,7 +35,7 @@ pub fn init(rt: &mut deno_core::JsRuntime) {
|
||||||
|
|
||||||
fn clone_file(
|
fn clone_file(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
) -> Result<std::fs::File, AnyError> {
|
) -> Result<std::fs::File, AnyError> {
|
||||||
StdFileResource::with(state, rid, move |r| match r {
|
StdFileResource::with(state, rid, move |r| match r {
|
||||||
Ok(std_file) => std_file.try_clone().map_err(AnyError::from),
|
Ok(std_file) => std_file.try_clone().map_err(AnyError::from),
|
||||||
|
@ -60,9 +61,9 @@ pub struct RunArgs {
|
||||||
stdin: String,
|
stdin: String,
|
||||||
stdout: String,
|
stdout: String,
|
||||||
stderr: String,
|
stderr: String,
|
||||||
stdin_rid: u32,
|
stdin_rid: ResourceId,
|
||||||
stdout_rid: u32,
|
stdout_rid: ResourceId,
|
||||||
stderr_rid: u32,
|
stderr_rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ChildResource {
|
struct ChildResource {
|
||||||
|
@ -178,7 +179,7 @@ fn op_run(
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RunStatusArgs {
|
pub struct RunStatusArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn op_run_status(
|
async fn op_run_status(
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::BufVec;
|
use deno_core::BufVec;
|
||||||
|
|
|
@ -20,6 +20,7 @@ use deno_core::CancelTryFuture;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -88,7 +89,7 @@ pub struct ConnectTLSArgs {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct StartTLSArgs {
|
struct StartTLSArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
cert_file: Option<String>,
|
cert_file: Option<String>,
|
||||||
hostname: String,
|
hostname: String,
|
||||||
}
|
}
|
||||||
|
@ -350,7 +351,7 @@ fn op_listen_tls(
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct AcceptTlsArgs {
|
pub struct AcceptTlsArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn op_accept_tls(
|
async fn op_accept_tls(
|
||||||
|
|
|
@ -9,6 +9,7 @@ use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
@ -58,7 +59,7 @@ pub struct SetRawOptions {
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SetRawArgs {
|
pub struct SetRawArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
mode: bool,
|
mode: bool,
|
||||||
options: SetRawOptions,
|
options: SetRawOptions,
|
||||||
}
|
}
|
||||||
|
@ -215,7 +216,7 @@ fn op_set_raw(
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct IsattyArgs {
|
pub struct IsattyArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_isatty(
|
fn op_isatty(
|
||||||
|
@ -250,7 +251,7 @@ fn op_isatty(
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct ConsoleSizeArgs {
|
pub struct ConsoleSizeArgs {
|
||||||
rid: u32,
|
rid: ResourceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|
Loading…
Reference in a new issue