Unlock the mutex and fix formatting

This commit is contained in:
IntegratedQuantum 2025-07-29 21:45:46 +02:00
parent b57fa6666f
commit ec7f259cf6
3 changed files with 4 additions and 6 deletions

View File

@ -81,7 +81,6 @@ pub const ChannelChunk = struct {
};
pub fn getValue(self: *ChannelChunk, x: i32, y: i32, z: i32) [3]u8 {
self.lock.assertLockedRead();
const index = chunk.getIndex(x, y, z);
return self.data.getValue(index).toArray();
}

View File

@ -197,10 +197,6 @@ pub fn getLight(wx: i32, wy: i32, wz: i32) ?[6]u8 {
const x = (wx >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
const y = (wy >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
const z = (wz >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
mesh.lightingData[0].lock.lockRead();
defer mesh.lightingData[0].lock.unlockRead();
mesh.lightingData[1].lock.lockRead();
defer mesh.lightingData[1].lock.unlockRead();
return mesh.lightingData[1].getValue(x, y, z) ++ mesh.lightingData[0].getValue(x, y, z);
}

View File

@ -1261,7 +1261,10 @@ pub fn PaletteCompressedRegion(T: type, size: comptime_int) type { // MARK: Pale
var iNew: u32 = 0;
var iOld: u32 = 0;
const len: u32 = impl.paletteLength;
while(iOld < len) : ({iNew += 1; iOld += 1;}) outer: {
while(iOld < len) : ({
iNew += 1;
iOld += 1;
}) outer: {
while(impl.paletteOccupancy[iOld] == 0) {
iOld += 1;
if(iOld >= len) break :outer;