Skip to content

Commit 380b8e1

Browse files
Mugen87RuthySheffi
authored andcommitted
Updated builds.
1 parent 3a84b06 commit 380b8e1

File tree

4 files changed

+90
-42
lines changed

4 files changed

+90
-42
lines changed

build/three.webgpu.js

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,9 +1674,7 @@ class Node extends EventDispatcher {
16741674
//const stackNodesBeforeSetup = builder.stack.nodes.length;
16751675

16761676
properties.initialized = true;
1677-
1678-
const outputNode = this.setup( builder ); // return a node or null
1679-
const isNodeOutput = outputNode && outputNode.isNode === true;
1677+
properties.outputNode = this.setup( builder ) || properties.outputNode || null;
16801678

16811679
/*if ( isNodeOutput && builder.stack.nodes.length !== stackNodesBeforeSetup ) {
16821680

@@ -1703,17 +1701,9 @@ class Node extends EventDispatcher {
17031701

17041702
}
17051703

1706-
if ( isNodeOutput ) {
1707-
1708-
outputNode.build( builder );
1709-
1710-
}
1711-
1712-
properties.outputNode = outputNode;
1713-
17141704
}
17151705

1716-
result = properties.outputNode || null;
1706+
result = properties.outputNode;
17171707

17181708
} else if ( buildStage === 'analyze' ) {
17191709

@@ -7077,8 +7067,14 @@ class ContextNode extends Node {
70777067

70787068
analyze( builder ) {
70797069

7070+
const previousContext = builder.getContext();
7071+
7072+
builder.setContext( { ...builder.context, ...this.value } );
7073+
70807074
this.node.build( builder );
70817075

7076+
builder.setContext( previousContext );
7077+
70827078
}
70837079

70847080
setup( builder ) {
@@ -7087,12 +7083,10 @@ class ContextNode extends Node {
70877083

70887084
builder.setContext( { ...builder.context, ...this.value } );
70897085

7090-
const node = this.node.build( builder );
7086+
this.node.build( builder );
70917087

70927088
builder.setContext( previousContext );
70937089

7094-
return node;
7095-
70967090
}
70977091

70987092
generate( builder, output ) {
@@ -46903,7 +46897,7 @@ class HemisphereLightNode extends AnalyticLightNode {
4690346897

4690446898
const { colorNode, groundColorNode, lightDirectionNode } = this;
4690546899

46906-
const dotNL = normalView.dot( lightDirectionNode );
46900+
const dotNL = normalWorld.dot( lightDirectionNode );
4690746901
const hemiDiffuseWeight = dotNL.mul( 0.5 ).add( 0.5 );
4690846902

4690946903
const irradiance = mix( groundColorNode, colorNode, hemiDiffuseWeight );
@@ -68414,6 +68408,35 @@ class WebGPUPipelineUtils {
6841468408
*/
6841568409
this.backend = backend;
6841668410

68411+
/**
68412+
* A Weak Map that tracks the active pipeline for render or compute passes.
68413+
*
68414+
* @private
68415+
* @type {WeakMap<(GPURenderPassEncoder|GPUComputePassEncoder),(GPURenderPipeline|GPUComputePipeline)>}
68416+
*/
68417+
this._activePipelines = new WeakMap();
68418+
68419+
}
68420+
68421+
/**
68422+
* Sets the given pipeline for the given pass. The method makes sure to only set the
68423+
* pipeline when necessary.
68424+
*
68425+
* @param {(GPURenderPassEncoder|GPUComputePassEncoder)} pass - The pass encoder.
68426+
* @param {(GPURenderPipeline|GPUComputePipeline)} pipeline - The pipeline.
68427+
*/
68428+
setPipeline( pass, pipeline ) {
68429+
68430+
const currentPipeline = this._activePipelines.get( pass );
68431+
68432+
if ( currentPipeline !== pipeline ) {
68433+
68434+
pass.setPipeline( pipeline );
68435+
68436+
this._activePipelines.set( pass, pipeline );
68437+
68438+
}
68439+
6841768440
}
6841868441

