Hack fix bug when generating world with no chasms

Bug occured because we try to create an empty glNamedBufferStorage,
instead just create a dummy storage with space for one element.
This commit is contained in:
2026-02-25 20:07:19 +00:00
parent c2c139c8aa
commit 92891e291a
2 changed files with 32 additions and 31 deletions
+2 -1
View File
@@ -30,7 +30,8 @@ postWorldLoad rdata cw = do
glNamedBufferStorage newfloorbo (fromIntegral $ 8 * nfloorvxs * floatSize) floorptr 0
nchasmvxs <- foldM (pokeChasm chptr) 0 (cw ^. uvWorld . cWorld . chasms)
glBindBufferBase GL_SHADER_STORAGE_BUFFER 7 newchbo
glNamedBufferStorage newchbo (fromIntegral $ 2 * nchasmvxs * floatSize) chptr 0
glNamedBufferStorage newchbo (fromIntegral $ 2 * (max 1 nchasmvxs) * floatSize) chptr 0
-- note the max 1, prevents trying to create empty buffer storage
checkGLError "during postWorldLoad"
return $
cw & uvWorld . cWorld . numberFloorVerxs .~ nfloorvxs