summaryrefslogtreecommitdiff
path: root/ext/webgpu/texture.rs
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-03-16 19:29:32 -0400
committerGitHub <noreply@github.com>2023-03-17 00:29:32 +0100
commit35196eab279340376929dd75ed717ef4830e2fa9 (patch)
tree5aefff339ef50d3e89ff36422c90e929dea3897f /ext/webgpu/texture.rs
parent3f031ad9af2d61671f8408632f31592ac4186926 (diff)
BREAKING(unstable): remove WebGPU (#18094)
This PR _**temporarily**_ removes WebGPU (which has behind the `--unstable` flag in Deno), due to performance complications due to its presence. It will be brought back in the future; as a point of reference, Chrome will ship WebGPU to stable on 26/04/2023. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/webgpu/texture.rs')
-rw-r--r--ext/webgpu/texture.rs116
1 files changed, 0 insertions, 116 deletions
diff --git a/ext/webgpu/texture.rs b/ext/webgpu/texture.rs
deleted file mode 100644
index c4b36c288..000000000
--- a/ext/webgpu/texture.rs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::AnyError;
-use deno_core::op;
-use deno_core::OpState;
-use deno_core::Resource;
-use deno_core::ResourceId;
-use serde::Deserialize;
-use std::borrow::Cow;
-
-use super::error::WebGpuResult;
-pub(crate) struct WebGpuTexture(pub(crate) wgpu_core::id::TextureId);
-impl Resource for WebGpuTexture {
- fn name(&self) -> Cow<str> {
- "webGPUTexture".into()
- }
-}
-
-pub(crate) struct WebGpuTextureView(pub(crate) wgpu_core::id::TextureViewId);
-impl Resource for WebGpuTextureView {
- fn name(&self) -> Cow<str> {
- "webGPUTextureView".into()
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateTextureArgs {
- device_rid: ResourceId,
- label: Option<String>,
- size: wgpu_types::Extent3d,
- mip_level_count: u32,
- sample_count: u32,
- dimension: wgpu_types::TextureDimension,
- format: wgpu_types::TextureFormat,
- usage: u32,
- view_formats: Vec<wgpu_types::TextureFormat>,
-}
-
-#[op]
-pub fn op_webgpu_create_texture(
- state: &mut OpState,
- args: CreateTextureArgs,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)?;
- let device = device_resource.0;
-
- let descriptor = wgpu_core::resource::TextureDescriptor {
- label: args.label.map(Cow::from),
- size: args.size,
- mip_level_count: args.mip_level_count,
- sample_count: args.sample_count,
- dimension: args.dimension,
- format: args.format,
- usage: wgpu_types::TextureUsages::from_bits_truncate(args.usage),
- view_formats: args.view_formats,
- };
-
- gfx_put!(device => instance.device_create_texture(
- device,
- &descriptor,
- ()
- ) => state, WebGpuTexture)
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateTextureViewArgs {
- texture_rid: ResourceId,
- label: Option<String>,
- format: Option<wgpu_types::TextureFormat>,
- dimension: Option<wgpu_types::TextureViewDimension>,
- aspect: wgpu_types::TextureAspect,
- base_mip_level: u32,
- mip_level_count: Option<u32>,
- base_array_layer: u32,
- array_layer_count: Option<u32>,
-}
-
-#[op]
-pub fn op_webgpu_create_texture_view(
- state: &mut OpState,
- args: CreateTextureViewArgs,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let texture_resource = state
- .resource_table
- .get::<WebGpuTexture>(args.texture_rid)?;
- let texture = texture_resource.0;
-
- let descriptor = wgpu_core::resource::TextureViewDescriptor {
- label: args.label.map(Cow::from),
- format: args.format,
- dimension: args.dimension,
- range: wgpu_types::ImageSubresourceRange {
- aspect: args.aspect,
- base_mip_level: args.base_mip_level,
- mip_level_count: std::num::NonZeroU32::new(
- args.mip_level_count.unwrap_or(0),
- ),
- base_array_layer: args.base_array_layer,
- array_layer_count: std::num::NonZeroU32::new(
- args.array_layer_count.unwrap_or(0),
- ),
- },
- };
-
- gfx_put!(texture => instance.texture_create_view(
- texture,
- &descriptor,
- ()
- ) => state, WebGpuTextureView)
-}