资产浏览器可视化改造 + 材质缩略图 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:
2026-10-18 20:05:29 +08:00
parent 2df6e57b61
commit 84cf547704
25 changed files with 2105 additions and 380 deletions
+46
View File
@@ -0,0 +1,46 @@
//
// AssetItemView:资产条目的绘制单元(列表行 / 网格瓦片 / 目录 / 拖拽源 /
// tooltip)。Content Browser 与材质纹理选择器共用同一套视觉与交互。
//
#ifndef HELLOVULKAN_ASSETITEMVIEW_H
#define HELLOVULKAN_ASSETITEMVIEW_H
#include "EditorContext.h"
#include <filesystem>
#include <string>
namespace EditorAssetView {
// 单击 / 双击结果(调用方决定选中与打开语义)
struct ItemResult {
bool clicked = false;
bool doubleClicked = false;
};
// 拖拽源:按资产类别发出对应 payload(材质/控制器/预制体/模型/纹理)
void DrawDragSource(const std::filesystem::path& path,
const std::string& name);
// 统一 tooltip(类型/大小/修改时间/加载状态)
void DrawTooltip(const EditorContext& ctx,
const std::filesystem::path& path);
// 列表行:内联小缩略图 + 彩色短标签 + 类别色名称
ItemResult DrawRow(const EditorContext& ctx,
const std::filesystem::path& path, bool selected);
// 网格瓦片:缩略图/类别色占位块 + 名称(截断到瓦片宽)
ItemResult DrawTile(const EditorContext& ctx,
const std::filesystem::path& path,
float tileSize, bool selected);
// 目录(文件夹色):返回是否被点击(选中/进入)
bool DrawFolderRow(const std::filesystem::path& dir);
bool DrawFolderTile(const std::filesystem::path& dir, float tileSize,
bool selected);
} // namespace EditorAssetView
#endif //HELLOVULKAN_ASSETITEMVIEW_H