diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2024-08-07 18:17:33 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-07 02:17:33 -0700 |
commit | fade3136ba430eebd029f5f5856e5156a33f926c (patch) | |
tree | 247cc5084b8b33ef52ebfc3816d0f70062de09b8 /ext/webgpu/lib.rs | |
parent | fe64cbd88ba0a2d9d6e3becb387b2bf6bc3afde8 (diff) |
fix(webgpu): Fix `GPUAdapter#isFallbackAdapter` and `GPUAdapter#info` properties (#24914)
Fixed `GPUAdapter` bugs:
* `GPUAdapter#isFallbackAdapter` being `undefined`
* `GPUAdapter#info` throwing `TypeError`
* introduced by #24783
* `GPUAdapter#info` closing adapter resources
* introduced by #23752
Diffstat (limited to 'ext/webgpu/lib.rs')
-rw-r--r-- | ext/webgpu/lib.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ext/webgpu/lib.rs b/ext/webgpu/lib.rs index 8a423fd00..df01c5ff9 100644 --- a/ext/webgpu/lib.rs +++ b/ext/webgpu/lib.rs @@ -382,7 +382,7 @@ pub struct GpuAdapterRes { rid: ResourceId, limits: wgpu_types::Limits, features: Vec<&'static str>, - is_software: bool, + is_fallback: bool, } #[derive(Serialize)] @@ -392,7 +392,6 @@ pub struct GpuDeviceRes { queue_rid: ResourceId, limits: wgpu_types::Limits, features: Vec<&'static str>, - is_software: bool, } #[op2] @@ -462,7 +461,8 @@ pub fn op_webgpu_request_adapter( rid, features, limits: adapter_limits, - is_software: false, + // TODO(lucacasonato): report correctly from wgpu + is_fallback: false, })) } @@ -712,8 +712,6 @@ pub fn op_webgpu_request_device( queue_rid, features, limits, - // TODO(lucacasonato): report correctly from wgpu - is_software: false, }) } @@ -732,14 +730,13 @@ pub fn op_webgpu_request_adapter_info( state: Rc<RefCell<OpState>>, #[smi] adapter_rid: ResourceId, ) -> Result<GPUAdapterInfo, AnyError> { - let mut state = state.borrow_mut(); + let state = state.borrow_mut(); let adapter_resource = - state.resource_table.take::<WebGpuAdapter>(adapter_rid)?; + state.resource_table.get::<WebGpuAdapter>(adapter_rid)?; let adapter = adapter_resource.1; let instance = state.borrow::<Instance>(); let info = gfx_select!(adapter => instance.adapter_get_info(adapter))?; - adapter_resource.close(); Ok(GPUAdapterInfo { vendor: info.vendor.to_string(), |