MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / destroyGPUContext

Function destroyGPUContext

src/core/GPUContext.ts:341–361  ·  view source on GitHub ↗
(context: GPUContextState)

Source from the content-addressed store, hash-verified

339 * @returns A new GPUContextState with reset values
340 */
341export function destroyGPUContext(context: GPUContextState): GPUContextState {
342 if (context.device) {
343 try {
344 context.device.destroy();
345 } catch (error) {
346 console.warn('Error destroying GPU device:', error);
347 }
348 }
349
350 return {
351 adapter: null,
352 device: null,
353 initialized: false,
354 canvas: context.canvas,
355 canvasContext: null,
356 preferredFormat: null,
357 devicePixelRatio: context.devicePixelRatio,
358 alphaMode: context.alphaMode,
359 powerPreference: context.powerPreference,
360 };
361}
362
363/**
364 * Convenience function that creates and initializes a GPU context in one step.

Callers 2

disposeChartMethod · 0.90
destroyMethod · 0.85

Calls 1

destroyMethod · 0.45

Tested by

no test coverage detected