Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
heretique committed Aug 23, 2024
1 parent 39bfdd2 commit 1d012de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 9 additions & 7 deletions src/platform/graphics/texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ class Texture {
*/
constructor(graphicsDevice, options = {}) {
this.device = graphicsDevice;
Debug.assert(this.device, "Texture constructor requires a graphicsDevice to be valid");
Debug.assert(!options.width || Number.isInteger(options.width), "Texture width must be an integer number, got", options);
Debug.assert(!options.height || Number.isInteger(options.height), "Texture height must be an integer number, got", options);
Debug.assert(!options.layers || Number.isInteger(options.layers), "Texture layers must be an integer number, got", options);
Debug.assert(this.device, 'Texture constructor requires a graphicsDevice to be valid');
Debug.assert(!options.width || Number.isInteger(options.width), 'Texture width must be an integer number, got', options);
Debug.assert(!options.height || Number.isInteger(options.height), 'Texture height must be an integer number, got', options);
Debug.assert(!options.layers || Number.isInteger(options.layers), 'Texture layers must be an integer number, got', options);

this.name = options.name ?? '';

Expand All @@ -234,7 +234,7 @@ class Texture {

this._layers = Math.floor(options.layers ?? (this._dimension === TEXTUREDIMENSION_CUBE ? 6 : 1));

Debug.assert((this._dimension === TEXTUREDIMENSION_CUBE ? this._layers === 6 : true), "Texture cube map must have 6 layers");
Debug.assert((this._dimension === TEXTUREDIMENSION_CUBE ? this._layers === 6 : true), 'Texture cube map must have 6 layers');

this._format = options.format ?? PIXELFORMAT_RGBA8;
this._compressed = isCompressedPixelFormat(this._format);
Expand Down Expand Up @@ -941,8 +941,9 @@ class Texture {
if (!invalid) {
// mark levels as updated
for (let i = 0; i < this._layers; i++) {
if (this._levels[0][i] !== source[i])
if (this._levels[0][i] !== source[i]) {
this._levelsUpdated[0][i] = true;
}
}
}
} else {
Expand All @@ -953,8 +954,9 @@ class Texture {

if (!invalid) {
// mark level as updated
if (source !== this._levels[0])
if (source !== this._levels[0]) {
this._levelsUpdated[0] = true;
}

width = source.width;
height = source.height;
Expand Down
8 changes: 5 additions & 3 deletions src/platform/graphics/webgl/webgl-texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,12 @@ class WebglTexture {
this._glPixelType,
mipObject);
}
} else if (texture.array && typeof mipObject === "object") {
} else if (texture.array && typeof mipObject === 'object') {
if (texture._compressed) {
for (let index = 0; index < texture._layers; index++) {
if (!texture._levelsUpdated[0][index] || !mipObject[index])
if (!texture._levelsUpdated[0][index] || !mipObject[index]) {
continue;
}
gl.compressedTexSubImage3D(
gl.TEXTURE_2D_ARRAY,
mipLevel,
Expand All @@ -646,8 +647,9 @@ class WebglTexture {
}
} else {
for (let index = 0; index < texture.layers; index++) {
if (!texture._levelsUpdated[0][index] || !mipObject[index])
if (!texture._levelsUpdated[0][index] || !mipObject[index]) {
continue;
}
gl.texSubImage3D(
gl.TEXTURE_2D_ARRAY,
mipLevel,
Expand Down

0 comments on commit 1d012de

Please sign in to comment.