🔍 Module Scanned
(automated audit scan)
📝 Summary
In , the variable is computed incorrectly at line 379. The condition marks ANY stone block below sea_level-1 as "underwater" even when it's inside a mountain that rises above sea level, causing wrong surface/filler blocks to be placed.
📍 Location
🔴 Severity: High
- High: Memory leaks, race conditions, incorrect rendering, broken features
💥 Impact
When terrain extends below sea level (e.g., a mountain from y=80 down to y=50), stone blocks at y=62 will be treated as "underwater" and get sand/gravel surface instead of normal surface blocks, even though the mountain top is above water. This causes visible artifacts: underwater terrain textures appearing on hillsides above water line, and incorrect filler block composition in underground sections of above-sea-level terrain.
🔎 Evidence
The loop iterates top-to-bottom. The variable already tracks what block is directly above the current position. When , there is genuinely water above and the block IS underwater. But is a global height check that doesn't account for mountains that pierce the water surface.
Example bug scenario:
- Mountain with surface at y=80, extending underground to y=50
- When filling at y=62 (inside mountain, but below 64): = = - but at y=60: = , so stone at y=60 gets "underwater" treatment even though might be (not water)
🛠️ Proposed Fix
Remove the incorrect height-based fallback. The check is sufficient:
The logic should ONLY use because:
- The loop processes top-to-bottom, so correctly reflects what sits above the current block
- If , the current block is genuinely submerged
- If or (etc), there's no water above regardless of global height
The original was likely trying to handle floating underwater caves or rock spires, but the correct solution is to rely on the per-block tracking.
✅ Acceptance Criteria
📚 References
🔍 Module Scanned
(automated audit scan)
📝 Summary
In , the variable is computed incorrectly at line 379. The condition marks ANY stone block below sea_level-1 as "underwater" even when it's inside a mountain that rises above sea level, causing wrong surface/filler blocks to be placed.
📍 Location
🔴 Severity: High
💥 Impact
When terrain extends below sea level (e.g., a mountain from y=80 down to y=50), stone blocks at y=62 will be treated as "underwater" and get sand/gravel surface instead of normal surface blocks, even though the mountain top is above water. This causes visible artifacts: underwater terrain textures appearing on hillsides above water line, and incorrect filler block composition in underground sections of above-sea-level terrain.
🔎 Evidence
The loop iterates top-to-bottom. The variable already tracks what block is directly above the current position. When , there is genuinely water above and the block IS underwater. But is a global height check that doesn't account for mountains that pierce the water surface.
Example bug scenario:
🛠️ Proposed Fix
Remove the incorrect height-based fallback. The check is sufficient:
The logic should ONLY use because:
The original was likely trying to handle floating underwater caves or rock spires, but the correct solution is to rely on the per-block tracking.
✅ Acceptance Criteria
Compiler: 0.16.0
assets/shaders/vulkan/water.frag
assets/shaders/vulkan/culling.comp
assets/shaders/vulkan/ui_tex.vert
assets/shaders/vulkan/shadow.vert
assets/shaders/vulkan/debug_shadow.frag
assets/shaders/vulkan/debug_shadow.vert
assets/shaders/vulkan/mesh.comp
assets/shaders/vulkan/water.vert
assets/shaders/vulkan/ssao.vert
assets/shaders/vulkan/terrain.vert
assets/shaders/vulkan/ui_tex.frag
assets/shaders/vulkan/terrain.frag
assets/shaders/vulkan/depth_pyramid.comp
assets/shaders/vulkan/ssao_blur.frag
assets/shaders/vulkan/ui.frag
assets/shaders/vulkan/shadow.frag
assets/shaders/vulkan/sky.frag
assets/shaders/vulkan/bloom_downsample.vert
assets/shaders/vulkan/bloom_upsample.vert
assets/shaders/vulkan/debug_shadow.vert
assets/shaders/vulkan/fxaa.vert
assets/shaders/vulkan/post_process.vert
assets/shaders/vulkan/shadow.vert
assets/shaders/vulkan/sky.vert
assets/shaders/vulkan/ssao.vert
assets/shaders/vulkan/taa.vert
assets/shaders/vulkan/terrain.vert
assets/shaders/vulkan/ui.vert
assets/shaders/vulkan/ui_tex.vert
assets/shaders/vulkan/water.vert
assets/shaders/vulkan/bloom_downsample.frag
assets/shaders/vulkan/bloom_upsample.frag
assets/shaders/vulkan/debug_shadow.frag
assets/shaders/vulkan/fxaa.frag
assets/shaders/vulkan/g_pass.frag
assets/shaders/vulkan/post_process.frag
assets/shaders/vulkan/shadow.frag
assets/shaders/vulkan/sky.frag
assets/shaders/vulkan/ssao.frag
assets/shaders/vulkan/ssao_blur.frag
assets/shaders/vulkan/taa.frag
assets/shaders/vulkan/terrain.frag
assets/shaders/vulkan/terrain_debug.frag
assets/shaders/vulkan/ui.frag
assets/shaders/vulkan/ui_tex.frag
assets/shaders/vulkan/water.frag
assets/shaders/vulkan/culling.comp
assets/shaders/vulkan/depth_pyramid.comp
assets/shaders/vulkan/lpv_inject.comp
assets/shaders/vulkan/lpv_propagate.comp
assets/shaders/vulkan/mesh.comp
assets/shaders/vulkan/taa.vert
assets/shaders/vulkan/g_pass.frag
assets/shaders/vulkan/sky.vert
assets/shaders/vulkan/taa.frag
assets/shaders/vulkan/ssao.frag
assets/shaders/vulkan/lpv_propagate.comp
assets/shaders/vulkan/lpv_inject.comp
assets/shaders/vulkan/ui.vert passes
📚 References