Skip to content

Commit

Permalink
Set shader precission to mediump in Mobile. Fix problems with Adreno …
Browse files Browse the repository at this point in the history
…300 series GPUs and improves perf. (fix aframevr#3971, aframevr#3523)
  • Loading branch information
dmarcos committed Jan 30, 2019
1 parent cc4e5fe commit eba8f4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/scene/a-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,13 @@ module.exports.AScene = registerElement('a-scene', {
var rendererAttrString;
var rendererConfig;

rendererConfig = {alpha: true, antialias: !isMobile, canvas: this.canvas, logarithmicDepthBuffer: false};
rendererConfig = {
alpha: true,
antialias: !isMobile,
canvas: this.canvas,
logarithmicDepthBuffer: false,
precision: isMobile && !window.hasNativeVR ? 'mediump' : 'highp'
};

this.maxCanvasSize = {height: 1920, width: 1920};

Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ window.Promise = window.Promise || require('promise-polyfill');
window.hasNativeWebVRImplementation = !!window.navigator.getVRDisplays ||
!!window.navigator.getVRDevices;
window.hasNativeWebXRImplementation = navigator.xr !== undefined;
window.hasNativeVR = window.hasNativeWebVRImplementation || window.hasNativeWebXRImplementation;

// If native WebXR or WebVR are defined WebVRPolyfill does not initialize.
if (!window.hasNativeWebXRImplementation && !window.hasNativeWebVRImplementation) {
Expand Down

0 comments on commit eba8f4c

Please sign in to comment.