Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain modded biomes may be too heavy for the default 512MB VRAM amount #20

Open
shadow7483147 opened this issue Apr 22, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@shadow7483147
Copy link

shadow7483147 commented Apr 22, 2023

Using a default installation of Gregtech New Horizons 2.3.2 (Java 17) in Prism Launcher, the game appears to constantly build more VRAM without letting any go. When it hits the maximum amount, all chunks get rebuilt.

It happens testing on a specific world seed, where you spawn in a BoP Coniferous Forest, exploring northwest towards the middle of it.

Triggering a chunk rebuild can be as simple as moving your view quickly in the opposite direction.

[20:41:06] [Client thread/INFO]: [CHAT] [§dneodymium§r/§cERROR§r] VRAM keeps getting full! Reverting to vanilla renderer. Try increasing the VRAM buffer size in the config, if possible.
[20:41:06] [Client thread/WARN] [neodymium]: Critical: Not enough VRAM
[20:41:06] [Client thread/WARN] [neodymium]: Critical: Neodymium has been disabled due to a critical incompatibility.
[20:41:23] [Client thread/INFO]: [CHAT] Seed: -2551839124501105014

This video was recorded before I isolated the problem to a standard installation & this specific world.
https://youtu.be/zpTipDM-xIA

By the way, it may help indicate to users if you log to the java console when a rebuild occurs due to vram exhaustion. That was the first place I looked when I discovered my world kept flashing out.

Looks like it settles around 800-1000MB in this biome.

@shadow7483147 shadow7483147 changed the title Certain modded biomes may be too heavy for the default VRAM amount Certain modded biomes may be too heavy for the default 512MB VRAM amount Apr 22, 2023
@makamys
Copy link
Owner

makamys commented Apr 22, 2023

I plan to make the VRAM buffer dynamically expand in the future, until then this kind of issue is inevitable. What's your render distance set to, by the way? The default value was selected assuming a 12 chunk render distance.

@shadow7483147
Copy link
Author

Render distance is 16 right now.

@makamys makamys added the enhancement New feature or request label Apr 22, 2023
@zeff9801
Copy link

zeff9801 commented Dec 7, 2023

I plan to make the VRAM buffer dynamically expand in the future, until then this kind of issue is inevitable. What's your render distance set to, by the way? The default value was selected assuming a 12 chunk render distance.

do you have any ideas on how I can retrieve the maximum available gpu vram without using external libraries?

@makamys
Copy link
Owner

makamys commented Dec 7, 2023

I've looked into it before and it seems there is no reliable way to do it, just some vendor-specific extensions. Allocating a buffer and checking for an error also doesn't seem to work: if I allocate one larger than my maximum, it succeeds but causes a crash later down the line. So the correct approach seems to be to allocate as much as you need and hope you don't run out.

Some solutions I've been pondering are:

  1. Destroy the buffer and allocate one larger by, say, 256 MB every time it gets full. Easy but would cause a lag spike when that happens.
  2. Have some kind of chunked approach where I allocate 256 MB "chunks" and if the last one gets full, I add another one. Probably better but harder to implement.
  3. The combination of 1+2. Since I render world regions separately now, I could also store their meshes in separate buffers, and expand those dynamically. Smaller buffers mean faster resizing (but smaller regions also mean more draw calls). This is more or less how Sodium does it.

I'm currently holding back on any major changes since the MEGA people are looking into hooking up some mod compat, but it's something I (we?) want to experiment with in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants