添加多模型渲染,添加贴图渲染,添加平行光, 暂时不上传assets
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Engine {
|
||||
|
||||
#define ENGINE_TRACE(...) ::spdlog::trace(__VA_ARGS__)
|
||||
#define ENGINE_INFO(...) ::spdlog::info(__VA_ARGS__)
|
||||
#define ENGINE_DEBUG(...) ::spdlog::debug(__VA_ARGS__)
|
||||
#define ENGINE_WARN(...) ::spdlog::warn(__VA_ARGS__)
|
||||
#define ENGINE_ERROR(...) ::spdlog::error(__VA_ARGS__)
|
||||
#define ENGINE_FATAL(...) ::spdlog::critical(__VA_ARGS__)
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// Created by atdunbg on 2026/9/21.
|
||||
//
|
||||
|
||||
#ifndef HELLOVULKAN_STATS_H
|
||||
#define HELLOVULKAN_STATS_H
|
||||
|
||||
|
||||
#include <Engine/Core/Types.h>
|
||||
#include <mutex>
|
||||
|
||||
namespace Engine
|
||||
{
|
||||
class Stats
|
||||
{
|
||||
public:
|
||||
static Stats& Get();
|
||||
|
||||
// ---- Engine 自己管理的 GPU 内存 ----
|
||||
void AddTexture(u64 bytes);
|
||||
void RemoveTexture(u64 bytes);
|
||||
|
||||
void AddMesh(u64 vertexBytes, u64 indexBytes);
|
||||
void RemoveMesh(u64 vertexBytes, u64 indexBytes);
|
||||
|
||||
void AddBuffer(u64 bytes);
|
||||
void RemoveBuffer(u64 bytes);
|
||||
|
||||
void AddMemoryBlock(u64 bytes);
|
||||
void RemoveMemoryBlock(u64 bytes);
|
||||
void AddMemoryUsed(u64 bytes);
|
||||
void RemoveMemoryUsed(u64 bytes);
|
||||
|
||||
// ---- 每帧统计 ----
|
||||
void BeginFrame();
|
||||
void EndFrame();
|
||||
void AddAllocation(u64 bytes);
|
||||
void AddDeallocation(u64 bytes);
|
||||
|
||||
// ---- 采样进程真实内存 ----
|
||||
void SampleProcessMemory();
|
||||
|
||||
// ---- 打印 ----
|
||||
void Print() const;
|
||||
void PrintDetailed() const;
|
||||
void PrintComparison() const;
|
||||
|
||||
private:
|
||||
Stats() = default;
|
||||
|
||||
struct ProcessMemory
|
||||
{
|
||||
u64 VmSize = 0; // /proc/self/status VmSize
|
||||
u64 Rss = 0; // /proc/self/status VmRSS
|
||||
u64 Pss = 0; // smaps_rollup
|
||||
u64 SharedClean = 0;
|
||||
u64 PrivateDirty = 0;
|
||||
u64 PrivateClean = 0;
|
||||
};
|
||||
|
||||
ProcessMemory ReadProcessMemory() const;
|
||||
|
||||
mutable std::mutex m_Mutex;
|
||||
|
||||
// 资源计数
|
||||
u64 m_TextureCount = 0;
|
||||
u64 m_TextureBytes = 0;
|
||||
|
||||
u64 m_MeshCount = 0;
|
||||
u64 m_MeshBytes = 0;
|
||||
|
||||
u64 m_BufferCount = 0;
|
||||
u64 m_BufferBytes = 0;
|
||||
|
||||
// MemoryAllocator
|
||||
u64 m_MemoryBlockBytes = 0;
|
||||
u64 m_MemoryUsedBytes = 0;
|
||||
|
||||
// 每帧
|
||||
u64 m_FrameAllocation = 0;
|
||||
u64 m_FrameDeallocation = 0;
|
||||
u64 m_TotalAllocation = 0;
|
||||
u64 m_TotalDeallocation = 0;
|
||||
|
||||
// 进程快照
|
||||
ProcessMemory m_ProcessMem{};
|
||||
};
|
||||
|
||||
#define STATS Engine::Stats::Get()
|
||||
} // namespace Engine
|
||||
|
||||
#endif //HELLOVULKAN_STATS_H
|
||||
@@ -38,11 +38,26 @@ namespace Engine {
|
||||
// 需要的 Vulkan 扩展(GLFW 提供)
|
||||
static std::vector<const char*> GetRequiredExtensions();
|
||||
|
||||
// 窗口事件
|
||||
void GetFramebufferSize(int& width, int& height) const;
|
||||
bool WasResized() const { return m_FramebufferResized; }
|
||||
void ResetResizedFlag() { m_FramebufferResized = false; }
|
||||
|
||||
// 输入事件系统
|
||||
|
||||
bool IsKeyPressed(int key) const;
|
||||
void GetMouseDelta(float& dx, float& dy);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
GLFWwindow* m_Window = nullptr;
|
||||
u32 m_Width;
|
||||
u32 m_Height;
|
||||
std::string m_Title;
|
||||
|
||||
bool m_FramebufferResized = false;
|
||||
static void FramebufferResizeCallback(GLFWwindow* window, int width, int height);
|
||||
};
|
||||
|
||||
} // namespace Engine
|
||||
|
||||
Reference in New Issue
Block a user