Skip to content

Commit

Permalink
chore(webgl): Avoid WEBGL_polygon_mode extension warning (#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Mar 13, 2024
1 parent 3154cf8 commit 54af690
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions modules/webgl/src/adapter/device-helpers/webgl-device-features.ts
Expand Up @@ -61,12 +61,8 @@ export class WebGLDeviceFeatures extends DeviceFeatures {
}

*[Symbol.iterator](): IterableIterator<DeviceFeature> {
for (const feature of Object.keys(WEBGL_FEATURES) as DeviceFeature[]) {
if (this.has(feature)) {
yield feature;
}
}
for (const feature of Object.keys(TEXTURE_FEATURES) as DeviceFeature[]) {
const features = this.getFeatures();
for (const feature of features) {
if (this.has(feature)) {
yield feature;
}
Expand Down Expand Up @@ -98,15 +94,20 @@ export class WebGLDeviceFeatures extends DeviceFeatures {
// FOR DEVICE

initializeFeatures() {
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const feature of this) {
// WebGL extensions are initialized by requesting them
// Initialize all features by checking them.
// Except WEBGL_polygon_mode since Chrome logs ugly console warnings
const features = this.getFeatures().filter(feature => feature !== 'polygon-mode-webgl');
for (const feature of features) {
this.has(feature);
}
}

// IMPLEMENTATION

getFeatures() {
return [...Object.keys(WEBGL_FEATURES), ...Object.keys(TEXTURE_FEATURES)] as DeviceFeature[];
}

/** Extract all WebGL features */
protected getWebGLFeature(feature: DeviceFeature): boolean {
const featureInfo = WEBGL_FEATURES[feature];
Expand Down

0 comments on commit 54af690

Please sign in to comment.