Skip to content

Commit 8d30c7b

Browse files
authored
Merge pull request #163 from De-Panther/context_clear_alpha_changes
Replaced GLctx.dontClearOnFrameStart with GLctx.dontClearAlphaOnly
2 parents 6e79707 + 0bd751e commit 8d30c7b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Packages/webxr/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- How WebGL context clear alpha works.
810

911
## [0.12.0] - 2021-06-20
1012
### Added

Packages/webxr/Runtime/Plugins/WebGL/transparent_bg.jslib

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
var LibraryGLClear = {
22
glClear: function (mask) {
3-
if (mask == 0x00004000 && GLctx.dontClearOnFrameStart) {
3+
if (mask == 0x00004000 && GLctx.dontClearAlphaOnly) {
44
var v = GLctx.getParameter(GLctx.COLOR_WRITEMASK);
55
if (!v[0] && !v[1] && !v[2] && v[3])
6-
GLctx.dontClearOnFrameStart = false;
76
// We are trying to clear alpha only -- skip.
87
return;
98
}

Packages/webxr/Runtime/Plugins/WebGL/webxr.jspre

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ setTimeout(function () {
400400

401401
this.BrowserObject.pauseAsyncCallbacks();
402402
this.BrowserObject.mainLoop.pause();
403+
this.ctx.dontClearAlphaOnly = false;
403404
this.ctx.bindFramebuffer(this.ctx.FRAMEBUFFER);
404405
var thisXRMananger = this;
405406
window.setTimeout(function () {
@@ -821,6 +822,7 @@ setTimeout(function () {
821822
refSpaceType = this.gameModule.WebXR.Settings.VRRequiredReferenceSpace[0];
822823
if (session.isAR) {
823824
refSpaceType = this.gameModule.WebXR.Settings.ARRequiredReferenceSpace[0];
825+
this.ctx.dontClearAlphaOnly = true;
824826
}
825827

826828
var onSessionEnded = this.onEndSession.bind(this);
@@ -885,7 +887,6 @@ setTimeout(function () {
885887

886888
this.ctx.bindFramebuffer(this.ctx.FRAMEBUFFER, glLayer.framebuffer);
887889
if (session.isAR) {
888-
this.ctx.dontClearOnFrameStart = true;
889890
// Workaround for Chromium depth bug https://bugs.chromium.org/p/chromium/issues/detail?id=1167450#c21
890891
this.ctx.depthMask(false);
891892
this.ctx.clear(this.ctx.DEPTH_BUFFER_BIT);

0 commit comments

Comments
 (0)