未验证 提交 6acaabc7 编写于 作者: M Michael Herzog 提交者: GitHub

WebGPURenderPipelines: Avoid usage of objectProperties. (#21768)

上级 efad13f6
......@@ -29,13 +29,13 @@ class WebGPURenderPipelines {
const properties = this.properties;
const material = object.material;
const materialProperties = properties.get( material );
const objectProperties = properties.get( object );
let currentPipeline = objectProperties.currentPipeline;
const cache = this._getCache( object );
let currentPipeline;
if ( this._needsUpdate( object ) ) {
if ( this._needsUpdate( object, cache ) ) {
// get shader
......@@ -64,7 +64,7 @@ class WebGPURenderPipelines {
// determine render pipeline
currentPipeline = this._acquirePipeline( stageVertex, stageFragment, object, nodeBuilder );
objectProperties.currentPipeline = currentPipeline;
cache.currentPipeline = currentPipeline;
// keep track of all pipelines which are used by a material
......@@ -98,6 +98,10 @@ class WebGPURenderPipelines {
}
} else {
currentPipeline = cache.currentPipeline;
}
return currentPipeline;
......@@ -174,6 +178,21 @@ class WebGPURenderPipelines {
}
_getCache( object ) {
let cache = this.objectCache.get( object );
if ( cache === undefined ) {
cache = {};
this.objectCache.set( object, cache );
}
return cache;
}
_releasePipeline( pipeline ) {
if ( -- pipeline.usedTimes === 0 ) {
......@@ -204,16 +223,7 @@ class WebGPURenderPipelines {
}
_needsUpdate( object ) {
let cache = this.objectCache.get( object );
if ( cache === undefined ) {
cache = {};
this.objectCache.set( object, cache );
}
_needsUpdate( object, cache ) {
const material = object.material;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册