Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Aug 25, 2023
1 parent dcaf8e8 commit 41ea0fe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions webgl-lint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* webgl-lint@1.11.2, license MIT */
/* webgl-lint@1.11.3, license MIT */
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
Expand Down Expand Up @@ -331,6 +331,10 @@
return refed ? refed === obj : true;
};

function getWithDefault(v, defaultValue) {
return v === 'undefined' ? defaultValue : v;
}

const VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;

function computeLastUseIndexForDrawArrays(startOffset, vertCount/*, instances, errors*/) {
Expand Down Expand Up @@ -1086,7 +1090,7 @@ needs ${sizeNeeded} bytes for draw but buffer is only ${bufferSize} bytes`);
function computeRenderability(textureInfo, parameters) {
const {type, mips} = textureInfo;
const baseLevel = parameters.get(TEXTURE_BASE_LEVEL) || 0;
const maxLevel = parameters.get(TEXTURE_MAX_LEVEL) || maxMips;
const maxLevel = getWithDefault(parameters.get(TEXTURE_MAX_LEVEL), maxMips);
if (maxLevel < baseLevel) {
return `TEXTURE_MAX_LEVEL(${maxLevel}) is less than TEXTURE_BASE_LEVEL(${baseLevel})`;
}
Expand Down Expand Up @@ -1475,7 +1479,7 @@ needs ${sizeNeeded} bytes for draw but buffer is only ${bufferSize} bytes`);
const textureInfo = getTextureInfoForTarget(target);
const {parameters} = textureInfo;
const baseLevel = parameters.get(TEXTURE_BASE_LEVEL) || 0;
const maxLevel = parameters.get(TEXTURE_MAX_LEVEL) || maxMips;
const maxLevel = getWithDefault(parameters.get(TEXTURE_MAX_LEVEL), maxMips);
const mipInfo = getMipInfoForTarget(target, baseLevel);
const {width, height, depth, internalFormat, type} = mipInfo;
const numMipsNeeded = Math.min(computeNumMipsNeeded(width, height, depth), (maxLevel + 1) - baseLevel);
Expand Down

0 comments on commit 41ea0fe

Please sign in to comment.