Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Aug 26, 2024
1 parent 658c95e commit 59b8ef3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions modules/test-utils/src/deprecated/sync-test-device.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// luma.gl
// SPDX-License
// Copyright (c) vis.gl contributors

import type {CanvasContextProps} from '@luma.gl/core';
import {WebGLDevice} from '@luma.gl/webgl';

const DEFAULT_CANVAS_CONTEXT_PROPS: CanvasContextProps = {
width: 1,
height: 1
};

/**
* Create a test WebGLDevice
* @note This WebGL Device is create synchronously and can be used directly but will not have WebGL debugging initialized
* @deprecated Use getWebGLTestDevice().
*/
export function createTestDevice(): WebGLDevice | null {
try {
// TODO - We do not use luma.createDevice since createTestDevice currently expect WebGL context to be created synchronously
return new WebGLDevice({createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS});
} catch (error) {
// eslint-disable-next-line no-console
console.error(`Failed to created device: ${(error as Error).message}`);
debugger; // eslint-disable-line no-debugger
return null;
}
}

/**
* A pre-created WebGLDevice
* @note This WebGL Device is create synchronously and can be used directly but will not have WebGL debugging initialized
* @deprecated Use getWebGLTestDevice().
*/
export const webglDevice = createTestDevice();

0 comments on commit 59b8ef3

Please sign in to comment.