资产浏览器可视化改造 + 材质缩略图 GPU 烘焙 + 纹理上传批式化
- 资产浏览器可视化与配色:面板重构(网格/列表/缩略图)、AssetKind 分类、 EditorColors 统一配色、AssetItemView 抽出条目绘制;HierarchyPanel/ MaterialEditorPanel 同步调整 - 材质缩略图改走 GPU 回读烘焙:MaterialPreviewPass 新增 bake pass (SDR atlas → host staging copyImageToBuffer)、Renderer 提供 Request/PollMaterialPreviewBake(无 waitIdle,依赖 per-slot fence), Editor 每帧排空后注入 ThumbnailCache——脱离预览 tile 池,消除"滚出视野 即失效/池耗尽"两问题 - 缩略图失效:BakedIdentity(serial, editVersion) 与当前材质身份比对, 换贴图槽(重载新 serial)/调参数(editVersion++)不符即 Invalidate 重烘, 修"修改材质后资产浏览器缩略图不更新" - 材质加载闸门:每帧至多 1 个 + 按实测耗时冷却,替代固定 2/帧 - 纹理上传批式化:VulkanAssetUploader 新增路径纹理缓存(跨材质去重, 同一贴图只解码/上传一次)+ 同批新纹理合并为单 cmd/单 submit/单 fence; Texture 抽出 RecordPixelsUpload/CreateDeferred/ReleasePendingStaging, 析构兜底释放 staging;MaterialAsset 纹理所有权移交 uploader 缓存—— 修大材质目录首次打开卡顿
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
//
|
||||
|
||||
#include "Editor.h"
|
||||
#include "ThumbnailCache.h" // 缩略图缓存(每帧 BeginFrame)
|
||||
#include "panels/AssetBrowserPanel.h"
|
||||
#include "panels/HierarchyPanel.h"
|
||||
#include "panels/InspectorPanel.h"
|
||||
@@ -167,6 +168,24 @@ void Editor::TogglePause()
|
||||
|
||||
void Editor::Draw()
|
||||
{
|
||||
// 缩略图缓存推进(解码限量 / 上传就绪 / LRU 淘汰):ImGui::NewFrame
|
||||
// 已由框架 ImGuiLayer 完成,此处处于面板绘制之前
|
||||
EditorThumbnailCache::Get().BeginFrame();
|
||||
|
||||
// 材质球缩略图烘焙:排空引擎异步回读结果 → 注入缩略图缓存(浏览器
|
||||
// 材质条目随后从缓存出图,不再占用引擎预览 tile 池)
|
||||
if (m_Ctx.renderer)
|
||||
{
|
||||
Engine::u64 key = 0;
|
||||
std::vector<unsigned char> pixels;
|
||||
Engine::u32 w = 0, h = 0;
|
||||
while (m_Ctx.renderer->PollMaterialPreviewBake(key, pixels, w, h))
|
||||
{
|
||||
EditorThumbnailCache::Get().CompleteBake(
|
||||
key, pixels.data(), static_cast<int>(w), static_cast<int>(h));
|
||||
}
|
||||
}
|
||||
|
||||
// PIE 镜像同步(面板只读指针消费;权威 = GameFlow,此处适配)
|
||||
if (m_Ctx.flow)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user