From 050ff5a9c200696b543bcb7d848259c91ba24674 Mon Sep 17 00:00:00 2001 From: Seungup Date: Sat, 15 Jul 2023 22:25:54 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20issue=20with=20sett?= =?UTF-8?q?ing=200=20or=20false=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The change involves replacing the logical OR operator (`||`) with the nullish coalescing operator (`??`) in the `_applyUniforms()` method. This modification addresses a specific issue where 0 or false values were not being correctly assigned. By using the nullish coalescing operator, the code ensures that if the value of `this.uniforms[name]` is either 0 or false, it will be properly assigned as the value for `value`. This change enhances the accuracy and reliability of the code by handling these specific cases effectively. ✅ Closes: #1741 --- modules/webgl/src/adapter/resources/webgl-render-pipeline.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts b/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts index 9f8a14fdb8..f78d48bcfe 100644 --- a/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts +++ b/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts @@ -359,7 +359,7 @@ export class WEBGLRenderPipeline extends RenderPipeline { _applyUniforms() { for (const uniformLayout of this.layout.uniforms || []) { const {name, location, type, textureUnit} = uniformLayout; - const value = this.uniforms[name] || textureUnit; + const value = this.uniforms[name] ?? textureUnit; if (value !== undefined) { setUniform(this.device.gl, location, type, value); }