summaryrefslogtreecommitdiff
path: root/ext/webgpu/shader.rs
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-08-24 13:29:42 +0200
committerGitHub <noreply@github.com>2021-08-24 13:29:42 +0200
commitf4a9db350fbf00a6cb13a2c030b925cfd5218ed2 (patch)
tree3ab5cc4f4db7e4855df04fc792ee1e66e05a5d13 /ext/webgpu/shader.rs
parent50f69a6996ae4dcdfe53f15fc49949d3756c9787 (diff)
chore(ext/webgpu): update wgpu to 0.10.0 (#11781)
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'ext/webgpu/shader.rs')
-rw-r--r--ext/webgpu/shader.rs25
1 files changed, 4 insertions, 21 deletions
diff --git a/ext/webgpu/shader.rs b/ext/webgpu/shader.rs
index bd3b03f55..efb67e8f0 100644
--- a/ext/webgpu/shader.rs
+++ b/ext/webgpu/shader.rs
@@ -1,9 +1,7 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-use deno_core::error::null_opbuf;
use deno_core::error::AnyError;
use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
use deno_core::{OpState, Resource};
use serde::Deserialize;
use std::borrow::Cow;
@@ -22,14 +20,14 @@ impl Resource for WebGpuShaderModule {
pub struct CreateShaderModuleArgs {
device_rid: ResourceId,
label: Option<String>,
- code: Option<String>,
+ code: String,
_source_map: Option<()>, // not yet implemented
}
pub fn op_webgpu_create_shader_module(
state: &mut OpState,
args: CreateShaderModuleArgs,
- zero_copy: Option<ZeroCopyBuf>,
+ _: (),
) -> Result<WebGpuResult, AnyError> {
let instance = state.borrow::<super::Instance>();
let device_resource = state
@@ -37,26 +35,11 @@ pub fn op_webgpu_create_shader_module(
.get::<super::WebGpuDevice>(args.device_rid)?;
let device = device_resource.0;
- let source = match args.code {
- Some(code) => {
- wgpu_core::pipeline::ShaderModuleSource::Wgsl(Cow::from(code))
- }
- None => wgpu_core::pipeline::ShaderModuleSource::SpirV(Cow::from(unsafe {
- match &zero_copy {
- Some(zero_copy) => {
- let (prefix, data, suffix) = zero_copy.align_to::<u32>();
- assert!(prefix.is_empty());
- assert!(suffix.is_empty());
- data
- }
- None => return Err(null_opbuf()),
- }
- })),
- };
+ let source =
+ wgpu_core::pipeline::ShaderModuleSource::Wgsl(Cow::from(args.code));
let descriptor = wgpu_core::pipeline::ShaderModuleDescriptor {
label: args.label.map(Cow::from),
- flags: wgpu_types::ShaderFlags::all(),
};
gfx_put!(device => instance.device_create_shader_module(