mojira.dev
MC-307899

Adding large animated textures to atlases causes the Vulkan rendering backend to run out of memory

Steps to reproduce:

  1. Add the attached resource pack to a 26.2-snapshot-5 game instance.

  2. Launch the game with Vulkan.

  3. The resource reloading thread eventually crashes (see logs below).

  4. Launch the game with OpenGL.

  5. The game starts successfully.

What I’m doing there:
I have an animated texture for a mod that is 128x104960, which is split into 1640 frames. Concernedly a lot, however OpenGL has been able to handle it so far, so I expect it to be OK to do?

Game log:

[19:25:03] [Render thread/INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, profilesHost=https://api.mojang.com, name=PROD]
[19:25:03] [Render thread/INFO]: Setting user: KikuGie
[19:25:03] [Render thread/INFO]: Backend library: LWJGL version 3.4.1+2
[19:25:03] [Render thread/INFO]: Using graphics backend Vulkan, using drivers: 1.4.335 Intel open-source Mesa driver Mesa 26.0.4 (git-d9e5e36b19)
[19:25:03] [Render thread/INFO]: Using graphics device: Intel(R) Iris(R) Xe Graphics (TGL GT2) (INTEL)
[19:25:03] [Render thread/INFO]: Using graphics device extensions: VK_KHR_synchronization2 (D), VK_KHR_swapchain (D), VK_KHR_surface (I), VK_KHR_push_descriptor (D), VK_KHR_xcb_surface (I), VK_EXT_debug_utils (I), VK_KHR_dynamic_rendering (D)
[ALSOFT] (EE) Failed to connect PipeWire event context (errno: 112)
[19:25:04] [Render thread/INFO]: Reloading ResourceManager: vanilla, file/Test Pack
[19:25:04] [Worker-Main-2/INFO]: Found unifont_all_no_pua-17.0.01.hex, loading
[19:25:04] [Worker-Main-4/INFO]: Found unifont_pua-17.0.01.hex, loading
[19:25:04] [Worker-Main-4/INFO]: Found unifont_jp_patch-17.0.01.hex, loading
[19:25:06] [Render thread/INFO]: OpenAL initialized on device Built-in Audio Analog Stereo
[19:25:06] [Render thread/INFO]: Sound engine started
[19:25:06] [Render thread/INFO]: Created: 512x256x0 minecraft:textures/atlas/particles.png-atlas
[19:25:06] [Render thread/INFO]: Created: 128x128x0 minecraft:textures/atlas/decorated_pot.png-atlas
[19:25:06] [Render thread/INFO]: Created: 2048x1024x0 minecraft:textures/atlas/armor_trims.png-atlas
[19:25:37] [Render thread/INFO]: Caught error loading resourcepacks, removing all selected resourcepacks
java.util.concurrent.CompletionException: java.lang.IllegalStateException: VK_ERROR_OUT_OF_DEVICE_MEMORY: Failed to allocate VkBuffer
	at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:359)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:364)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:743)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:503)
	at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$prepareTasks$3(SimpleReloadInstance.java:59)
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:173)
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23)
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:147)
	at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:127)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1203)
	at net.minecraft.client.Minecraft.run(Minecraft.java:921)
	at net.minecraft.client.main.Main.main(Main.java:292)
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:115)
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129)
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70)
Caused by: java.lang.IllegalStateException: VK_ERROR_OUT_OF_DEVICE_MEMORY: Failed to allocate VkBuffer
	at com.mojang.blaze3d.vulkan.VulkanUtils.crashIfFailure(VulkanUtils.java:21)
	at com.mojang.blaze3d.vulkan.VulkanGpuBuffer.<init>(VulkanGpuBuffer.java:63)
	at com.mojang.blaze3d.vulkan.VulkanCommandEncoder.createStagingBuffer(VulkanCommandEncoder.java:147)
	at com.mojang.blaze3d.vulkan.VulkanCommandEncoder.writeToTexture(VulkanCommandEncoder.java:466)
	at com.mojang.blaze3d.systems.CommandEncoder.writeToTexture(CommandEncoder.java:350)
	at net.minecraft.client.renderer.texture.SpriteContents$AnimatedTexture.createAnimationState(SpriteContents.java:301)
	at net.minecraft.client.renderer.texture.SpriteContents.createAnimationState(SpriteContents.java:197)
	at net.minecraft.client.renderer.texture.TextureAtlasSprite.createAnimationState(TextureAtlasSprite.java:62)
	at net.minecraft.client.renderer.texture.TextureAtlas.upload(TextureAtlas.java:117)
	at net.minecraft.client.resources.model.sprite.AtlasManager$PendingStitch.joinAndUpload(AtlasManager.java:167)
	at net.minecraft.client.resources.model.sprite.AtlasManager$PendingStitchResults.lambda$joinAndUpload$0(AtlasManager.java:211)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
	at net.minecraft.client.resources.model.sprite.AtlasManager$PendingStitchResults.joinAndUpload(AtlasManager.java:211)
	at net.minecraft.client.resources.model.sprite.AtlasManager.updateSpriteMaps(AtlasManager.java:145)
	at net.minecraft.client.resources.model.sprite.AtlasManager.lambda$reload$2(AtlasManager.java:141)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:739)
	... 12 more
