*
This commit is contained in:
@@ -307,8 +307,14 @@ void ServerSession::atFreeDrawTime(GlobalTime gTime, float dTime) {
|
||||
if(RS && !changeOrAddList_removeList.empty()) {
|
||||
for(auto &pair : changeOrAddList_removeList) {
|
||||
// Если случится что чанк был изменён и удалён, то исключаем его обновления
|
||||
for(Pos::GlobalChunk removed : std::get<1>(pair.second))
|
||||
std::get<0>(pair.second).erase(removed);
|
||||
for(Pos::GlobalRegion removed : std::get<1>(pair.second)) {
|
||||
Pos::GlobalChunk pos = removed << 2;
|
||||
for(int z = 0; z < 4; z++)
|
||||
for(int y = 0; y < 4; y++)
|
||||
for(int x = 0; x < 4; x++) {
|
||||
std::get<0>(pair.second).erase(pos+Pos::GlobalChunk(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
RS->onChunksChange(pair.first, std::get<0>(pair.second), std::get<1>(pair.second));
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
return {0, 0, 0};
|
||||
|
||||
// Необходимое количество блоков
|
||||
uint16_t blocks = data.size() / size_t(PerBlock);
|
||||
uint16_t blocks = (data.size()+PerBlock-1) / PerBlock;
|
||||
assert(blocks <= PerPool);
|
||||
|
||||
// Нужно найти пулл в котором будет свободно blocks количество блоков или создать новый
|
||||
@@ -112,13 +112,17 @@ public:
|
||||
Pool &pool = Pools[iterPool];
|
||||
size_t pos = pool.Allocation._Find_first();
|
||||
|
||||
if(pos == PerPool)
|
||||
continue;
|
||||
|
||||
while(true) {
|
||||
int countEmpty = 1;
|
||||
for(size_t pos2 = pos+1; pos2 < PerPool && pool.Allocation.test(pos2) && countEmpty < blocks; pos2++, countEmpty++);
|
||||
|
||||
if(countEmpty == blocks) {
|
||||
for(int block = 0; block < blocks; block++)
|
||||
for(int block = 0; block < blocks; block++) {
|
||||
pool.Allocation.reset(pos+block);
|
||||
}
|
||||
|
||||
size_t count = data.size();
|
||||
pushData(std::move(data), iterPool, pos);
|
||||
@@ -245,6 +249,8 @@ public:
|
||||
task.Data.size()*sizeof(Vertex)
|
||||
};
|
||||
|
||||
assert(copyRegion.dstOffset+copyRegion.size < sizeof(Vertex)*PerBlock*PerPool);
|
||||
|
||||
vkCmdCopyBuffer(commandBuffer, HostCoherent.getBuffer(), Pools[task.PoolId].DeviceBuff.getBuffer(),
|
||||
1, ©Region);
|
||||
|
||||
|
||||
@@ -617,6 +617,12 @@ void VulkanRenderSession::onChunksChange(WorldId_t worldId, const std::unordered
|
||||
auto &table = External.ChunkVoxelMesh[worldId];
|
||||
|
||||
for(Pos::GlobalChunk pos : changeOrAddList) {
|
||||
if(pos.y < 0) {
|
||||
int g = 0;
|
||||
g++;
|
||||
}
|
||||
|
||||
|
||||
Pos::GlobalRegion rPos = pos >> 2;
|
||||
Pos::bvec4u cPos = pos & 0x3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user