Skip to content

Commit 1a493a9

Browse files
authored
[GL Emulation] Fix MAX_TEXTURES limit (#16914)
The code did not match the comment, and incorrectly did a max instead of a min.
1 parent 5584dd1 commit 1a493a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/library_glemu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2881,7 +2881,7 @@ var LibraryGLEmulation = {
28812881
// User can override the maximum number of texture units that we emulate. Using fewer texture units increases runtime performance
28822882
// slightly, so it is advantageous to choose as small value as needed.
28832883
// Limit to a maximum of 28 to not overflow the state bits used for renderer caching (31 bits = 3 attributes + 28 texture units).
2884-
GLImmediate.MAX_TEXTURES = Math.max(Module['GL_MAX_TEXTURE_IMAGE_UNITS'] || GLctx.getParameter(GLctx.MAX_TEXTURE_IMAGE_UNITS), 28);
2884+
GLImmediate.MAX_TEXTURES = Math.min(Module['GL_MAX_TEXTURE_IMAGE_UNITS'] || GLctx.getParameter(GLctx.MAX_TEXTURE_IMAGE_UNITS), 28);
28852885

28862886
GLImmediate.TexEnvJIT.init(GLctx, GLImmediate.MAX_TEXTURES);
28872887

0 commit comments

Comments
 (0)