Skip to content

Destroy WebGPU texture immediately instead of letting garbage collection do it#8401

Merged
mvaligursky merged 1 commit into
mainfrom
mv-webgpu-texture-destroy
Jan 23, 2026
Merged

Destroy WebGPU texture immediately instead of letting garbage collection do it#8401
mvaligursky merged 1 commit into
mainfrom
mv-webgpu-texture-destroy

Conversation

@mvaligursky

@mvaligursky mvaligursky commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Previously, WebgpuTexture.destroy() was an empty method, relying on JavaScript garbage collection to eventually release the underlying GPUTexture. This could cause GPU memory pressure when many textures are destroyed without GC running.

This change updates destroy() to:

  • Call gpuTexture.destroy() to immediately release GPU memory
  • Clear the texture view and view cache
  • Clear cached samplers

This aligns WebGPU behavior with the WebGL implementation, which already calls gl.deleteTexture() on destroy.

@mvaligursky mvaligursky self-assigned this Jan 23, 2026
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Jan 23, 2026
@mvaligursky mvaligursky requested a review from a team January 23, 2026 10:10
@mvaligursky mvaligursky merged commit bccbce6 into main Jan 23, 2026
7 checks passed
@mvaligursky mvaligursky deleted the mv-webgpu-texture-destroy branch January 23, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants