mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix(ext/webgpu): fix surface creation panic when adapter not initialized (#24201)
Fixes https://github.com/denoland/deno/issues/23433
This commit is contained in:
parent
4525facb02
commit
6f2ad6e1e2
1 changed files with 3 additions and 1 deletions
|
@ -24,7 +24,9 @@ pub fn op_webgpu_surface_create(
|
|||
p1: *const c_void,
|
||||
p2: *const c_void,
|
||||
) -> Result<ResourceId, AnyError> {
|
||||
let instance = state.borrow::<super::Instance>();
|
||||
let instance = state.try_borrow::<super::Instance>().ok_or_else(|| {
|
||||
type_error("Cannot create surface outside of WebGPU context. Did you forget to call `navigator.gpu.requestAdapter()`?")
|
||||
})?;
|
||||
// Security note:
|
||||
//
|
||||
// The `p1` and `p2` parameters are pointers to platform-specific window
|
||||
|
|
Loading…
Reference in a new issue