新新RHI#171
Draft
YXHXianYu wants to merge 98 commits into
Draft
Conversation
…iler 1. major refactor on rhi tranlation and sync 2. MoerProfiler 3. console variable support 4. some fatal error to fix in new implementation
- minor runtime change in RuntimeAssets.cpp to use a graphics CommandList copy scope, deferred callbacks for freeing image data, and include <functional>. - move all resource state prediction (before states) to preprocess (single thread)
Add preprocessing and plumbing to capture and forward source texture persistent state for present ops. Introduces PresentPreprocessResult and storage/lookup in ExecutePreprocessStore (present_results / present_lookup) with AddPresent/FindPresent; extends PresentInfo to carry source texture state and passes it into SubmissionPresentContext::Present. Add ResolveTextureSeedState and QueueToPassType to compute correct access/layout/stage (including presentable textures and owner queue) instead of hardcoded values, and seed the tracker from the preprocessed state. Also tighten persistent state updates to the specific mip/array layer and improve tracing logs to include mip/layer and owner queue information.
1. Updated checkpoint metadata in docs/checkpoints/submission_rework_checkpoints.json. 2. These edits introduce and wire up a TranslateTask abstraction, adjust submission executor logic (preprocess/translate/resolve/execute flow), sync/submit semantics, and present/ImGui handling as part of the larger submission rework and parallel translate effort.
Delete several outdated design/proposal documents
1. Rename and refactor Vulkan resource tracker and submission flow 2. Update call sites in VulkanQueue and present path to use EmitLocalTransition. 3. Rework submission assembly and execution decouple translate results from submit-time execution; attach present stages to parent submits; simplify runtime ops to SubmitInfo. Add VulkanTranslateTask::MakeFailed and improve translate error handling/logging. 4. Also update checkpoints JSON statuses to done.
Introduce event-based interrupt/sync design and split submission vs interrupt responsibilities. Add new runtime files, migrate sync semantics from serial/tail-based tracking to ordered GraphEvent-based snapshots. Update many Vulkan RHI sources and testscripts; add detailed design checkpoint docs and revise submission rework checkpoints. Purpose: converge sync semantics to SubmissionThread-owned rhi/present tails and task-local completion events so Sync/Flush return frozen GraphEvent snapshots and to clarify runtime file/ownership boundaries for submission vs retirement.
Add design checkpoints for async record / main-thread submit boundary and interrupt/payload simplification, and implement corresponding runtime changes. Key work: forbid worker-thread Submit/Sync/Present (RuntimeAssets split to record-only), defer bindless GPU init into explicit init/update commands, unify submission batch completion to a single GraphEvent-based contract, introduce RootRhiBoundary-style transport for root prerequisites, and consolidate interrupt enqueue into a payload-oriented task path.
move wait/signal resolve to submissionruntime, do it in deferred streaming manner
# Conflicts: # source/runtime/render/renderer/raster/RasterRenderer.cpp
- implement vulkan descriptor heap - implement rhi parallel translate
- add typed DUMP_STREAM schema API with TLS shard buffering and explicit flush - add binary file/TCP profile dump sinks with shared schema/record packets - add startup-readonly profile dump cvars and seal them after config load - route GPUEventStream and FlameProfiler output through the unified dump path - add focused RHI tests for readonly cvars, TLS flush and GPU dump integration
Co-authored-by: copilot-swe-agent[bot] Co-authored-by: Valer1ie
…rom the serial TranslatePipe (#151) * refactor: split translate scheduling from serial translate pipe Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/e190128d-a7c4-4e14-ba14-814577db5201 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * refactor: clarify async translate trace scopes Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/e190128d-a7c4-4e14-ba14-814577db5201 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
…tension wiring (#152) * refactor(rhi): 将插件系统由DeviceExtension重命名为RuntimePlugin,避免和VulkanApiExtension混淆 * refactor(rhi): 重构VulkanExtension,添加了专用ExtensionRegistry,便于添加和管理extension Vulkan extension 架构 1. 架构 - VulkanExtensionRegistry.cpp:维护所有 extension 描述表,是唯一登记入口。 - VulkanExtension.cpp:读取描述表,生成 instance/device extension 列表。 - VulkanExtensionFactories.cpp:放复杂 extension 的具体实现。 - 简单 extension 只写在 Registry 里;复杂 extension 再额外走 Factory。 2. 添加 extension - 先判断它是 Instance 还是 Device,是 required 还是 optional。 - 如果是简单 extension:直接在 VulkanExtensionRegistry.cpp 加一条 descriptor。 - 如果是复杂 extension: 在 VulkanExtensionFactories.cpp 里实现类和 factory, 然后在 VulkanExtensionRegistry.cpp 里把 descriptor 指到这个 factory。 - 如果它会影响 capability 或 pNext/feature/property,记得在复杂 extension 实现里补齐对应逻辑。 * refactor(rhi): 将nrd extension的extension文件夹重命名为plugin * feat(rhi): 添加Cooperative拓展相关代码,需要vulkan runtime >= 1.4 * fix(ui): 修复了ui修改near clip=0导致引擎崩溃的问题 * style: 隐藏了reateDevice时的第二次cvalidation layer大段输出 * feat(rhi/raster): 添加了Cooperative相关拓展的测试用例(无shader) * feat: 接入GPU Profiler * deps: 将DXCompiler更新到最新版本2026.02.20 * chore: 更新dxc构建配置,支持shader直接使用dxc自带HLSL头文件 * feat: 在RasterTool中添加了LogEverySecond工具函数,便于agent读取日志 * fix(ImageIO): 修复一处mipmap生成时的内存泄漏 * fix(scene): 添加了texture加载失败时的错误处理 * docs(profile): 添加了基本的profile模块预览图 * fix(rhi): 修复了CopyBufferToTexture命令参数错误的问题 * feat(raster): 添加了是否启用Bloom的开关 * feat(raster): 因为DXC不支持SPIR-V的CooperativeVector功能,所以暂时停止继续研究NeuralShader,封存与整理相关代码和UI * refactor: deprecate legacy profile module and restore Vulkan extension wiring Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/7720a588-9e88-47bc-8119-6ae1ed296b4a Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> --------- Co-authored-by: YXHXianYu <2943003@qq.com> Co-authored-by: yuio0801 <2632656591@qq.com> Co-authored-by: Xianhao Yu <32300960+YXHXianYu@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
* implement chase-lev taskgraph scheduler and regression script Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/14104d60-2c66-4aa0-9815-76f404d0d7d4 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * refine taskgraph regression helpers after review Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/14104d60-2c66-4aa0-9815-76f404d0d7d4 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * polish scheduler review nits Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/14104d60-2c66-4aa0-9815-76f404d0d7d4 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * deduplicate structured testcase marker reason Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/14104d60-2c66-4aa0-9815-76f404d0d7d4 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * rename derived scheduler priority variable Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/14104d60-2c66-4aa0-9815-76f404d0d7d4 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * add linux core-only test target and taskgraph shell script Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/76416451-b4b1-46c7-9ab9-9a6599256e9b Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * enable linux core-only taskgraph test path Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/76416451-b4b1-46c7-9ab9-9a6599256e9b Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * fix linux core-only taskgraph runtime issues Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/76416451-b4b1-46c7-9ab9-9a6599256e9b Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * polish linux core-only test path review fixes Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/76416451-b4b1-46c7-9ab9-9a6599256e9b Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * remove global core-only switch from linux test path Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/d5665335-3c69-4a2c-bd05-d97b5b99fc84 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> * finish removing global core-only isolation Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/d5665335-3c69-4a2c-bd05-d97b5b99fc84 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/be524209-e8f0-4e35-ad18-78e4fe9fd252 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/be524209-e8f0-4e35-ad18-78e4fe9fd252 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/be524209-e8f0-4e35-ad18-78e4fe9fd252 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/be524209-e8f0-4e35-ad18-78e4fe9fd252 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/be524209-e8f0-4e35-ad18-78e4fe9fd252 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NJUCG/MoerEngine/sessions/be524209-e8f0-4e35-ad18-78e4fe9fd252 Co-authored-by: Valer1ie <61175238+Valer1ie@users.noreply.github.com>
…tracking and profiler fix RenderGraph: - Add RGTextureStatesCompatible/RGBufferStatesMergeable state helpers - Add AliasReuse hazard flag for alias-initialized resource tracking - Rename RGTextureStateWrites to RGTextureStateInitializesContent (semantic) - Fix queue export to use src_state instead of state for correct barrier - Add debug resource renaming on queue import/export and pass transitions - Remove access_write from RGResourceCompileInfo (simplified tracking) - Clear alias_initial_state_ranges on transient resource release RHI (Vulkan): - Add DrainQueuedPayloadsForShutdown to flush pending payloads before interrupt thread stop, preventing lost completions on shutdown - Refine queue execution and GPU event stream handling Raytracing passes: - Adapt CompositionPass, GBufferPass, LightingPass, PreprocessLightPass to explicit barrier contracts - Update RTResource and RaytracingGraphResources for new state tracking - Add explicit TRANSFER_SRC/RENDER_TARGET barriers in RaytracingRenderer Profiler: - Add explicit TRANSFER_SRC->RENDER_TARGET barrier before RenderGUI - Add explicit RENDER_TARGET->TRANSFER_SRC barrier after RenderGUI - Fixes VUID-vkCmdBeginRendering-pRenderingInfo-09592 validation error where ProfilerOutput was left in TRANSFER_SRC_OPTIMAL by Present blit Tests: - Expand render graph contract tests for state merge and alias reuse - Add multi-queue translate tests for explicit barrier validation - Add test_profiler.ps1: build, launch, scan for Vulkan validation errors - Add profiler smoke test to test_all.ps1 suite Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merge strategy: - RHI/Vulkan/RenderGraph/Scene/RenderPass: dev_parallel_rhi (absolute priority) - Editor/MCP/Remote/Scripting/Profile: main - Build system (cmake/dxc/3rdparty): merged, adopting main's tools/cmake path and new dependencies (pybind11, python312, libhv) - volk: converted from submodule to regular directory (main's approach) Resolved conflicts in 52 files across: - Build: .gitignore, .gitmodules, CMakeLists.txt, dxc.cmake, NRD.cmake - Editor: Editor.cpp/h, EditorUI.cpp/h, RasterUI, CooperativeOpsUI - Engine: Engine.cpp/h with MCP/Remote integration - Profile: file location conflicts (source/profile -> source/profile_deprecated) - RHI: 17 files kept from dev (absolute priority for explicit barrier changes) - Scene: 6 files kept from dev - Render passes: 16 files kept from dev - Shader: Material.hlsli kept from dev Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fix ECS component rename (ecs::CTransform -> ecs::CNode) across all render/scene files. Replace dev split Scene files with main versions (SceneAccess, SceneQuery, SceneModify, SceneTickSync, SceneLifeCycle, SceneLoadInfoAsync). Fix LoaderInterface API changes, GpuScene Update signature, CName->CResourceName rename. Add LogicalScene helper methods for light direction/position. Fix RasterUI/RasterRenderer callback APIs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Restore Engine.cpp/h to dev version (Executor on main thread convention) - Restore Editor.cpp/h, EditorUI.cpp/h to dev versions (compatible hooks) - Add EditorUIStyle.h stub (removed in main's directory reorg) - Fix ScriptingModule clang (non-clang-cl) build: add _invalid_parameter stub and MSVC STL compatibility defines - Restore RasterUI/RasterRenderer to dev versions - Fix on_tick_ui(Scene&), ShowConfig() API migration in remaining files Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
VulkanSwapChain: - WaitFrameInFlight: replace vkWaitForFences/vkResetFences with RHIExecutor::Sync (GraphEventRef-based), removing direct VkFence access from the main thread. - CreateOrRecreate: replace vkResetFences on all in_flight_fences with destroy+recreate, keeping main thread VkFence-free. VulkanSubmissionRuntime: - WaitForReusablePresentSlot: replace busy-poll loop (vkGetFenceStatus + vkResetFences + sleep) with timeline->Wait() followed by a single vkResetFences on the SubmissionThread. The timeline is signaled by InterruptRuntime via ResolvePresentCompletion, so no race between threads. Result: 0 VUID-Threading-MultipleThreads, 0 VUID-fence-04894. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The CTransform->CNode merge introduced duplicate emplace<CNode> calls in Parser.cpp where the original emplace<CTransform> was replaced with emplace<CNode> alongside the existing emplace<CNode>. Since CNode now contains both hierarchy and transform data (main's refactoring), only one emplace is needed. - Parser.cpp: remove duplicate emplace<CNode> for root_node and child entities (was emplace<CTransform> before the rename) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The new RHI Executor guarantees GPU-side ordering between submits. Queue::Sync() (vkQueueWaitIdle) is redundant when: - Submit(FlushGPU) + fence->Wait(1) already waits for specific work - timeline->Wait(time) already waits for all frames up to time - Executor guarantees submit ordering and completion signalling Removed from: - ImGUIRenderer: transparent + font texture upload paths (2x) - RasterRenderer: shutdown timeline wait path (1x) - RaytracingRenderer: export path + shutdown path + DumpTextureToFile (3x) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Change default_render_method to Raster in MoerEngine.toml - AssetTool::UploadTextureData: add UNDEFINED->TRANSFER_DST and TRANSFER_DST->SAMPLED explicit barriers (Skip mode for cubemap slices) - AaPass: add explicit barriers for SMAA area/search texture uploads - Material.hlsli: add SampleTextureAndApplyFactor compat wrapper (main renamed GetTextureData, GeometryPassPixel uses the new name) - RasterUI: fix GetDefaultSelectedFrameBufferIndex string comparison (use wide String instead of std::string) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… and CSM shadow maps New RHI uses dynamic rendering; raster passes call BeginRendering directly and expect attachments to be in COLOR/DEPTH_ATTACHMENT_OPTIMAL layout. Frame-buffer textures and dynamically-created CSM shadow maps were left in UNDEFINED layout, causing VUID-vkCmdBeginRendering-pRenderingInfo-09592/09588 validation errors. - RasterTextures::AllocateFrameBuffers: transition all non-asset color/depth attachments from UNDEFINED to RENDER_TARGET / DEPTH_STENCIL_WRITE. Use whole-resource views for multi-mip textures. - ShadowDepthPass::PrepareCSMResources: transition newly-created shadow maps to DEPTH_STENCIL_WRITE before first use.
…e checkbox in UI - Set EditorConfig::camera_projection_override_enabled default to true so FOV/near/far sliders take effect immediately in both raster and raytracing renderers. - Add 'Override Projection' checkbox in EditorUI Camera panel. - Auto-enable override when FOV or clip sliders are edited.
…ut transitions - Re-enable the Output Frame Buffer selectable list in RasterUI so users can inspect base_color, normal, lighting_output, etc. - Convert texture names from PlatformString to UTF-8 for ImGui Selectable. - Transition the selected debug texture to SAMPLED before publishing it to the UI, then transition it back to a writable state after GUI rendering so the next frame can render into it again.
- Set base_color/metal_rough_ao alpha to 1.0 so debug output is not blended to black. - Fix SampleTextureAndApplyFactor missing-value semantics: pass identity (1.0) as missing value so fallback returns factor instead of factor^2. - Expand float4(metallic_roughness, material_ao, 0.0) to explicit components to avoid potential DXC/SPIR-V construction issues.
- 恢复 CullingPass 中被误删的 compute dispatch 前后 buffer barrier, 确保 culling 输出缓冲区(visible_instance_id_buf / draw_cmd_buf / counter_buf)正确同步到后续 indirect draw。 - 补充 CSM shadow map 在 Shadow Depth Pass 与 Shadow Mask Pass 之间的 layout transition,避免 validation error 和采样异常。
- EditorConfig 新增 render_resolution,区分窗口尺寸与场景渲染尺寸 - Renderer 基类同时持有 resolution(窗口)与 render_resolution(SceneColor) - RasterRenderer / RaytracingRenderer 使用 render_resolution 创建场景 framebuffer - output / combine_output 仍使用窗口尺寸,用于最终 GUI 合成与呈现 - EditorUI 将 SceneColor 面板实际尺寸同步给 EditorConfig 与 WindowInput - 修复相机 aspect ratio 使用 SceneColor 面板宽高比
7e2417f to
2553e9a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.