2025-02-26 13:49:52 +08:00
|
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Rendering;
|
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DebugXCore.Internal
|
|
|
|
|
{
|
|
|
|
|
internal interface ICommandBufferExecutor
|
|
|
|
|
{
|
|
|
|
|
void Execute(CommandBuffer cb);
|
2025-02-28 09:47:18 +08:00
|
|
|
|
void Submit();
|
2025-02-26 13:49:52 +08:00
|
|
|
|
}
|
|
|
|
|
internal class CommandBufferExecutorSRP : ICommandBufferExecutor
|
|
|
|
|
{
|
|
|
|
|
[ThreadStatic]
|
|
|
|
|
private static CommandBufferExecutorSRP _instance = new CommandBufferExecutorSRP();
|
|
|
|
|
public static CommandBufferExecutorSRP GetInstance(ScriptableRenderContext context)
|
|
|
|
|
{
|
|
|
|
|
if (_instance == null) { _instance = new CommandBufferExecutorSRP(); }
|
|
|
|
|
_instance.RenderContext = context;
|
|
|
|
|
return _instance;
|
|
|
|
|
}
|
|
|
|
|
public ScriptableRenderContext RenderContext;
|
|
|
|
|
private CommandBufferExecutorSRP() { }
|
|
|
|
|
public void Execute(CommandBuffer cb)
|
|
|
|
|
{
|
|
|
|
|
RenderContext.ExecuteCommandBuffer(cb);
|
|
|
|
|
}
|
2025-02-28 09:47:18 +08:00
|
|
|
|
public void Submit()
|
|
|
|
|
{
|
|
|
|
|
RenderContext.Submit();
|
|
|
|
|
}
|
2025-02-26 13:49:52 +08:00
|
|
|
|
}
|
|
|
|
|
internal class CommandBufferExecutorBRP : ICommandBufferExecutor
|
|
|
|
|
{
|
|
|
|
|
[ThreadStatic]
|
|
|
|
|
private static CommandBufferExecutorBRP _instance = new CommandBufferExecutorBRP();
|
|
|
|
|
public static CommandBufferExecutorBRP GetInstance()
|
|
|
|
|
{
|
|
|
|
|
if (_instance == null) { _instance = new CommandBufferExecutorBRP(); }
|
|
|
|
|
return _instance;
|
|
|
|
|
}
|
|
|
|
|
private CommandBufferExecutorBRP() { }
|
|
|
|
|
public void Execute(CommandBuffer cb)
|
|
|
|
|
{
|
|
|
|
|
Graphics.ExecuteCommandBuffer(cb);
|
|
|
|
|
}
|
2025-02-28 09:47:18 +08:00
|
|
|
|
public void Submit() { }
|
2025-02-26 13:49:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|