6841968442
/**
@@ -70732,7 +70755,8 @@ class WebGPUBackend extends Backend {
7073270755
// pipeline
7073370756

7073470757
const pipelineGPU = this.get( pipeline ).pipeline;
70735-
passEncoderGPU.setPipeline( pipelineGPU );
70758+
70759+
this.pipelineUtils.setPipeline( passEncoderGPU, pipelineGPU );
7073670760

7073770761
// bind groups
7073870762

@@ -70828,7 +70852,7 @@ class WebGPUBackend extends Backend {
7082870852
const setPipelineAndBindings = ( passEncoderGPU, currentSets ) => {
7082970853

7083070854
// pipeline
70831-
passEncoderGPU.setPipeline( pipelineGPU );
70855+
this.pipelineUtils.setPipeline( passEncoderGPU, pipelineGPU );
7083270856
currentSets.pipeline = pipelineGPU;
7083370857

7083470858
// bind groups
@@ -71059,8 +71083,8 @@ class WebGPUBackend extends Backend {
7105971083

7106071084
} else {
7106171085

71062-
// Regular single camera rendering
71063-
if ( renderContextData.currentPass ) {
71086+
// Regular single camera rendering
71087+
if ( renderContextData.currentPass ) {
7106471088

7106571089
// Handle occlusion queries
7106671090
if ( renderContextData.occlusionQuerySet !== undefined ) {

build/three.webgpu.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/three.webgpu.nodes.js

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,9 +1674,7 @@ class Node extends EventDispatcher {
16741674
//const stackNodesBeforeSetup = builder.stack.nodes.length;
16751675

16761676
properties.initialized = true;
1677-
1678-
const outputNode = this.setup( builder ); // return a node or null
1679-
const isNodeOutput = outputNode && outputNode.isNode === true;
1677+
properties.outputNode = this.setup( builder ) || properties.outputNode || null;
16801678

16811679
/*if ( isNodeOutput && builder.stack.nodes.length !== stackNodesBeforeSetup ) {
16821680

@@ -1703,17 +1701,9 @@ class Node extends EventDispatcher {
17031701

17041702
}
17051703

1706-
if ( isNodeOutput ) {
1707-
1708-
outputNode.build( builder );
1709-
1710-
}
1711-
1712-
properties.outputNode = outputNode;
1713-
17141704
}
17151705

1716-
result = properties.outputNode || null;
1706+
result = properties.outputNode;
17171707

17181708
} else if ( buildStage === 'analyze' ) {
17191709

@@ -7077,8 +7067,14 @@ class ContextNode extends Node {
70777067

70787068
analyze( builder ) {
70797069

7070+
const previousContext = builder.getContext();
7071+
7072+
builder.setContext( { ...builder.context, ...this.value } );
7073+
70807074
this.node.build( builder );
70817075

7076+
builder.setContext( previousContext );
7077+
70827078
}
70837079

70847080
setup( builder ) {
@@ -7087,12 +7083,10 @@ class ContextNode extends Node {
70877083

70887084
builder.setContext( { ...builder.context, ...this.value } );
70897085

7090-
const node = this.node.build( builder );
7086+
this.node.build( builder );
70917087

70927088
builder.setContext( previousContext );
70937089

7094-
return node;
7095-
70967090
}
70977091

70987092
generate( builder, output ) {
@@ -46903,7 +46897,7 @@ class HemisphereLightNode extends AnalyticLightNode {
4690346897

4690446898
const { colorNode, groundColorNode, lightDirectionNode } = this;
4690546899

46906-
const dotNL = normalView.dot( lightDirectionNode );
46900+
const dotNL = normalWorld.dot( lightDirectionNode );
4690746901
const hemiDiffuseWeight = dotNL.mul( 0.5 ).add( 0.5 );
4690846902

4690946903
const irradiance = mix( groundColorNode, colorNode, hemiDiffuseWeight );
@@ -68414,6 +68408,35 @@ class WebGPUPipelineUtils {
6841468408
*/
6841568409
this.backend = backend;
6841668410

68411+
/**
68412+
* A Weak Map that tracks the active pipeline for render or compute passes.
68413+
*
68414+
* @private
68415+
* @type {WeakMap<(GPURenderPassEncoder|GPUComputePassEncoder),(GPURenderPipeline|GPUComputePipeline)>}
68416+
*/
68417+
this._activePipelines = new WeakMap();
68418+
68419+
}
68420+
68421+
/**
68422+
* Sets the given pipeline for the given pass. The method makes sure to only set the
68423+
* pipeline when necessary.
68424+
*
68425+
* @param {(GPURenderPassEncoder|GPUComputePassEncoder)} pass - The pass encoder.
68426+
* @param {(GPURenderPipeline|GPUComputePipeline)} pipeline - The pipeline.
68427+
*/
68428+
setPipeline( pass, pipeline ) {
68429+
68430+
const currentPipeline = this._activePipelines.get( pass );
68431+
68432+
if ( currentPipeline !== pipeline ) {
68433+
68434+
pass.setPipeline( pipeline );
68435+
68436+
this._activePipelines.set( pass, pipeline );
68437+
68438+
}
68439+
6841768440
}
6841868441

6841968442
/**
@@ -70732,7 +70755,8 @@ class WebGPUBackend extends Backend {
7073270755
// pipeline
7073370756

7073470757
const pipelineGPU = this.get( pipeline ).pipeline;
70735-
passEncoderGPU.setPipeline( pipelineGPU );
70758+
70759+
this.pipelineUtils.setPipeline( passEncoderGPU, pipelineGPU );
7073670760

7073770761
// bind groups
7073870762

@@ -70828,7 +70852,7 @@ class WebGPUBackend extends Backend {
7082870852
const setPipelineAndBindings = ( passEncoderGPU, currentSets ) => {
7082970853

7083070854
// pipeline
70831-
passEncoderGPU.setPipeline( pipelineGPU );
70855+
this.pipelineUtils.setPipeline( passEncoderGPU, pipelineGPU );
7083270856
currentSets.pipeline = pipelineGPU;
7083370857

7083470858
// bind groups
@@ -71059,8 +71083,8 @@ class WebGPUBackend extends Backend {
7105971083

7106071084
} else {
7106171085

71062-
// Regular single camera rendering
71063-
if ( renderContextData.currentPass ) {
71086+
// Regular single camera rendering
71087+
if ( renderContextData.currentPass ) {
7106471088

7106571089
// Handle occlusion queries
7106671090
if ( renderContextData.occlusionQuerySet !== undefined ) {

build/three.webgpu.nodes.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)