From 1d012dee140849a6cdbd2c629489416421267275 Mon Sep 17 00:00:00 2001 From: Catalin Moldovan Date: Fri, 23 Aug 2024 12:58:51 +0300 Subject: [PATCH] Fix linting errors --- src/platform/graphics/texture.js | 16 +++++++++------- src/platform/graphics/webgl/webgl-texture.js | 8 +++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/platform/graphics/texture.js b/src/platform/graphics/texture.js index 4b5f99e22c9..8fa033ceeb8 100644 --- a/src/platform/graphics/texture.js +++ b/src/platform/graphics/texture.js @@ -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 ?? ''; @@ -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); @@ -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 { @@ -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; diff --git a/src/platform/graphics/webgl/webgl-texture.js b/src/platform/graphics/webgl/webgl-texture.js index ffa62ee42b6..8200bf0b92c 100644 --- a/src/platform/graphics/webgl/webgl-texture.js +++ b/src/platform/graphics/webgl/webgl-texture.js @@ -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, @@ -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,