提交 d4191cf0 编写于 作者: T tschw

Fixes wrong program reference counting.

上级 d4f6d48c
...@@ -1927,6 +1927,7 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -1927,6 +1927,7 @@ THREE.WebGLRenderer = function ( parameters ) {
} }
var code = chunks.join(); var code = chunks.join();
var programChange = true;
if ( !materialProperties.program ) { if ( !materialProperties.program ) {
...@@ -1940,7 +1941,7 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -1940,7 +1941,7 @@ THREE.WebGLRenderer = function ( parameters ) {
} else if ( shaderID !== undefined ) { } else if ( shaderID !== undefined ) {
// same glsl // same glsl and uniform list
return; return;
} else if ( materialProperties.__webglShader.uniforms === material.uniforms ) { } else if ( materialProperties.__webglShader.uniforms === material.uniforms ) {
...@@ -1948,6 +1949,11 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -1948,6 +1949,11 @@ THREE.WebGLRenderer = function ( parameters ) {
// same uniforms (container object) // same uniforms (container object)
return; return;
} else {
// only rebuild uniform list
programChange = false;
} }
if ( shaderID ) { if ( shaderID ) {
...@@ -1983,7 +1989,12 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -1983,7 +1989,12 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( programInfo.code === code ) { if ( programInfo.code === code ) {
program = programInfo; program = programInfo;
program.usedTimes ++;
if ( programChange ) {
program.usedTimes ++;
}
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册