Make static data-members constexpr

While a minor issue, it's possible to use them in a way requiring
a definition, triggering a linker error. We can either make them
inline or constexpr.

Pick-to: 6.5
Fixes: QTBUG-118170
Change-Id: Ia3dede91b989b295c3e792691d534648581a27c2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 113a6b89b8ddc841ef6717d79b8b119f8449703b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Timur Pocheptsov 2023-10-19 12:24:14 +02:00 committed by Qt Cherry-pick Bot
parent e789ea584f
commit f0410ed5e8

View File

@ -495,7 +495,7 @@ public:
quint32 maybeSize;
bool hasDynamicOffset;
};
static const int MAX_TEX_SAMPLER_ARRAY_SIZE = 16;
static constexpr int MAX_TEX_SAMPLER_ARRAY_SIZE = 16;
struct TextureAndOrSamplerData {
int count;
TextureAndSampler texSamplers[MAX_TEX_SAMPLER_ARRAY_SIZE];
@ -535,7 +535,7 @@ public:
}
};
static const int LAYOUT_DESC_ENTRIES_PER_BINDING = 4;
static constexpr int LAYOUT_DESC_ENTRIES_PER_BINDING = 4;
template<typename Output>
static void serializeLayoutDescription(const QRhiShaderResourceBinding *first,
@ -1213,7 +1213,7 @@ public:
virtual void updateResources(UpdateFlags flags = {}) = 0;
protected:
static const int BINDING_PREALLOC = 12;
static constexpr int BINDING_PREALLOC = 12;
QRhiShaderResourceBindings(QRhiImplementation *rhi);
QVarLengthArray<QRhiShaderResourceBinding, BINDING_PREALLOC> m_bindings;
size_t m_layoutDescHash = 0;
@ -1943,7 +1943,7 @@ public:
const QRhiNativeHandles *nativeHandles();
bool makeThreadLocalNativeContextCurrent();
static const int MAX_MIP_LEVELS = 16; // -> max width or height is 65536
static constexpr int MAX_MIP_LEVELS = 16; // -> max width or height is 65536
void releaseCachedResources();