diff --git a/modules/core/src/adapter/device.ts b/modules/core/src/adapter/device.ts index 0aec59313c..6f84f2b594 100644 --- a/modules/core/src/adapter/device.ts +++ b/modules/core/src/adapter/device.ts @@ -20,40 +20,6 @@ import type {CommandEncoder, CommandEncoderProps} from './resources/command-enco import type {VertexArray, VertexArrayProps} from './resources/vertex-array'; import type {TransformFeedback, TransformFeedbackProps} from './resources/transform-feedback'; -/** Device properties */ -export type DeviceProps = { - id?: string; - - type?: 'webgl' | 'webgpu' | 'best-available'; - - // Common parameters - canvas?: HTMLCanvasElement | OffscreenCanvas | string | null; // A canvas element or a canvas string id - container?: HTMLElement | string | null; - width?: number /** width is only used when creating a new canvas */; - height?: number /** height is only used when creating a new canvas */; - - // WebGLContext PARAMETERS - Can only be set on context creation... - // alpha?: boolean; // Default render target has an alpha buffer. - // depth?: boolean; // Default render target has a depth buffer of at least 16 bits. - // stencil?: boolean; // Default render target has a stencil buffer of at least 8 bits. - // antialias?: boolean; // Boolean that indicates whether or not to perform anti-aliasing. - // premultipliedAlpha?: boolean; // Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. - // preserveDrawingBuffer?: boolean; // Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten - // failIfMajorPerformanceCaveat?: boolean; // Do not create if the system performance is low. - - /** Instrument context (at the expense of performance) */ - debug?: boolean; - /** Initialize the SpectorJS WebGL debugger */ - spector?: boolean; - - // Unclear if these are still supported - manageState?: boolean; // Set to false to disable WebGL state management instrumentation - break?: string[]; // TODO: types - - // @deprecated Attach to existing context - gl?: WebGL2RenderingContext | null; -}; - /** * Identifies the GPU vendor and driver. * @note Chrome WebGPU does not provide much information, though more can be enabled with @@ -191,6 +157,40 @@ export class DeviceFeatures { } } +/** Device properties */ +export type DeviceProps = { + id?: string; + + type?: 'webgl' | 'webgpu' | 'best-available'; + + // Common parameters + canvas?: HTMLCanvasElement | OffscreenCanvas | string | null; // A canvas element or a canvas string id + container?: HTMLElement | string | null; + width?: number /** width is only used when creating a new canvas */; + height?: number /** height is only used when creating a new canvas */; + + // WebGLContext PARAMETERS - Can only be set on context creation... + // alpha?: boolean; // Default render target has an alpha buffer. + // depth?: boolean; // Default render target has a depth buffer of at least 16 bits. + // stencil?: boolean; // Default render target has a stencil buffer of at least 8 bits. + // antialias?: boolean; // Boolean that indicates whether or not to perform anti-aliasing. + // premultipliedAlpha?: boolean; // Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. + // preserveDrawingBuffer?: boolean; // Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten + // failIfMajorPerformanceCaveat?: boolean; // Do not create if the system performance is low. + + /** Instrument context (at the expense of performance) */ + debug?: boolean; + /** Initialize the SpectorJS WebGL debugger */ + spector?: boolean; + + // Unclear if these are still supported + manageState?: boolean; // Set to false to disable WebGL state management instrumentation + break?: string[]; // TODO: types + + // @deprecated Attach to existing context + gl?: WebGL2RenderingContext | null; +}; + /** * WebGPU Device/WebGL context abstraction */ @@ -203,7 +203,8 @@ export abstract class Device { manageState: true, width: 800, // width are height are only used by headless gl height: 600, - debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance) + debug: false, // Instrument context (at the expense of performance) + spector: false, // Initialize the SpectorJS WebGL debugger break: [], // alpha: undefined,