feat(d3d12): add indirect command execution support
Added ICommandSignature and D3D12CommandSignature for indirect command execution in the D3D12 backend, with supporting types. Updated ICommandBuffer and IGraphicsEngine interfaces to support indirect execution and command signature creation. Refactored command buffer pooling in D3D12GraphicsEngine for more flexible reuse. Changed BeginFrame and EndFrame to void and clarified parameter names. Updated resource and frame data structures to use direct buffer indices. Added RenderingUtility for buffer and texture uploads. Removed IRenderOutput interface. Updated RenderSystem render loop and HLSL/C# code to match new buffer usage patterns. BREAKING CHANGE: ICommandBuffer, IGraphicsEngine, and related APIs have changed signatures and behaviors. Indirect command execution is now supported and required for some advanced features.
This commit is contained in:
@@ -1017,6 +1017,124 @@ public struct CommandError
|
||||
}
|
||||
}
|
||||
|
||||
public struct IndirectArgumentDesc
|
||||
{
|
||||
public struct VertexBufferDesc
|
||||
{
|
||||
public uint Slot
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ConstantDesc
|
||||
{
|
||||
public uint RootParameterIndex
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public uint DestOffsetIn32BitValues
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public uint Num32BitValuesToSet
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ConstantBufferViewDesc
|
||||
{
|
||||
public uint RootParameterIndex
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ShaderResourceViewDesc
|
||||
{
|
||||
public uint RootParameterIndex
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
public struct UnorderedAccessViewDesc
|
||||
{
|
||||
public uint RootParameterIndex
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
public struct IncrementingConstantDesc
|
||||
{
|
||||
public uint RootParameterIndex
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public uint DestOffsetIn32BitValues
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
private struct __union
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public VertexBufferDesc vertexBuffer;
|
||||
[FieldOffset(0)]
|
||||
public ConstantDesc constant;
|
||||
[FieldOffset(0)]
|
||||
public ConstantBufferViewDesc constantBufferView;
|
||||
[FieldOffset(0)]
|
||||
public ShaderResourceViewDesc shaderResourceView;
|
||||
[FieldOffset(0)]
|
||||
public UnorderedAccessViewDesc unorderedAccessView;
|
||||
[FieldOffset(0)]
|
||||
public IncrementingConstantDesc incrementingConstant;
|
||||
}
|
||||
|
||||
public IndirectArgumentType Type
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
private __union _data;
|
||||
|
||||
[UnscopedRef]
|
||||
public ref VertexBufferDesc VertexBuffer => ref _data.vertexBuffer;
|
||||
|
||||
[UnscopedRef]
|
||||
public ref ConstantDesc Constant => ref _data.constant;
|
||||
|
||||
[UnscopedRef]
|
||||
public ref ConstantBufferViewDesc ConstantBufferView => ref _data.constantBufferView;
|
||||
|
||||
[UnscopedRef]
|
||||
public ref ShaderResourceViewDesc ShaderResourceView => ref _data.shaderResourceView;
|
||||
|
||||
[UnscopedRef]
|
||||
public ref UnorderedAccessViewDesc UnorderedAccessView => ref _data.unorderedAccessView;
|
||||
|
||||
[UnscopedRef]
|
||||
public ref IncrementingConstantDesc IncrementingConstant => ref _data.incrementingConstant;
|
||||
}
|
||||
|
||||
public ref struct CommandSignatureDesc
|
||||
{
|
||||
public uint Stride
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<IndirectArgumentDesc> Arguments
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SwapChainDesc
|
||||
{
|
||||
public uint Width
|
||||
@@ -1370,3 +1488,19 @@ public enum AttachmentStoreOp
|
||||
DontCare,
|
||||
NoAccess
|
||||
}
|
||||
|
||||
public enum IndirectArgumentType
|
||||
{
|
||||
Draw,
|
||||
DrawIndexed,
|
||||
Dispatch,
|
||||
VertexBufferView,
|
||||
IndexBufferView,
|
||||
Constant,
|
||||
ConstantBufferView,
|
||||
ShaderResourceView,
|
||||
UnorderedAccessView,
|
||||
DispatchRays,
|
||||
DispatchMesh,
|
||||
IncrementingConstant,
|
||||
}
|
||||
Reference in New Issue
Block a user