Skip to content

Commit

Permalink
Transparency+shadows workaround for Galaxy Note 8 (backport #3234) (#…
Browse files Browse the repository at this point in the history
…3237)

Co-authored-by: Paul Connelly <22944042+pmconne@users.noreply.github.com>
  • Loading branch information
mergify[bot] and pmconne authored Feb 18, 2022
1 parent a038ed0 commit 89be4b8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/webgl-compatibility",
"comment": "Apply workaround for failure to render shadows and transparency on Mali-G71 MP20 (Samsung Galaxy Note 8).",
"type": "none"
}
],
"packageName": "@bentley/webgl-compatibility",
"email": "22944042+pmconne@users.noreply.github.com"
}
21 changes: 14 additions & 7 deletions core/webgl-compatibility/src/Capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,21 @@ export class Capabilities {
this._maxDrawBuffers = dbExt !== undefined ? gl.getParameter(dbExt.MAX_DRAW_BUFFERS_WEBGL) : 1;
}

const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
const unmaskedRenderer = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) : undefined;
const unmaskedVendor = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) : undefined;

// Determine the maximum color-renderable attachment type.
// Note: iOS>=15 allows full-float rendering. However, it does not actually work on non-M1 devices. Because of this, for now we disallow full float rendering on iOS devices.
// ###TODO: Re-assess this after future iOS updates.
const allowFloatRender = (undefined === disabledExtensions || -1 === disabledExtensions.indexOf("OES_texture_float")) && !ProcessDetector.isIOSBrowser;
const allowFloatRender =
(undefined === disabledExtensions || -1 === disabledExtensions.indexOf("OES_texture_float"))
// iOS>=15 allows full-float rendering. However, it does not actually work on non-M1 devices.
// Because of this, for now we disallow full float rendering on iOS devices.
// ###TODO: Re-assess this after future iOS updates.
&& !ProcessDetector.isIOSBrowser
// Samsung Galaxy Note 8 exhibits same issue as described above for iOS >= 15.
// It uses specifically Mali-G71 MP20 but reports its renderer as follows.
&& unmaskedRenderer !== "Mali-G71";

if (allowFloatRender && undefined !== this.queryExtensionObject("EXT_float_blend") && this.isTextureRenderable(gl, gl.FLOAT)) {
this._maxRenderType = RenderType.TextureFloat;
} else if (this.isWebGL2) {
Expand All @@ -287,10 +298,6 @@ export class Capabilities {
const missingRequiredFeatures = this._findMissingFeatures(Capabilities.requiredFeatures);
const missingOptionalFeatures = this._findMissingFeatures(Capabilities.optionalFeatures);

const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
const unmaskedRenderer = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) : undefined;
const unmaskedVendor = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) : undefined;

this._driverBugs = {};
if (unmaskedRenderer && buggyIntelMatchers.some((x) => x.test(unmaskedRenderer)))
this._driverBugs.fragDepthDoesNotDisableEarlyZ = true;
Expand Down

0 comments on commit 89be4b8

Please sign in to comment.