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

@@ -373,17 +373,12 @@ namespace XCEngine.Rendering
break;
case RenderGraphRasterPassExecutionKind
.ManagedRenderFunc:
// Managed command buffers are not bridged into native
// graph execution yet, so the render func is invoked
// during recording while native records the declared IO.
m_renderFunc(
new RenderGraphRasterContext(
new CommandBuffer(m_passName)));
configuredExecution =
InternalCalls
.Rendering_ScriptableRenderContext_SetRasterPassManagedRenderFuncExecution(
m_context.nativeHandle,
nativePassHandle);
nativePassHandle,
m_renderFunc);
break;
default:
configuredExecution = false;
@@ -501,5 +496,24 @@ namespace XCEngine.Rendering
return false;
}
internal static bool InvokeManagedRenderFunc(
Action<RenderGraphRasterContext> renderFunc,
string passName,
ulong commandBufferHandle)
{
if (renderFunc == null ||
commandBufferHandle == 0ul)
{
return false;
}
renderFunc(
new RenderGraphRasterContext(
new CommandBuffer(
passName,
commandBufferHandle)));
return true;
}
}
}