Skip to content

Commit

Permalink
Merge pull request #1175 from OpenGeoscience/reduce-error-check
Browse files Browse the repository at this point in the history
perf: Reduce texture memory checks.
  • Loading branch information
manthey authored Feb 4, 2022
2 parents 1d12f11 + ea2bea1 commit 03cedc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/webgl/quadFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var registerFeature = require('../registry').registerFeature;
var quadFeature = require('../quadFeature');
var timestamp = require('../timestamp');

let _memoryCheckLargestTested = 4096 * 4096;

/**
* Create a new instance of class quadFeature.
*
Expand Down Expand Up @@ -373,8 +375,11 @@ var webgl_quadFeature = function (arg) {
quad.texture.bind(renderState);
// only check if the context is out of memory when using modestly large
// textures. The check is slow.
if ((quad.image.width > 4096 || quad.image.height > 4096 || quad.image.width * quad.image.height > 4194304) && context.getError() === context.OUT_OF_MEMORY) {
console.log('Insufficient GPU memory for texture');
if (quad.image.width * quad.image.height > _memoryCheckLargestTested) {
_memoryCheckLargestTested = quad.image.width * quad.image.height;
if (context.getError() === context.OUT_OF_MEMORY) {
console.log('Insufficient GPU memory for texture');
}
}
if (quad.opacity !== opacity) {
opacity = quad.opacity;
Expand Down

0 comments on commit 03cedc5

Please sign in to comment.