[19:25:37] [Render thread/INFO]: Reloading ResourceManager: vanilla
[19:25:37] [Worker-Main-5/INFO]: Found unifont_all_no_pua-17.0.01.hex, loading
[19:25:37] [Worker-Main-1/INFO]: Found unifont_pua-17.0.01.hex, loading
[19:25:37] [Worker-Main-6/INFO]: Found unifont_jp_patch-17.0.01.hex, loading
[19:25:39] [Render thread/INFO]: OpenAL initialized on device Built-in Audio Analog Stereo
[19:25:39] [Render thread/INFO]: Sound engine started
[19:25:39] [Render thread/INFO]: Created: 512x256x0 minecraft:textures/atlas/particles.png-atlas
[19:25:39] [Render thread/INFO]: Created: 128x128x0 minecraft:textures/atlas/decorated_pot.png-atlas
[19:25:39] [Render thread/INFO]: Created: 2048x1024x0 minecraft:textures/atlas/armor_trims.png-atlas
[19:25:39] [Render thread/INFO]: Created: 512x256x0 minecraft:textures/atlas/paintings.png-atlas
[19:25:39] [Render thread/INFO]: Created: 1024x512x0 minecraft:textures/atlas/shield_patterns.png-atlas
[19:25:39] [Render thread/INFO]: Created: 2048x2048x4 minecraft:textures/atlas/blocks.png-atlas
[19:25:40] [Render thread/INFO]: Created: 512x512x0 minecraft:textures/atlas/chest.png-atlas
[19:25:40] [Render thread/INFO]: Created: 256x128x0 minecraft:textures/atlas/celestials.png-atlas
[19:25:40] [Render thread/INFO]: Created: 1024x512x0 minecraft:textures/atlas/banner_patterns.png-atlas
[19:25:40] [Render thread/INFO]: Created: 1024x512x0 minecraft:textures/atlas/items.png-atlas
[19:25:40] [Render thread/INFO]: Created: 1024x1024x0 minecraft:textures/atlas/gui.png-atlas
[19:25:40] [Render thread/INFO]: Created: 128x64x0 minecraft:textures/atlas/map_decorations.png-atlas
[19:25:40] [Render thread/INFO]: Created: 512x256x0 minecraft:textures/atlas/signs.png-atlas
[19:25:40] [Render thread/INFO]: Created: 512x512x0 minecraft:textures/atlas/shulker_boxes.png-atlas
[19:25:43] [Render thread/INFO]: Stopping!

Environment

OS: Linux 7.0.3; Vulkan: 1.4.341

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media]

KikuGie

RogueLogix

Confirmed

Platform G

Important

Rendering

26.2 Snapshot 5

26.2 Pre-Release 3

Retrieved