Skip to content

Commit 697eff0

Browse files
Replace MAX_INLINE_CONSTANTS_SIZE with MAX_INLINE_CONSTANTS
1 parent 578f8f4 commit 697eff0

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

Graphics/GraphicsEngine/interface/Constants.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2026 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -62,8 +62,8 @@ DILIGENT_BEGIN_NAMESPACE(Diligent)
6262
/// Bit shift for the the shading X-axis rate.
6363
#define DILIGENT_SHADING_RATE_X_SHIFT 2
6464

65-
/// Ineline constants data storage (max size is typically 128-256 bytes, use 256 for safety)
66-
#define DILIGENT_MAX_INLINE_CONSTANTS_SIZE 256
65+
/// The maximum number of 4-byte inline constants in a pipeline state.
66+
#define DILIGENT_MAX_INLINE_CONSTANTS 64
6767

6868
static DILIGENT_CONSTEXPR Uint32 MAX_BUFFER_SLOTS = DILIGENT_MAX_BUFFER_SLOTS;
6969
static DILIGENT_CONSTEXPR Uint32 MAX_RENDER_TARGETS = DILIGENT_MAX_RENDER_TARGETS;
@@ -74,5 +74,6 @@ static DILIGENT_CONSTEXPR Uint32 DEFAULT_ADAPTER_ID = DILIGENT_DEFAULT_ADAP
7474
static DILIGENT_CONSTEXPR Uint8 DEFAULT_QUEUE_ID = DILIGENT_DEFAULT_QUEUE_ID;
7575
static DILIGENT_CONSTEXPR Uint32 MAX_SHADING_RATES = DILIGENT_MAX_SHADING_RATES;
7676
static DILIGENT_CONSTEXPR Uint32 SHADING_RATE_X_SHIFT = DILIGENT_SHADING_RATE_X_SHIFT;
77+
static DILIGENT_CONSTEXPR Uint32 MAX_INLINE_CONSTANTS = DILIGENT_MAX_INLINE_CONSTANTS;
7778

7879
DILIGENT_END_NAMESPACE // namespace Diligent

Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2025 Diligent Graphics LLC
2+
* Copyright 2019-2026 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -119,10 +119,10 @@ void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc&
119119
"). INLINE_CONSTANTS flag cannot be combined with other flags.");
120120
}
121121

122-
if (Res.ArraySize > 64)
122+
if (Res.ArraySize > MAX_INLINE_CONSTANTS)
123123
{
124124
LOG_PRS_ERROR_AND_THROW("Desc.Resources[", i, "].ArraySize (", Res.ArraySize,
125-
") exceeds the maximum allowed value (64) for inline constants.");
125+
") exceeds the maximum allowed value (", MAX_INLINE_CONSTANTS, ") for inline constants.");
126126
}
127127
}
128128

Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2025 Diligent Graphics LLC
2+
* Copyright 2019-2026 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -271,12 +271,11 @@ struct D3DShaderResourceAttribs
271271
}
272272
const Uint32 NumConstants = GetConstantBufferSize() / sizeof(Uint32);
273273

274-
constexpr Uint32 kMaxInlineConstants = 64;
275-
if (NumConstants > kMaxInlineConstants)
274+
if (NumConstants > MAX_INLINE_CONSTANTS)
276275
{
277276
LOG_ERROR_AND_THROW("Inline constants resource '", Name, "' in shader '", ShaderName, "' has ",
278277
NumConstants, " constants. The maximum supported number of inline constants is ",
279-
kMaxInlineConstants, '.');
278+
MAX_INLINE_CONSTANTS, '.');
280279
}
281280

282281
return NumConstants;

Graphics/ShaderTools/include/SPIRVShaderResources.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2025 Diligent Graphics LLC
2+
* Copyright 2019-2026 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -159,12 +159,11 @@ struct SPIRVShaderResourceAttribs
159159
}
160160
const Uint32 NumConstants = GetConstantBufferSize() / sizeof(Uint32);
161161

162-
constexpr Uint32 kMaxInlineConstants = 64;
163-
if (NumConstants > kMaxInlineConstants)
162+
if (NumConstants > MAX_INLINE_CONSTANTS)
164163
{
165164
LOG_ERROR_AND_THROW("Inline constants resource '", Name, "' in shader '", ShaderName, "' has ",
166165
NumConstants, " constants. The maximum supported number of inline constants is ",
167-
kMaxInlineConstants, '.');
166+
MAX_INLINE_CONSTANTS, '.');
168167
}
169168

170169
if (NumConstants == 0)

0 commit comments

Comments
 (0)