Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/renderers/webgl-fallback/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ class WebGLBackend extends Backend {

this.disjoint = this.extensions.get( 'EXT_disjoint_timer_query_webgl2' );
this.parallel = this.extensions.get( 'KHR_parallel_shader_compile' );
this.drawBuffersIndexedExt = this.extensions.get( 'OES_draw_buffers_indexed' );

}

Expand Down Expand Up @@ -957,6 +958,12 @@ class WebGLBackend extends Backend {

state.setMaterial( material, frontFaceCW, hardwareClippingPlanes );

if ( context.textures !== null && context.textures.length > 1 ) {

state.setMRTBlending( context.textures );

}

state.useProgram( programGPU );

// vertex state
Expand Down
17 changes: 16 additions & 1 deletion src/renderers/webgl-fallback/utils/WebGLState.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class WebGLState {
this.currentBoundTextures = {};
this.currentBoundBufferBases = {};


this._init();

}
Expand Down Expand Up @@ -271,6 +270,22 @@ class WebGLState {

}

setMRTBlending( textures ) {

const gl = this.gl;
const drawBuffersIndexedExt = this.backend.drawBuffersIndexedExt;

if ( ! drawBuffersIndexedExt ) return;

for ( let i = 1; i < textures.length; i ++ ) {

// use opaque blending for additional render targets
drawBuffersIndexedExt.blendFuncSeparateiOES( i, gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );

}

}

/**
* Defines the blending.
*
Expand Down
21 changes: 16 additions & 5 deletions src/renderers/webgpu/utils/WebGPUPipelineUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,22 @@ class WebGPUPipelineUtils {

const colorFormat = utils.getTextureFormatGPU( textures[ i ] );

targets.push( {
format: colorFormat,
blend: blending,
writeMask: colorWriteMask
} );
if ( i === 0 ) {

targets.push( {
format: colorFormat,
blend: blending,
writeMask: colorWriteMask
} );

} else {

targets.push( {
format: colorFormat,
writeMask: colorWriteMask
} );

}

}

Expand Down