Skip to content

Commit 801e12d

Browse files
Add ​Draw​Mesh​Attribs​Mtl for ​Metal mesh draw threadgroup sizes (API256016)
1 parent 75a6593 commit 801e12d

3 files changed

Lines changed: 77 additions & 13 deletions

File tree

Graphics/GraphicsEngine/interface/APIInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/// \file
3131
/// Diligent API information
3232

33-
#define DILIGENT_API_VERSION 256015
33+
#define DILIGENT_API_VERSION 256016
3434

3535
#include "../../../Primitives/interface/BasicTypes.h"
3636

Graphics/GraphicsEngine/interface/DeviceContext.h

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,56 @@ struct DrawIndexedIndirectAttribs
557557
typedef struct DrawIndexedIndirectAttribs DrawIndexedIndirectAttribs;
558558

559559

560+
/// Metal-specific mesh draw command attributes.
561+
struct DrawMeshAttribsMtl
562+
{
563+
/// Object thread group X size.
564+
Uint32 ObjectThreadGroupSizeX DEFAULT_INITIALIZER(0);
565+
566+
/// Object thread group Y size.
567+
Uint32 ObjectThreadGroupSizeY DEFAULT_INITIALIZER(0);
568+
569+
/// Object thread group Z size.
570+
Uint32 ObjectThreadGroupSizeZ DEFAULT_INITIALIZER(0);
571+
572+
/// Mesh thread group X size.
573+
Uint32 MeshThreadGroupSizeX DEFAULT_INITIALIZER(0);
574+
575+
/// Mesh thread group Y size.
576+
Uint32 MeshThreadGroupSizeY DEFAULT_INITIALIZER(0);
577+
578+
/// Mesh thread group Z size.
579+
Uint32 MeshThreadGroupSizeZ DEFAULT_INITIALIZER(0);
580+
581+
#if DILIGENT_CPP_INTERFACE
582+
constexpr DrawMeshAttribsMtl() noexcept {}
583+
584+
constexpr DrawMeshAttribsMtl(Uint32 _MeshThreadGroupSizeX,
585+
Uint32 _MeshThreadGroupSizeY,
586+
Uint32 _MeshThreadGroupSizeZ) noexcept :
587+
MeshThreadGroupSizeX{_MeshThreadGroupSizeX},
588+
MeshThreadGroupSizeY{_MeshThreadGroupSizeY},
589+
MeshThreadGroupSizeZ{_MeshThreadGroupSizeZ}
590+
{}
591+
592+
constexpr DrawMeshAttribsMtl(Uint32 _ObjectThreadGroupSizeX,
593+
Uint32 _ObjectThreadGroupSizeY,
594+
Uint32 _ObjectThreadGroupSizeZ,
595+
Uint32 _MeshThreadGroupSizeX,
596+
Uint32 _MeshThreadGroupSizeY,
597+
Uint32 _MeshThreadGroupSizeZ) noexcept :
598+
ObjectThreadGroupSizeX{_ObjectThreadGroupSizeX},
599+
ObjectThreadGroupSizeY{_ObjectThreadGroupSizeY},
600+
ObjectThreadGroupSizeZ{_ObjectThreadGroupSizeZ},
601+
MeshThreadGroupSizeX {_MeshThreadGroupSizeX },
602+
MeshThreadGroupSizeY {_MeshThreadGroupSizeY },
603+
MeshThreadGroupSizeZ {_MeshThreadGroupSizeZ }
604+
{}
605+
#endif
606+
};
607+
typedef struct DrawMeshAttribsMtl DrawMeshAttribsMtl;
608+
609+
560610
/// Defines the mesh draw command attributes.
561611

562612
/// This structure is used by IDeviceContext::DrawMesh().
@@ -574,32 +624,44 @@ struct DrawMeshAttribs
574624
/// Additional flags, see Diligent::DRAW_FLAGS.
575625
DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
576626

627+
/// Metal-specific mesh draw command attributes.
628+
///
629+
/// \remarks
630+
/// This member is only used by Metal backend and is ignored by others.
631+
const DrawMeshAttribsMtl* pMtlAttribs DEFAULT_INITIALIZER(nullptr);
632+
577633
#if DILIGENT_CPP_INTERFACE
578634
/// Initializes the structure members with default values.
579635
constexpr DrawMeshAttribs() noexcept {}
580636

581-
explicit constexpr DrawMeshAttribs(Uint32 _ThreadGroupCountX,
582-
DRAW_FLAGS _Flags = DRAW_FLAG_NONE) noexcept :
637+
explicit constexpr DrawMeshAttribs(Uint32 _ThreadGroupCountX,
638+
DRAW_FLAGS _Flags = DRAW_FLAG_NONE,
639+
const DrawMeshAttribsMtl* _pMtlAttribs = nullptr) noexcept :
583640
ThreadGroupCountX{_ThreadGroupCountX},
584-
Flags {_Flags}
641+
Flags {_Flags},
642+
pMtlAttribs {_pMtlAttribs}
585643
{}
586644

587-
constexpr DrawMeshAttribs(Uint32 _ThreadGroupCountX,
588-
Uint32 _ThreadGroupCountY,
589-
DRAW_FLAGS _Flags = DRAW_FLAG_NONE) noexcept :
645+
constexpr DrawMeshAttribs(Uint32 _ThreadGroupCountX,
646+
Uint32 _ThreadGroupCountY,
647+
DRAW_FLAGS _Flags = DRAW_FLAG_NONE,
648+
const DrawMeshAttribsMtl* _pMtlAttribs = nullptr) noexcept :
590649
ThreadGroupCountX{_ThreadGroupCountX},
591650
ThreadGroupCountY{_ThreadGroupCountY},
592-
Flags {_Flags}
651+
Flags {_Flags},
652+
pMtlAttribs {_pMtlAttribs}
593653
{}
594654

595-
constexpr DrawMeshAttribs(Uint32 _ThreadGroupCountX,
596-
Uint32 _ThreadGroupCountY,
597-
Uint32 _ThreadGroupCountZ,
598-
DRAW_FLAGS _Flags = DRAW_FLAG_NONE) noexcept :
655+
constexpr DrawMeshAttribs(Uint32 _ThreadGroupCountX,
656+
Uint32 _ThreadGroupCountY,
657+
Uint32 _ThreadGroupCountZ,
658+
DRAW_FLAGS _Flags = DRAW_FLAG_NONE,
659+
const DrawMeshAttribsMtl* _pMtlAttribs = nullptr) noexcept :
599660
ThreadGroupCountX{_ThreadGroupCountX},
600661
ThreadGroupCountY{_ThreadGroupCountY},
601662
ThreadGroupCountZ{_ThreadGroupCountZ},
602-
Flags {_Flags}
663+
Flags {_Flags},
664+
pMtlAttribs {_pMtlAttribs}
603665
{}
604666
#endif
605667
};

ReleaseHistory.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Current progress
44

5+
* Added `DrawMeshAttribsMtl` struct and `DrawMeshAttribs::pMtlAttribs` member (API256016)
6+
* `DrawMeshAttribsMtl` allows specifying Metal object and mesh thread group sizes for `IDeviceContext::DrawMesh()`
57
* Added `TextureUpdateOffsetAlignment` and `TextureUpdateStrideAlignment` members to `BufferProperties` struct (API256015)
68
* Added pipeline specialization constants (API256014)
79
* Added `SpecializationConstants` device feature

0 commit comments

Comments
 (0)