Skip to content

Commit

Permalink
WebGPUBackend: Add support for setStencilReference(). (#30470)
Browse files Browse the repository at this point in the history
* WebGPUBackend: Add support for `setStencilReference()`.

* WebGPUBackend: Cache `stencilRef`.
  • Loading branch information
Mugen87 authored Feb 6, 2025
1 parent 4df9898 commit f883c99
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ class WebGPUBackend extends Backend {
*/
draw( renderObject, info ) {

const { object, context, pipeline } = renderObject;
const { object, material, context, pipeline } = renderObject;
const bindings = renderObject.getBindings();
const renderContextData = this.get( context );
const pipelineGPU = this.get( pipeline ).pipeline;
Expand Down Expand Up @@ -1189,6 +1189,15 @@ class WebGPUBackend extends Backend {

}

// stencil

if ( context.stencil === true && material.stencilWrite === true && renderContextData.currentStencilRef !== material.stencilRef ) {

passEncoderGPU.setStencilReference( material.stencilRef );
renderContextData.currentStencilRef = material.stencilRef;

}

// draw

const draw = () => {
Expand Down

0 comments on commit f883c99

Please sign in to comment.