Skip to content

Commit

Permalink
feat(webgl): Add device.resetWebGL() for debugging (#2037)
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Mar 18, 2024
1 parent 86887c5 commit a0df5df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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);
}

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

0 comments on commit a0df5df

Please sign in to comment.