Skip to content

Commit

Permalink
experiment: wgpu sync (#13402)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronO authored Jan 19, 2022
1 parent 1259a3f commit 2ab21da
Show file tree
Hide file tree
Showing 28 changed files with 1,348 additions and 1,917 deletions.
94 changes: 43 additions & 51 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn create_compiler_snapshot(
op_crate_libs.insert("deno.url", deno_url::get_declaration());
op_crate_libs.insert("deno.web", deno_web::get_declaration());
op_crate_libs.insert("deno.fetch", deno_fetch::get_declaration());
op_crate_libs.insert("deno.webgpu", deno_webgpu::get_declaration());
op_crate_libs.insert("deno.webgpu", deno_webgpu_get_declaration());
op_crate_libs.insert("deno.websocket", deno_websocket::get_declaration());
op_crate_libs.insert("deno.webstorage", deno_webstorage::get_declaration());
op_crate_libs.insert("deno.crypto", deno_crypto::get_declaration());
Expand Down Expand Up @@ -322,7 +322,7 @@ fn main() {
);
println!(
"cargo:rustc-env=DENO_WEBGPU_LIB_PATH={}",
deno_webgpu::get_declaration().display()
deno_webgpu_get_declaration().display()
);
println!(
"cargo:rustc-env=DENO_WEBSOCKET_LIB_PATH={}",
Expand Down Expand Up @@ -369,6 +369,11 @@ fn main() {
}
}

fn deno_webgpu_get_declaration() -> PathBuf {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
manifest_dir.join("dts").join("lib.deno_webgpu.d.ts")
}

fn get_js_files(d: &str) -> Vec<PathBuf> {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut js_files = std::fs::read_dir(d)
Expand Down
62 changes: 51 additions & 11 deletions ext/webgpu/lib.deno_webgpu.d.ts → cli/dts/lib.deno_webgpu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@ declare interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
}

declare type GPUFeatureName =
| "depth-clamping"
| "depth-clip-control"
| "depth24unorm-stencil8"
| "depth32float-stencil8"
| "pipeline-statistics-query"
| "texture-compression-bc"
| "texture-compression-etc2"
| "texture-compression-astc"
| "timestamp-query"
| "indirect-first-instance"
// extended from spec
| "mappable-primary-buffers"
| "sampled-texture-binding-array"
Expand All @@ -108,9 +111,6 @@ declare type GPUFeatureName =
| "multi-draw-indirect-count"
| "push-constants"
| "address-mode-clamp-to-border"
| "non-fill-polygon-mode"
| "texture-compression-etc2"
| "texture-compression-astc-ldr"
| "texture-adapter-specific-format-features"
| "shader-float64"
| "vertex-attribute-64bit";
Expand Down Expand Up @@ -314,6 +314,44 @@ declare type GPUTextureFormat =
| "bc6h-rgb-float"
| "bc7-rgba-unorm"
| "bc7-rgba-unorm-srgb"
| "etc2-rgb8unorm"
| "etc2-rgb8unorm-srgb"
| "etc2-rgb8a1unorm"
| "etc2-rgb8a1unorm-srgb"
| "etc2-rgba8unorm"
| "etc2-rgba8unorm-srgb"
| "eac-r11unorm"
| "eac-r11snorm"
| "eac-rg11unorm"
| "eac-rg11snorm"
| "astc-4x4-unorm"
| "astc-4x4-unorm-srgb"
| "astc-5x4-unorm"
| "astc-5x4-unorm-srgb"
| "astc-5x5-unorm"
| "astc-5x5-unorm-srgb"
| "astc-6x5-unorm"
| "astc-6x5-unorm-srgb"
| "astc-6x6-unorm"
| "astc-6x6-unorm-srgb"
| "astc-8x5-unorm"
| "astc-8x5-unorm-srgb"
| "astc-8x6-unorm"
| "astc-8x6-unorm-srgb"
| "astc-8x8-unorm"
| "astc-8x8-unorm-srgb"
| "astc-10x5-unorm"
| "astc-10x5-unorm-srgb"
| "astc-10x6-unorm"
| "astc-10x6-unorm-srgb"
| "astc-10x8-unorm"
| "astc-10x8-unorm-srgb"
| "astc-10x10-unorm"
| "astc-10x10-unorm-srgb"
| "astc-12x10-unorm"
| "astc-12x10-unorm-srgb"
| "astc-12x12-unorm"
| "astc-12x12-unorm-srgb"
| "depth24unorm-stencil8"
| "depth32float-stencil8";

Expand Down Expand Up @@ -519,7 +557,7 @@ declare interface GPUPrimitiveState {
stripIndexFormat?: GPUIndexFormat;
frontFace?: GPUFrontFace;
cullMode?: GPUCullMode;
clampDepth?: boolean;
unclippedDepth?: boolean;
}

declare type GPUFrontFace = "ccw" | "cw";
Expand Down Expand Up @@ -558,9 +596,9 @@ declare class GPUColorWrite {
}

declare interface GPUBlendComponent {
operation: GPUBlendOperation;
srcFactor: GPUBlendFactor;
dstFactor: GPUBlendFactor;
operation: GPUBlendOperation;
}

declare type GPUBlendFactor =
Expand Down Expand Up @@ -673,8 +711,6 @@ declare interface GPUVertexAttribute {

declare class GPUCommandBuffer implements GPUObjectBase {
label: string | null;

readonly executionTime: Promise<number>;
}

declare interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {}
Expand Down Expand Up @@ -713,6 +749,12 @@ declare class GPUCommandEncoder implements GPUObjectBase {
copySize: GPUExtent3D,
): undefined;

clearBuffer(
destination: GPUBuffer,
destinationOffset: number,
size: number,
): undefined;

pushDebugGroup(groupLabel: string): undefined;
popDebugGroup(): undefined;
insertDebugMarker(markerLabel: string): undefined;
Expand All @@ -730,9 +772,7 @@ declare class GPUCommandEncoder implements GPUObjectBase {
finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
}

declare interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {
measureExecutionTime?: boolean;
}
declare interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {}

declare interface GPUImageDataLayout {
offset?: number;
Expand Down
Loading

0 comments on commit 2ab21da

Please sign in to comment.