Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webgl): Add device.resetWebGL() for debugging #2037

Merged
merged 3 commits into from Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/core/src/adapter/device.ts
Expand Up @@ -479,6 +479,11 @@ export abstract class Device {
throw new Error('not implemented');
}

/** @deprecated - will be removed - should use for debugging only */
resetWebGL(): void {
throw new Error('not implemented');
}

timestamp: number = 0;

/** A monotonic counter for tracking buffer and texture updates */
Expand Down
11 changes: 10 additions & 1 deletion modules/webgl/src/adapter/webgl-device.ts
Expand Up @@ -62,7 +62,11 @@ import {WEBGLTransformFeedback} from './resources/webgl-transform-feedback';
import {WEBGLQuerySet} from './resources/webgl-query-set';

import {readPixelsToArray, readPixelsToBuffer} from '../classic/copy-and-blit';
import {setGLParameters, getGLParameters} from '../context/parameters/unified-parameter-api';
import {
setGLParameters,
getGLParameters,
resetGLParameters
} from '../context/parameters/unified-parameter-api';
import {withGLParameters} from '../context/state-tracker/with-parameters';
import {clear} from '../classic/clear';
import {getWebGLExtension} from '../context/helpers/webgl-extensions';
Expand Down Expand Up @@ -412,6 +416,11 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
clear(this, options);
}

override resetWebGL(): void {
log.warn('WebGLDevice.resetWebGL is deprecated, use only for debugging')();
resetGLParameters(this.gl);
donmccurdy marked this conversation as resolved.
Show resolved Hide resolved
}

//
// WebGL-only API (not part of `Device` API)
//
Expand Down