Skip to content

Commit 7e1acd0

Browse files
committed
Updated builds.
1 parent 4e86f50 commit 7e1acd0

File tree

3 files changed

+21
-33
lines changed

3 files changed

+21
-33
lines changed

build/three.cjs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66100,6 +66100,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
6610066100
const _customShaders = new WebGLShaderCache();
6610166101
const _activeChannels = new Set();
6610266102
const programs = [];
66103+
const programsMap = new Map();
6610366104

6610466105
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
6610566106

@@ -66676,29 +66677,19 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
6667666677

6667766678
function acquireProgram( parameters, cacheKey ) {
6667866679

66679-
let program;
66680+
let program = programsMap.get( cacheKey );
6668066681

66681-
// Check if code has been already compiled
66682-
for ( let p = 0, pl = programs.length; p < pl; p ++ ) {
66682+
if ( program !== undefined ) {
6668366683

66684-
const preexistingProgram = programs[ p ];
66684+
++ program.usedTimes;
6668566685

66686-
if ( preexistingProgram.cacheKey === cacheKey ) {
66687-
66688-
program = preexistingProgram;
66689-
++ program.usedTimes;
66690-
66691-
break;
66692-
66693-
}
66694-
66695-
}
66696-
66697-
if ( program === undefined ) {
66686+
} else {
6669866687

6669966688
program = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );
6670066689
programs.push( program );
6670166690

66691+
programsMap.set( cacheKey, program );
66692+
6670266693
}
6670366694

6670466695
return program;
@@ -66714,6 +66705,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
6671466705
programs[ i ] = programs[ programs.length - 1 ];
6671566706
programs.pop();
6671666707

66708+
// Remove from map
66709+
programsMap.delete( program.cacheKey );
66710+
6671766711
// Free WebGL resources
6671866712
program.destroy();
6671966713

build/three.module.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7004,6 +7004,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
70047004
const _customShaders = new WebGLShaderCache();
70057005
const _activeChannels = new Set();
70067006
const programs = [];
7007+
const programsMap = new Map();
70077008

70087009
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
70097010

@@ -7580,29 +7581,19 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
75807581

75817582
function acquireProgram( parameters, cacheKey ) {
75827583

7583-
let program;
7584+
let program = programsMap.get( cacheKey );
75847585

7585-
// Check if code has been already compiled
7586-
for ( let p = 0, pl = programs.length; p < pl; p ++ ) {
7586+
if ( program !== undefined ) {
75877587

7588-
const preexistingProgram = programs[ p ];
7588+
++ program.usedTimes;
75897589

7590-
if ( preexistingProgram.cacheKey === cacheKey ) {
7591-
7592-
program = preexistingProgram;
7593-
++ program.usedTimes;
7594-
7595-
break;
7596-
7597-
}
7598-
7599-
}
7600-
7601-
if ( program === undefined ) {
7590+
} else {
76027591

76037592
program = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );
76047593
programs.push( program );
76057594

7595+
programsMap.set( cacheKey, program );
7596+
76067597
}
76077598

76087599
return program;
@@ -7618,6 +7609,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
76187609
programs[ i ] = programs[ programs.length - 1 ];
76197610
programs.pop();
76207611

7612+
// Remove from map
7613+
programsMap.delete( program.cacheKey );
7614+
76217615
// Free WebGL resources
76227616
program.destroy();
76237617

build/three.module.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)