Skip to content

Commit

Permalink
Fix a couple failed assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
scallyw4g committed Aug 31, 2024
1 parent bcf989d commit 31824c1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// src/engine/render.cpp:1040:0
// src/engine/render.cpp:1041:0


link_internal void
Expand Down Expand Up @@ -39,6 +39,7 @@ SyncGpuBuffersAsync(engine_resources *Engine, lod_element_buffer *Meshes)
untextured_3d_geometry_buffer *Mesh = AtomicReplaceMesh( Meshes, MeshBit, 0, u64_MAX );
if (Mesh && Mesh->At)
{
Handles->Flags |= GpuHandles_UpdatePending;
PushReallocateBuffersCommand(&Engine->Stdlib.Plat.RenderQ, Handles, Mesh);
Result = True;
}
Expand Down
8 changes: 4 additions & 4 deletions src/engine/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ DoSelectonModification( engine_resources *Engine,
if (Intersect(PlaneN, SelectionState->ClickedP[0], MouseRay->Origin, MouseRay->Dir, &tRay))
{
v3 PlaneIntersect = MouseRay->Origin + (MouseRay->Dir*tRay);
DEBUG_HighlightVoxel(Engine, PlaneIntersect, RED);
/* DEBUG_HighlightVoxel(Engine, PlaneIntersect, RED); */
if (Input->LMB.Pressed)
{
SelectionState->ClickedP[1] = PlaneIntersect;
Expand All @@ -698,8 +698,8 @@ DoSelectonModification( engine_resources *Engine,
Result = ModifySelectionAABB(&SelectionAABB, V3i(UpdateVector), SelectionState->ClickedFace, SelectionMode);

{
DEBUG_HighlightVoxel(Engine, SelectionState->ClickedP[0], RED);
DEBUG_HighlightVoxel(Engine, SelectionState->ClickedP[1], BLUE);
/* DEBUG_HighlightVoxel(Engine, SelectionState->ClickedP[0], RED); */
/* DEBUG_HighlightVoxel(Engine, SelectionState->ClickedP[1], BLUE); */
DEBUG_DrawSimSpaceVectorAt(Engine, SelectionState->ClickedP[0], UpdateVector, GREEN);
}

Expand Down Expand Up @@ -1037,7 +1037,7 @@ CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, br
AllocateWorldChunk(Chunk, {}, RequiredLayerDim, Editor->Memory);
}

if (UpdateVoxels)
if (LengthSq(Chunk->Dim) > 0 && UpdateVoxels)
{
/* Info("Detected changes to settings, updating voxels. ReallocChunk(%b) SettingsChanged(%b)", ReallocChunk, SettingsChanged); */

Expand Down
1 change: 1 addition & 0 deletions src/engine/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ poof(
(buffer_t.name) *Mesh = AtomicReplaceMesh( Meshes, MeshBit, 0, u64_MAX );
if (Mesh && Mesh->At)
{
Handles->Flags |= GpuHandles_UpdatePending;
PushReallocateBuffersCommand(&Engine->Stdlib.Plat.RenderQ, Handles, Mesh);
Result = True;
}
Expand Down
1 change: 1 addition & 0 deletions src/engine/world_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3492,6 +3492,7 @@ QueueChunkForMeshRebuild(work_queue *Queue, world_chunk *Chunk, chunk_init_flags
TIMED_FUNCTION();

Assert(Chunk->Flags & Chunk_VoxelsInitialized);
Assert(LengthSq(Chunk->Dim) > 0);

// TODO(Jesse): Which of these is true?!
/* Assert((Chunk->Flags & Chunk_Queued) == 0); */
Expand Down

0 comments on commit 31824c1

Please sign in to comment.