From 267986a28959ec1b7dbf933437b3f06b9587915c Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Tue, 29 Jul 2025 15:20:22 +0100 Subject: [PATCH] fix volatile buffer change debugdraw to use volatile fix volatile buffer wraparound --- Engine/source/gfx/gl/gfxGLCircularVolatileBuffer.h | 4 ++-- Engine/source/navigation/duDebugDrawTorque.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Engine/source/gfx/gl/gfxGLCircularVolatileBuffer.h b/Engine/source/gfx/gl/gfxGLCircularVolatileBuffer.h index 4396709ee..1212bed2e 100644 --- a/Engine/source/gfx/gl/gfxGLCircularVolatileBuffer.h +++ b/Engine/source/gfx/gl/gfxGLCircularVolatileBuffer.h @@ -201,6 +201,8 @@ public: if (mBufferFreePos < mBufferSize) mUsedRanges.push_back(UsedRange(mBufferFreePos, mBufferSize - 1)); + init(); + // Reset free pos mBufferFreePos = 0; @@ -224,8 +226,6 @@ public: if (GFXGL->mCapabilities.bufferStorage) { outPtr = static_cast(mBufferPtr) + mBufferFreePos; - _getBufferData.mOffset = outOffset; - _getBufferData.mSize = size; } else if (GFXGL->glUseMap()) { diff --git a/Engine/source/navigation/duDebugDrawTorque.cpp b/Engine/source/navigation/duDebugDrawTorque.cpp index 570908c8f..1239e6b22 100644 --- a/Engine/source/navigation/duDebugDrawTorque.cpp +++ b/Engine/source/navigation/duDebugDrawTorque.cpp @@ -245,7 +245,7 @@ void duDebugDrawTorque::end() box.maxExtents.set(-F32_MAX, -F32_MAX, -F32_MAX); GFXVertexBufferHandle buffer; - buffer.set(GFX, batchVerts, GFXBufferTypeStatic); + buffer.set(GFX, batchVerts, GFXBufferTypeVolatile); GFXVertexPCT* verts = buffer.lock(); for (U32 i = 0; i < linesThisBatch * vertsPerLine; ++i) @@ -258,7 +258,7 @@ void duDebugDrawTorque::end() // --- Build index buffer GFXPrimitiveBufferHandle pb; - pb.set(GFX, linesThisBatch * 2, linesThisBatch, GFXBufferTypeStatic); + pb.set(GFX, linesThisBatch * 2, linesThisBatch, GFXBufferTypeVolatile); U16* indices = nullptr; pb.lock(&indices); @@ -303,7 +303,7 @@ void duDebugDrawTorque::end() box.maxExtents.set(-F32_MAX, -F32_MAX, -F32_MAX); GFXVertexBufferHandle buffer; - buffer.set(GFX, batchVerts, GFXBufferTypeStatic); + buffer.set(GFX, batchVerts, GFXBufferTypeVolatile); GFXVertexPCT* verts = buffer.lock(); for (U32 i = 0; i < trisThisBatch * vertsPerTri; ++i) @@ -317,7 +317,7 @@ void duDebugDrawTorque::end() // --- Build index buffer GFXPrimitiveBufferHandle pb; - pb.set(GFX, trisThisBatch*3, trisThisBatch, GFXBufferTypeStatic); + pb.set(GFX, trisThisBatch*3, trisThisBatch, GFXBufferTypeVolatile); U16* indices = nullptr; pb.lock(&indices); @@ -363,7 +363,7 @@ void duDebugDrawTorque::end() box.maxExtents.set(-F32_MAX, -F32_MAX, -F32_MAX); GFXVertexBufferHandle buffer; - buffer.set(GFX, batchVerts, GFXBufferTypeStatic); + buffer.set(GFX, batchVerts, GFXBufferTypeVolatile); GFXVertexPCT* verts = buffer.lock(); U32 outIdx = 0; @@ -383,7 +383,7 @@ void duDebugDrawTorque::end() buffer.unlock(); GFXPrimitiveBufferHandle pb; - pb.set(GFX, batchIndices, quadsThisBatch*2, GFXBufferTypeStatic); + pb.set(GFX, batchIndices, quadsThisBatch*2, GFXBufferTypeVolatile); U16* indices = nullptr; pb.lock(&indices);