Skip to content

Commit 45b985d

Browse files
aardgooseaardgoose
andauthored
WebGPURenderer: Fix color mask setting in WebGLBackend (mrdoob#27026)
Co-authored-by: aardgoose <angus.sawyer@email.com>
1 parent 0a612e3 commit 45b985d

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

examples/jsm/renderers/webgl/utils/WebGLState.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class WebGLState {
3030
this.currentPremultipledAlpha = null;
3131
this.currentPolygonOffsetFactor = null;
3232
this.currentPolygonOffsetUnits = null;
33+
this.currentColorMask = null;
3334
this.currentDepthFunc = null;
3435
this.currentDepthMask = null;
3536
this.currentStencilFunc = null;
@@ -296,6 +297,17 @@ class WebGLState {
296297

297298
}
298299

300+
setColorMask( colorMask ) {
301+
302+
if ( this.currentColorMask !== colorMask ) {
303+
304+
this.gl.colorMask( colorMask, colorMask, colorMask, colorMask );
305+
this.currentColorMask = colorMask;
306+
307+
}
308+
309+
}
310+
299311
setDepthTest( depthTest ) {
300312

301313
const { gl } = this;
@@ -462,7 +474,7 @@ class WebGLState {
462474
this.setDepthFunc( material.depthFunc );
463475
this.setDepthTest( material.depthTest );
464476
this.setDepthMask( material.depthWrite );
465-
this.setDepthMask( material.colorWrite );
477+
this.setColorMask( material.colorWrite );
466478

467479
const stencilWrite = material.stencilWrite;
468480
this.setStencilTest( stencilWrite );
3.18 KB
Loading

examples/webgpu_particles.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
3030

3131
import WebGPU from 'three/addons/capabilities/WebGPU.js';
32+
import WebGL from 'three/addons/capabilities/WebGL.js';
33+
3234
import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
3335

3436
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
@@ -40,11 +42,11 @@
4042

4143
function init() {
4244

43-
if ( WebGPU.isAvailable() === false ) {
45+
if ( WebGPU.isAvailable() === false && WebGL.isWebGL2Available() === false ) {
4446

4547
document.body.appendChild( WebGPU.getErrorMessage() );
4648

47-
throw new Error( 'No WebGPU support' );
49+
throw new Error( 'No WebGPU or WebGL2 support' );
4850

4951
}
5052

test/e2e/puppeteer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ const exceptionList = [
122122
'webgpu_loader_gltf_sheen',
123123
'webgpu_materials',
124124
'webgpu_materials_video',
125-
'webgpu_particles',
126125
'webgpu_sandbox',
127126
'webgpu_shadertoy',
128127
'webgpu_shadowmap',

0 commit comments

Comments
 (0)