mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -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
abe9953829
commit
e4f3ed82ee
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