Bridge managed render funcs to command buffers

This commit is contained in:
2026-04-27 16:11:54 +08:00
parent 2e6643b4d1
commit 048ca7b362
10 changed files with 697 additions and 27 deletions

View File

@@ -246,9 +246,10 @@ Managed RenderGraph 目前有意保持较小,但应维持 Unity 的现代形
- Public passes 应声明 reads、bindings、color attachments、depth attachment 和 render func然后 `Commit`
- Internal fullscreen helpers例如 color scale、shader vector 和 final color是 URP implementation details。
不要把它们作为 public `ScriptableRenderContext` shortcuts 暴露。
- Managed `SetRenderFunc` 还不是完全 bridged native command buffer。它在 recording 时调用 managed render
func并把声明的 IO 记录进 native graph execution。不要添加依赖 managed commands 之后在 native command
list 上运行的行为。
- Managed `SetRenderFunc` 是 deferred RenderGraph execution callback。Mono bridge 必须 retain delegate
在 native graph pass 执行时创建 pass-scoped `CommandBuffer`,并把已支持的 managed command stream flush 到
当前 `RHICommandList`。当前公开且已测试的命令子集是 `CommandBuffer.ClearRenderTarget(Color)`,写向 pass
的 primary color attachment没有 native command stream 和 executor 测试的命令不要暴露成 public API。
- Public RenderGraph frame data 由同一个 renderer stage 内记录的所有 passes 共享。保持 `ContextContainer`
作为 stage frame data而不是 pass-local scratch data。
- Fullscreen internal passes 需要有效 `sourceColorTexture``primaryColorTarget`。Multi-pass fullscreen chains
@@ -316,7 +317,9 @@ Scene data 每个 camera frame 提取一次,然后由 pipeline 调整。
- Managed SRP 仍是 SRP v1 surface。Main scene drawing 通过 managed calls 记录,但由 native scene draw
backends 执行。
- Managed `CommandBuffer` public `SetRenderFunc` 还不会执行 deferred native command lists。
- Managed `CommandBuffer` 已能随 public `SetRenderFunc` 延迟到 RenderGraph 执行期运行,但当前只收口了
`ClearRenderTarget(Color)` 这一条受测命令。它不是完整 Unity `CommandBuffer`;新增命令必须一起补
native command stream、RHI flush 和 scripting bridge tests。
- Managed RenderGraph 当前暴露 raster authoring。Native graph 有 compute pass support但 managed compute
authoring 还未公开。
- `UniversalPostProcessBlock` 仍保留 post-process source promotion helper实际 post-process stage 由
@@ -344,6 +347,9 @@ Scene data 每个 camera frame 提取一次,然后由 pipeline 调整。
support probe 和 recording 各自重建 pass queue 的重复事实源。
- Public managed RenderGraph raster authoring 已存在internal fullscreen kernels 仍是 URP implementation
details。
- Public managed `SetRenderFunc` 已从 recording-time 调用改为 RenderGraph execution-time 调用;
native 通过 retained managed delegate 和 pass-scoped `CommandBuffer` bridge 执行已支持的 command stream
当前受测命令为 `CommandBuffer.ClearRenderTarget(Color)`
- Public `ScriptableRenderPass.RecordRenderGraph(RenderGraph, ContextContainer)` 通过 `RenderingData`
`CameraData``LightingData``ShadowData``EnvironmentData``FinalColorData``StageColorData`
接收真实 URP frame data。

View File

@@ -97,6 +97,11 @@ public:
MonoObject* GetExternalManagedObject(uint32_t gcHandle) const;
uint32_t RetainExternalManagedObjectReference(MonoObject* managedObject);
void ReleaseExternalManagedObject(uint32_t gcHandle);
void ReleaseRetainedManagedRenderFunc(uint32_t gcHandle);
bool InvokeManagedRenderGraphRasterFunc(
uint32_t gcHandle,
const char* passName,
uint64_t commandBufferHandle);
bool IsScriptableRenderPipelineAssetObject(MonoObject* managedObject) const;
bool TryEnsureManagedRenderPipelineAssetHandle(
Rendering::Pipelines::ManagedRenderPipelineAssetDescriptor& ioDescriptor);