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

Transparency+shadows workaround for Galaxy Note 8 #3234

Merged
merged 2 commits into from
Feb 18, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/webgl-compatibility",
"comment": "Apply workaround for failure to render shadows and transparency on Mali-G71 MP20 (Samsung Galaxy Note 8).",
"type": "none"
}
],
"packageName": "@itwin/webgl-compatibility"
}
21 changes: 14 additions & 7 deletions core/webgl-compatibility/src/Capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,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 @@ -295,10 +306,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