Уменьшение размер промежуточного буфера. Отчистка меша чанка, если тот пуст.

This commit is contained in:
2026-01-28 22:46:35 +03:00
parent da673b0965
commit 07ccd4dd68
6 changed files with 28 additions and 5 deletions

View File

@@ -16,7 +16,7 @@
class SharedStagingBuffer {
public:
static constexpr VkDeviceSize kDefaultSize = 64ull * 1024ull * 1024ull;
static constexpr VkDeviceSize kDefaultSize = 18ull * 1024ull * 1024ull;
SharedStagingBuffer(VkDevice device,
VkPhysicalDevice physicalDevice,

View File

@@ -29,6 +29,7 @@
#include <png++/png.hpp>
#include "VulkanRenderSession.hpp"
#include <Server/GameServer.hpp>
#include <malloc.h>
extern void LoadSymbolsVulkan(TOS::DynamicLibrary &library);
@@ -222,6 +223,8 @@ void Vulkan::run()
} catch(const std::exception &exc) {
LOG.error() << "Game.Session->shutdown: " << exc.what();
}
Game.Session = nullptr;
}
if(!NeedShutdown && glfwWindowShouldClose(Graphics.Window)) {
@@ -240,11 +243,12 @@ void Vulkan::run()
try {
if(Game.Session)
Game.Session->shutdown(EnumDisconnect::ByInterface);
Game.Session = nullptr;
} catch(const std::exception &exc) {
LOG.error() << "Game.Session->shutdown: " << exc.what();
}
Game.Session = nullptr;
try {
if(Game.Server)
Game.Server->GS.shutdown("Завершение работы из-за остановки клиента");
@@ -2254,6 +2258,10 @@ void Vulkan::gui_MainMenu() {
}
}
if(ImGui::Button("Memory trim")) {
malloc_trim(0);
}
if(ConnectionProgress.InProgress) {
if(ImGui::Button("Отмена"))
ConnectionProgress.Cancel = true;
@@ -2305,6 +2313,10 @@ void Vulkan::gui_ConnectedToServer() {
Game.ImGuiInterfaces.pop_back();
}
if(ImGui::Button("Memory trim")) {
malloc_trim(0);
}
ImGui::End();
if(Game.Выйти)

View File

@@ -48,7 +48,7 @@ struct DeviceId {
struct Settings {
DeviceId DeviceMain;
uint32_t QueueGraphics = -1, QueueSurface = -1;
bool Debug = true;
bool Debug = false;
bool isValid()
{

View File

@@ -317,7 +317,7 @@ void ChunkMeshGenerator::run(uint8_t id) {
} else {
for(int y = 0; y < 16; y++)
for(int x = 0; x < 16; x++)
fullNodes[x+0][y+1][0] = 0;
fullNodes[x+1][y+1][0] = 0;
}
} else
goto end;
@@ -875,6 +875,7 @@ void ChunkPreparator::tickSync(const TickSyncData& data) {
// Получаем готовые чанки
{
std::vector<ChunkMeshGenerator::ChunkObj_t> chunks = std::move(*CMG.Output.lock());
uint8_t frameRetirement = (FrameRoulette+FRAME_COUNT_RESOURCE_LATENCY) % FRAME_COUNT_RESOURCE_LATENCY;
for(auto& chunk : chunks) {
auto iterWorld = Requests.find(chunk.WId);
if(iterWorld == Requests.end())
@@ -889,6 +890,14 @@ void ChunkPreparator::tickSync(const TickSyncData& data) {
// Чанк ожидаем
auto& rChunk = ChunksMesh[chunk.WId][chunk.Pos >> 2][Pos::bvec4u(chunk.Pos & 0x3).pack()];
if(rChunk.VoxelPointer)
VPV_ToFree[frameRetirement].emplace_back(std::move(rChunk.VoxelPointer));
if(rChunk.NodePointer) {
VPN_ToFree[frameRetirement].emplace_back(std::move(rChunk.NodePointer), std::move(rChunk.NodeIndexes));
}
rChunk.VoxelPointer = {};
rChunk.NodePointer = {};
rChunk.NodeIndexes = {};
rChunk.Voxels = std::move(chunk.VoxelDefines);
if(!chunk.VoxelVertexs.empty())
rChunk.VoxelPointer = VertexPool_Voxels.pushVertexs(std::move(chunk.VoxelVertexs));

View File

@@ -224,7 +224,8 @@ public:
}
cb.Trs.apply(v);
model.Vertecies[params.Cullface].append_range(v);
const EnumFace cullKey = (params.Cullface == EnumFace::None) ? face : params.Cullface;
model.Vertecies[cullKey].append_range(v);
}
}