Skip to content

fix: Texture#lock allocates when mip level slot is missing#8695

Merged
mvaligursky merged 1 commit intomainfrom
mv-fix-texture-lock-missing-mip
May 7, 2026
Merged

fix: Texture#lock allocates when mip level slot is missing#8695
mvaligursky merged 1 commit intomainfrom
mv-fix-texture-lock-missing-mip

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

When the texture is created without options.levels, _clearLevels() only initializes mip 0 ([null] for 2D). Higher mip indices are undefined, not null, so the previous === null check skipped allocation and lock() returned undefined (see #8659).

Changes:

  • Treat an empty mip slot as missing using if (!levels[options.level]) before allocating the typed array for Texture#lock.

Fixes #8659

Without options.levels, _clearLevels() only sets index 0 to null; higher
mips are undefined. Treat falsy slots as empty so lock() returns a buffer.

Fixes #8659
@mvaligursky mvaligursky merged commit 8c7b794 into main May 7, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-fix-texture-lock-missing-mip branch May 7, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid lock operation in texture for mip level.

1 participant