MCPcopy Create free account
hub / github.com/DjDeveloperr/deno_desktop / op_webgpu_surface_get_current_texture

Function op_webgpu_surface_get_current_texture

src/surface.rs:133–150  ·  view source on GitHub ↗
(
    state: &mut OpState,
    args: SurfacePreferredFormatArgs,
    _: (),
)

Source from the content-addressed store, hash-verified

131}
132
133pub fn op_webgpu_surface_get_current_texture(
134 state: &mut OpState,
135 args: SurfacePreferredFormatArgs,
136 _: (),
137) -> Result<ResourceId, AnyError> {
138 let surface = state.resource_table.get::<WebGpuSurface>(args.surface_rid)?;
139 let adapter = state.resource_table.get::<WebGpuAdapter>(args.adapter_rid)?;
140 let instance = state.borrow::<Instance>();
141
142 let current_texture = gfx_select!(
143 adapter.0 => instance.surface_get_current_texture(surface.0, std::marker::PhantomData)
144 )?;
145 if let Some(texture) = current_texture.texture_id {
146 Ok(state.resource_table.add(WebGpuTexture(texture)))
147 } else {
148 Err(anyhow!("No texture, status: {:?}", current_texture.status))
149 }
150}
151
152pub fn op_webgpu_surface_present(
153 state: &mut OpState,

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected