From 113a6b89b8ddc841ef6717d79b8b119f8449703b Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 19 Oct 2023 12:24:14 +0200 Subject: [PATCH] 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 --- src/gui/rhi/qrhi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/rhi/qrhi.h b/src/gui/rhi/qrhi.h index c1d3e951ea..770233bb51 100644 --- a/src/gui/rhi/qrhi.h +++ b/src/gui/rhi/qrhi.h @@ -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 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 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();