diff --git a/src/AcDream.App/Rendering/IndoorCellStencilPipeline.cs b/src/AcDream.App/Rendering/IndoorCellStencilPipeline.cs index 0f113d8..605309d 100644 --- a/src/AcDream.App/Rendering/IndoorCellStencilPipeline.cs +++ b/src/AcDream.App/Rendering/IndoorCellStencilPipeline.cs @@ -99,8 +99,8 @@ public sealed unsafe class IndoorCellStencilPipeline : IDisposable private readonly uint _vbo; private int _vboCapacityVerts; private int _lastVertexCount; - private int _uViewProjectionLoc; - private int _uWriteFarDepthLoc; + private readonly int _uViewProjectionLoc; + private readonly int _uWriteFarDepthLoc; public IndoorCellStencilPipeline(GL gl, string vertPath, string fragPath) { @@ -153,6 +153,7 @@ public sealed unsafe class IndoorCellStencilPipeline : IDisposable if (_lastVertexCount == 0) return; _gl.Enable(EnableCap.StencilTest); + _gl.Enable(EnableCap.DepthTest); // idempotent if already on; makes MarkAndPunch self-contained _gl.ClearStencil(0); _gl.Clear(ClearBufferMask.StencilBufferBit); @@ -227,6 +228,9 @@ public sealed unsafe class IndoorCellStencilPipeline : IDisposable _gl.DeleteBuffer(_vbo); } + // Safe to call mid-session after ConfigureVao — the VAO bakes the + // VBO association at VertexAttribPointer time, so reallocating the + // VBO with new size does NOT require re-running ConfigureVao. private void AllocateVbo(int capacityVerts) { _vboCapacityVerts = capacityVerts;