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.6 6.5
Fixes: QTBUG-118170
Change-Id: Ia3dede91b989b295c3e792691d534648581a27c2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Timur Pocheptsov 2023-10-19 12:24:14 +02:00
parent 82a9ecb175
commit 113a6b89b8

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,
@ -1217,7 +1217,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;
@ -1962,7 +1962,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();