Уменьшение размер промежуточного буфера. Отчистка меша чанка, если тот пуст.
This commit is contained in:
@@ -83,6 +83,7 @@ coro<> ServerSession::asyncDestructor() {
|
|||||||
using namespace TOS;
|
using namespace TOS;
|
||||||
|
|
||||||
ServerSession::~ServerSession() {
|
ServerSession::~ServerSession() {
|
||||||
|
LOG.info() << "Destroyed";
|
||||||
}
|
}
|
||||||
|
|
||||||
coro<> ServerSession::asyncAuthorizeWithServer(tcp::socket &socket, const std::string username, const std::string token, int a_ar_r, std::function<void(const std::string&)> onProgress) {
|
coro<> ServerSession::asyncAuthorizeWithServer(tcp::socket &socket, const std::string username, const std::string token, int a_ar_r, std::function<void(const std::string&)> onProgress) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
class SharedStagingBuffer {
|
class SharedStagingBuffer {
|
||||||
public:
|
public:
|
||||||
static constexpr VkDeviceSize kDefaultSize = 64ull * 1024ull * 1024ull;
|
static constexpr VkDeviceSize kDefaultSize = 18ull * 1024ull * 1024ull;
|
||||||
|
|
||||||
SharedStagingBuffer(VkDevice device,
|
SharedStagingBuffer(VkDevice device,
|
||||||
VkPhysicalDevice physicalDevice,
|
VkPhysicalDevice physicalDevice,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <png++/png.hpp>
|
#include <png++/png.hpp>
|
||||||
#include "VulkanRenderSession.hpp"
|
#include "VulkanRenderSession.hpp"
|
||||||
#include <Server/GameServer.hpp>
|
#include <Server/GameServer.hpp>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
extern void LoadSymbolsVulkan(TOS::DynamicLibrary &library);
|
extern void LoadSymbolsVulkan(TOS::DynamicLibrary &library);
|
||||||
|
|
||||||
@@ -222,6 +223,8 @@ void Vulkan::run()
|
|||||||
} catch(const std::exception &exc) {
|
} catch(const std::exception &exc) {
|
||||||
LOG.error() << "Game.Session->shutdown: " << exc.what();
|
LOG.error() << "Game.Session->shutdown: " << exc.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Game.Session = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!NeedShutdown && glfwWindowShouldClose(Graphics.Window)) {
|
if(!NeedShutdown && glfwWindowShouldClose(Graphics.Window)) {
|
||||||
@@ -240,11 +243,12 @@ void Vulkan::run()
|
|||||||
try {
|
try {
|
||||||
if(Game.Session)
|
if(Game.Session)
|
||||||
Game.Session->shutdown(EnumDisconnect::ByInterface);
|
Game.Session->shutdown(EnumDisconnect::ByInterface);
|
||||||
Game.Session = nullptr;
|
|
||||||
} catch(const std::exception &exc) {
|
} catch(const std::exception &exc) {
|
||||||
LOG.error() << "Game.Session->shutdown: " << exc.what();
|
LOG.error() << "Game.Session->shutdown: " << exc.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Game.Session = nullptr;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(Game.Server)
|
if(Game.Server)
|
||||||
Game.Server->GS.shutdown("Завершение работы из-за остановки клиента");
|
Game.Server->GS.shutdown("Завершение работы из-за остановки клиента");
|
||||||
@@ -2254,6 +2258,10 @@ void Vulkan::gui_MainMenu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ImGui::Button("Memory trim")) {
|
||||||
|
malloc_trim(0);
|
||||||
|
}
|
||||||
|
|
||||||
if(ConnectionProgress.InProgress) {
|
if(ConnectionProgress.InProgress) {
|
||||||
if(ImGui::Button("Отмена"))
|
if(ImGui::Button("Отмена"))
|
||||||
ConnectionProgress.Cancel = true;
|
ConnectionProgress.Cancel = true;
|
||||||
@@ -2305,6 +2313,10 @@ void Vulkan::gui_ConnectedToServer() {
|
|||||||
Game.ImGuiInterfaces.pop_back();
|
Game.ImGuiInterfaces.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ImGui::Button("Memory trim")) {
|
||||||
|
malloc_trim(0);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
if(Game.Выйти)
|
if(Game.Выйти)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ struct DeviceId {
|
|||||||
struct Settings {
|
struct Settings {
|
||||||
DeviceId DeviceMain;
|
DeviceId DeviceMain;
|
||||||
uint32_t QueueGraphics = -1, QueueSurface = -1;
|
uint32_t QueueGraphics = -1, QueueSurface = -1;
|
||||||
bool Debug = true;
|
bool Debug = false;
|
||||||
|
|
||||||
bool isValid()
|
bool isValid()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ void ChunkMeshGenerator::run(uint8_t id) {
|
|||||||
} else {
|
} else {
|
||||||
for(int y = 0; y < 16; y++)
|
for(int y = 0; y < 16; y++)
|
||||||
for(int x = 0; x < 16; x++)
|
for(int x = 0; x < 16; x++)
|
||||||
fullNodes[x+0][y+1][0] = 0;
|
fullNodes[x+1][y+1][0] = 0;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
goto end;
|
goto end;
|
||||||
@@ -875,6 +875,7 @@ void ChunkPreparator::tickSync(const TickSyncData& data) {
|
|||||||
// Получаем готовые чанки
|
// Получаем готовые чанки
|
||||||
{
|
{
|
||||||
std::vector<ChunkMeshGenerator::ChunkObj_t> chunks = std::move(*CMG.Output.lock());
|
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) {
|
for(auto& chunk : chunks) {
|
||||||
auto iterWorld = Requests.find(chunk.WId);
|
auto iterWorld = Requests.find(chunk.WId);
|
||||||
if(iterWorld == Requests.end())
|
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()];
|
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);
|
rChunk.Voxels = std::move(chunk.VoxelDefines);
|
||||||
if(!chunk.VoxelVertexs.empty())
|
if(!chunk.VoxelVertexs.empty())
|
||||||
rChunk.VoxelPointer = VertexPool_Voxels.pushVertexs(std::move(chunk.VoxelVertexs));
|
rChunk.VoxelPointer = VertexPool_Voxels.pushVertexs(std::move(chunk.VoxelVertexs));
|
||||||
|
|||||||
@@ -224,7 +224,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
cb.Trs.apply(v);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user