Skip to content

Commit 48b2432

Browse files
Added macros for API constants (#393)
1 parent f3bf2b6 commit 48b2432

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

Graphics/GraphicsEngine/interface/BottomLevelAS.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ static const INTERFACE_ID IID_BottomLevelAS =
4444

4545
// clang-format off
4646

47-
static const Uint32 INVALID_INDEX = ~0u;
47+
#define DILIGENT_INVALID_INDEX 0xFFFFFFFFU
4848

49+
static const Uint32 INVALID_INDEX = DILIGENT_INVALID_INDEX;
4950

5051
/// Defines bottom level acceleration structure triangles description.
5152

Graphics/GraphicsEngine/interface/Constants.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ DILIGENT_BEGIN_NAMESPACE(Diligent)
5050
/// The maximum number of queues in graphics adapter description.
5151
#define DILIGENT_MAX_ADAPTER_QUEUES 16
5252

53+
/// The special constant for a default adapter index.
54+
#define DILIGENT_DEFAULT_ADAPTER_ID 0xFFFFFFFFU
55+
56+
/// The special constant for a default queue index.
57+
#define DILIGENT_DEFAULT_QUEUE_ID 0xFF
58+
5359
/// The maximum number of shading rate modes.
5460
#define DILIGENT_MAX_SHADING_RATES 9
5561

@@ -61,8 +67,8 @@ static const Uint32 MAX_RENDER_TARGETS = DILIGENT_MAX_RENDER_TARGETS;
6167
static const Uint32 MAX_VIEWPORTS = DILIGENT_MAX_VIEWPORTS;
6268
static const Uint32 MAX_RESOURCE_SIGNATURES = DILIGENT_MAX_RESOURCE_SIGNATURES;
6369
static const Uint32 MAX_ADAPTER_QUEUES = DILIGENT_MAX_ADAPTER_QUEUES;
64-
static const Uint32 DEFAULT_ADAPTER_ID = 0xFFFFFFFFU;
65-
static const Uint8 DEFAULT_QUEUE_ID = 0xFF;
70+
static const Uint32 DEFAULT_ADAPTER_ID = DILIGENT_DEFAULT_ADAPTER_ID;
71+
static const Uint8 DEFAULT_QUEUE_ID = DILIGENT_DEFAULT_QUEUE_ID;
6672
static const Uint32 MAX_SHADING_RATES = DILIGENT_MAX_SHADING_RATES;
6773
static const Uint32 SHADING_RATE_X_SHIFT = DILIGENT_SHADING_RATE_X_SHIFT;
6874

Graphics/GraphicsEngine/interface/DeviceContext.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,9 +1861,14 @@ struct BindSparseResourceMemoryAttribs
18611861
};
18621862
typedef struct BindSparseResourceMemoryAttribs BindSparseResourceMemoryAttribs;
18631863

1864+
/// The special constant for all remaining mipmap levels.
1865+
#define DILIGENT_REMAINING_MIP_LEVELS 0xFFFFFFFFU
18641866

1865-
static const Uint32 REMAINING_MIP_LEVELS = ~0u;
1866-
static const Uint32 REMAINING_ARRAY_SLICES = ~0u;
1867+
/// The special constant for all remaining array slices.
1868+
#define DILIGENT_REMAINING_ARRAY_SLICES 0xFFFFFFFFU
1869+
1870+
static const Uint32 REMAINING_MIP_LEVELS = DILIGENT_REMAINING_MIP_LEVELS;
1871+
static const Uint32 REMAINING_ARRAY_SLICES = DILIGENT_REMAINING_ARRAY_SLICES;
18671872

18681873
/// Resource state transition flags.
18691874
DILIGENT_TYPED_ENUM(STATE_TRANSITION_FLAGS, Uint8)

Graphics/GraphicsEngine/interface/InputLayout.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,18 @@
3636

3737
DILIGENT_BEGIN_NAMESPACE(Diligent)
3838

39+
/// The maximum number of layout elements.
40+
#define DILIGENT_MAX_LAYOUT_ELEMENTS 16
3941

40-
static const Uint32 MAX_LAYOUT_ELEMENTS = 16;
41-
static const Uint32 LAYOUT_ELEMENT_AUTO_OFFSET = 0xFFFFFFFF;
42-
static const Uint32 LAYOUT_ELEMENT_AUTO_STRIDE = 0xFFFFFFFF;
42+
/// See Diligent::LayoutElement::RelativeOffset for details.
43+
#define DILIGENT_LAYOUT_ELEMENT_AUTO_OFFSET 0xFFFFFFFFU
44+
45+
/// See Diligen::LayoutElement::Stride for details.
46+
#define DILIGENT_LAYOUT_ELEMENT_AUTO_STRIDE 0xFFFFFFFFU
47+
48+
static const Uint32 MAX_LAYOUT_ELEMENTS = DILIGENT_MAX_LAYOUT_ELEMENTS;
49+
static const Uint32 LAYOUT_ELEMENT_AUTO_OFFSET = DILIGENT_LAYOUT_ELEMENT_AUTO_OFFSET;
50+
static const Uint32 LAYOUT_ELEMENT_AUTO_STRIDE = DILIGENT_LAYOUT_ELEMENT_AUTO_STRIDE;
4351

4452
/// Input frequency
4553
DILIGENT_TYPED_ENUM(INPUT_ELEMENT_FREQUENCY, Uint8)

Graphics/GraphicsEngine/interface/RenderPass.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ struct RenderPassAttachmentDesc
149149
};
150150
typedef struct RenderPassAttachmentDesc RenderPassAttachmentDesc;
151151

152-
#define ATTACHMENT_UNUSED (~0U)
152+
/// The special constant indicating that a render pass attachment is not used.
153+
#define DILIGENT_ATTACHMENT_UNUSED 0xFFFFFFFFU
154+
155+
static const Uint32 ATTACHMENT_UNUSED = DILIGENT_ATTACHMENT_UNUSED;
153156

154157
/// Attachment reference description.
155158
struct AttachmentReference
@@ -352,8 +355,10 @@ struct SubpassDesc
352355
};
353356
typedef struct SubpassDesc SubpassDesc;
354357

358+
/// The special subpass index value expanding synchronization scope outside a subpass.
359+
#define DILIGENT_SUBPASS_EXTERNAL 0xFFFFFFFFU
355360

356-
#define SUBPASS_EXTERNAL (~0U)
361+
static const Uint32 SUBPASS_EXTERNAL = DILIGENT_SUBPASS_EXTERNAL;
357362

358363
/// Subpass dependency description
359364
struct SubpassDependencyDesc

0 commit comments

Comments
 (0)