diff --git a/filament/src/components/LightManager.h b/filament/src/components/LightManager.h index 2bcfc7b742..9f735a4aa9 100644 --- a/filament/src/components/LightManager.h +++ b/filament/src/components/LightManager.h @@ -92,109 +92,109 @@ public: UTILS_NOINLINE void setSunHaloSize(Instance i, float haloSize) noexcept; UTILS_NOINLINE void setSunHaloFalloff(Instance i, float haloFalloff) noexcept; - constexpr LightType const& getLightType(Instance i) const noexcept { + LightType const& getLightType(Instance i) const noexcept { return mManager[i].lightType; } - constexpr Type getType(Instance i) const noexcept { + Type getType(Instance i) const noexcept { return getLightType(i).type; } - constexpr bool isShadowCaster(Instance i) const noexcept { + bool isShadowCaster(Instance i) const noexcept { return getLightType(i).shadowCaster; } - constexpr bool isLightCaster(Instance i) const noexcept { + bool isLightCaster(Instance i) const noexcept { return getLightType(i).lightCaster; } - constexpr bool isPointLight(Instance i) const noexcept { + bool isPointLight(Instance i) const noexcept { return getType(i) == Type::POINT; } - constexpr bool isSpotLight(Instance i) const noexcept { + bool isSpotLight(Instance i) const noexcept { Type type = getType(i); return type == Type::FOCUSED_SPOT || type == Type::SPOT; } - constexpr bool isDirectionalLight(Instance i) const noexcept { + bool isDirectionalLight(Instance i) const noexcept { Type type = getType(i); return type == Type::DIRECTIONAL || type == Type::SUN; } - constexpr bool isIESLight(Instance i) const noexcept { + bool isIESLight(Instance i) const noexcept { return false; // TODO: change this when we support IES lights } - constexpr bool isSunLight(Instance i) const noexcept { + bool isSunLight(Instance i) const noexcept { return getType(i) == Type::SUN; } - constexpr uint32_t getShadowMapSize(Instance i) const noexcept { + uint32_t getShadowMapSize(Instance i) const noexcept { return getShadowParams(i).options.mapSize; } - constexpr ShadowParams const& getShadowParams(Instance i) const noexcept { + ShadowParams const& getShadowParams(Instance i) const noexcept { return mManager[i].shadowParams; } - constexpr float getShadowConstantBias(Instance i) const noexcept { + float getShadowConstantBias(Instance i) const noexcept { return getShadowParams(i).options.constantBias; } - constexpr float getShadowNormalBias(Instance i) const noexcept { + float getShadowNormalBias(Instance i) const noexcept { return getShadowParams(i).options.normalBias; } - constexpr float getShadowFar(Instance i) const noexcept { + float getShadowFar(Instance i) const noexcept { return getShadowParams(i).options.shadowFar; } - constexpr const math::float3& getColor(Instance i) const noexcept { + const math::float3& getColor(Instance i) const noexcept { return mManager[i].color; } - constexpr float getIntensity(Instance i) const noexcept { + float getIntensity(Instance i) const noexcept { return mManager[i].intensity; } - constexpr float getSunAngularRadius(Instance i) const noexcept { + float getSunAngularRadius(Instance i) const noexcept { return mManager[i].sunAngularRadius; } - constexpr float getSunHaloSize(Instance i) const noexcept { + float getSunHaloSize(Instance i) const noexcept { return mManager[i].sunHaloSize; } - constexpr float getSunHaloFalloff(Instance i) const noexcept { + float getSunHaloFalloff(Instance i) const noexcept { return mManager[i].sunHaloFalloff; } - constexpr float getSquaredFalloffInv(Instance i) const noexcept { + float getSquaredFalloffInv(Instance i) const noexcept { return mManager[i].squaredFallOffInv; } - constexpr SpotParams const& getSpotParams(Instance i) const noexcept { + SpotParams const& getSpotParams(Instance i) const noexcept { return mManager[i].spotParams; } - constexpr float getCosOuterSquared(Instance i) const noexcept { + float getCosOuterSquared(Instance i) const noexcept { return getSpotParams(i).cosOuterSquared; } - constexpr float getSinInverse(Instance i) const noexcept { + float getSinInverse(Instance i) const noexcept { return getSpotParams(i).sinInverse; } - constexpr float getRadius(Instance i) const noexcept { + float getRadius(Instance i) const noexcept { return getSpotParams(i).radius; } - constexpr const math::float3& getLocalPosition(Instance i) const noexcept { + const math::float3& getLocalPosition(Instance i) const noexcept { return mManager[i].position; } - constexpr const math::float3& getLocalDirection(Instance i) const noexcept { + const math::float3& getLocalDirection(Instance i) const noexcept { return mManager[i].direction; } @@ -244,7 +244,7 @@ private: struct Proxy { // all of this gets inlined UTILS_ALWAYS_INLINE - constexpr Proxy(Base& sim, utils::EntityInstanceBase::Type i) noexcept + Proxy(Base& sim, utils::EntityInstanceBase::Type i) noexcept : lightType{ sim, i } { } union { @@ -263,10 +263,10 @@ private: }; }; - UTILS_ALWAYS_INLINE constexpr Proxy operator[](Instance i) noexcept { + UTILS_ALWAYS_INLINE Proxy operator[](Instance i) noexcept { return { *this, i }; } - UTILS_ALWAYS_INLINE constexpr const Proxy operator[](Instance i) const noexcept { + UTILS_ALWAYS_INLINE const Proxy operator[](Instance i) const noexcept { return { const_cast(*this), i }; } }; diff --git a/filament/src/components/RenderableManager.h b/filament/src/components/RenderableManager.h index 6f606122f3..70b8eeb06b 100644 --- a/filament/src/components/RenderableManager.h +++ b/filament/src/components/RenderableManager.h @@ -181,7 +181,7 @@ private: struct Proxy { // all of this gets inlined UTILS_ALWAYS_INLINE - constexpr Proxy(Base& sim, utils::EntityInstanceBase::Type i) noexcept + Proxy(Base& sim, utils::EntityInstanceBase::Type i) noexcept : aabb{ sim, i } { } union { @@ -195,10 +195,10 @@ private: }; }; - UTILS_ALWAYS_INLINE constexpr Proxy operator[](Instance i) noexcept { + UTILS_ALWAYS_INLINE Proxy operator[](Instance i) noexcept { return { *this, i }; } - UTILS_ALWAYS_INLINE constexpr const Proxy operator[](Instance i) const noexcept { + UTILS_ALWAYS_INLINE const Proxy operator[](Instance i) const noexcept { return { const_cast(*this), i }; } }; diff --git a/filament/src/components/TransformManager.h b/filament/src/components/TransformManager.h index fef5f1b369..a209326634 100644 --- a/filament/src/components/TransformManager.h +++ b/filament/src/components/TransformManager.h @@ -132,7 +132,7 @@ private: struct Proxy { // all of this gets inlined UTILS_ALWAYS_INLINE - constexpr Proxy(Base& sim, utils::EntityInstanceBase::Type i) noexcept + Proxy(Base& sim, utils::EntityInstanceBase::Type i) noexcept : local{ sim, i } { } union { @@ -146,10 +146,10 @@ private: }; }; - UTILS_ALWAYS_INLINE constexpr Proxy operator[](Instance i) noexcept { + UTILS_ALWAYS_INLINE Proxy operator[](Instance i) noexcept { return { *this, i }; } - UTILS_ALWAYS_INLINE constexpr const Proxy operator[](Instance i) const noexcept { + UTILS_ALWAYS_INLINE const Proxy operator[](Instance i) const noexcept { return { const_cast(*this), i }; } }; diff --git a/libs/utils/include/utils/SingleInstanceComponentManager.h b/libs/utils/include/utils/SingleInstanceComponentManager.h index d53f60cc30..d2b1df9c9e 100644 --- a/libs/utils/include/utils/SingleInstanceComponentManager.h +++ b/libs/utils/include/utils/SingleInstanceComponentManager.h @@ -140,46 +140,46 @@ public: // return a pointer to the first element of the ElementIndex'th array template - constexpr typename SoA::template TypeAt* begin() noexcept { + typename SoA::template TypeAt* begin() noexcept { return mData.template data() + 1; } template - constexpr typename SoA::template TypeAt const* begin() const noexcept { + typename SoA::template TypeAt const* begin() const noexcept { return mData.template data() + 1; } // return a pointer to the past-the-end element of the ElementIndex'th array template - constexpr typename SoA::template TypeAt* end() noexcept { + typename SoA::template TypeAt* end() noexcept { return begin() + getComponentCount(); } template - constexpr typename SoA::template TypeAt const* end() const noexcept { + typename SoA::template TypeAt const* end() const noexcept { return begin() + getComponentCount(); } // return a Slice<> template - constexpr Slice> slice() noexcept { + Slice> slice() noexcept { return { begin(), end() }; } template - constexpr Slice> slice() const noexcept { + Slice> slice() const noexcept { return { begin(), end() }; } // return a reference to the index'th element of the ElementIndex'th array template - constexpr typename SoA::template TypeAt& elementAt(Instance index) noexcept { + typename SoA::template TypeAt& elementAt(Instance index) noexcept { assert(index); return data()[index]; } template - constexpr typename SoA::template TypeAt const& elementAt(Instance index) const noexcept { + typename SoA::template TypeAt const& elementAt(Instance index) const noexcept { assert(index); return data()[index]; } @@ -187,14 +187,14 @@ public: // returns a pointer to the RAW ARRAY of components including the first dummy component // Use with caution. template - constexpr typename SoA::template TypeAt const* raw_array() const noexcept { + typename SoA::template TypeAt const* raw_array() const noexcept { return data(); } // We need our own version of Field because mData is private template struct Field : public SoA::template Field { - constexpr Field(SingleInstanceComponentManager& soa, EntityInstanceBase::Type i) noexcept + Field(SingleInstanceComponentManager& soa, EntityInstanceBase::Type i) noexcept : SoA::template Field{ soa.mData, i } { } using SoA::template Field::operator =; @@ -202,12 +202,12 @@ public: protected: template - constexpr typename SoA::template TypeAt* data() noexcept { + typename SoA::template TypeAt* data() noexcept { return mData.template data(); } template - constexpr typename SoA::template TypeAt const* data() const noexcept { + typename SoA::template TypeAt const* data() const noexcept { return mData.template data(); } diff --git a/libs/utils/include/utils/StructureOfArrays.h b/libs/utils/include/utils/StructureOfArrays.h index 44240d72aa..d8ba18c90a 100644 --- a/libs/utils/include/utils/StructureOfArrays.h +++ b/libs/utils/include/utils/StructureOfArrays.h @@ -366,64 +366,64 @@ public: // return a pointer to the first element of the ElementIndex]th array template - constexpr TypeAt* data() noexcept { + TypeAt* data() noexcept { return getArray>(ElementIndex); } template - constexpr TypeAt const* data() const noexcept { + TypeAt const* data() const noexcept { return getArray>(ElementIndex); } template - constexpr TypeAt* begin() noexcept { + TypeAt* begin() noexcept { return getArray>(ElementIndex); } template - constexpr TypeAt const* begin() const noexcept { + TypeAt const* begin() const noexcept { return getArray>(ElementIndex); } template - constexpr TypeAt* end() noexcept { + TypeAt* end() noexcept { return getArray>(ElementIndex) + size(); } template - constexpr TypeAt const* end() const noexcept { + TypeAt const* end() const noexcept { return getArray>(ElementIndex) + size(); } template - constexpr Slice> slice() noexcept { + Slice> slice() noexcept { return { begin(), end() }; } template - constexpr Slice> slice() const noexcept { + Slice> slice() const noexcept { return { begin(), end() }; } // return a reference to the index'th element of the ElementIndex'th array template - constexpr TypeAt& elementAt(size_t index) noexcept { + TypeAt& elementAt(size_t index) noexcept { return data()[index]; } template - constexpr TypeAt const& elementAt(size_t index) const noexcept { + TypeAt const& elementAt(size_t index) const noexcept { return data()[index]; } // return a reference to the last element of the ElementIndex'th array template - constexpr TypeAt& back() noexcept { + TypeAt& back() noexcept { return data()[size() - 1]; } template - constexpr TypeAt const& back() const noexcept { + TypeAt const& back() const noexcept { return data()[size() - 1]; } @@ -439,59 +439,59 @@ public: } // auto-conversion to the field's type - UTILS_ALWAYS_INLINE constexpr operator Type&() noexcept { + UTILS_ALWAYS_INLINE operator Type&() noexcept { return soa.elementAt(i); } - UTILS_ALWAYS_INLINE constexpr operator Type const&() const noexcept { + UTILS_ALWAYS_INLINE operator Type const&() const noexcept { return soa.elementAt(i); } // dereferencing the selected field - UTILS_ALWAYS_INLINE constexpr Type& operator ->() noexcept { + UTILS_ALWAYS_INLINE Type& operator ->() noexcept { return soa.elementAt(i); } - UTILS_ALWAYS_INLINE constexpr Type const& operator ->() const noexcept { + UTILS_ALWAYS_INLINE Type const& operator ->() const noexcept { return soa.elementAt(i); } // address-of the selected field - UTILS_ALWAYS_INLINE constexpr Type* operator &() noexcept { + UTILS_ALWAYS_INLINE Type* operator &() noexcept { return &soa.elementAt(i); } - UTILS_ALWAYS_INLINE constexpr Type const* operator &() const noexcept { + UTILS_ALWAYS_INLINE Type const* operator &() const noexcept { return &soa.elementAt(i); } // assignment to the field - UTILS_ALWAYS_INLINE constexpr Type const& operator = (Type const& other) noexcept { + UTILS_ALWAYS_INLINE Type const& operator = (Type const& other) noexcept { return (soa.elementAt(i) = other); } - UTILS_ALWAYS_INLINE constexpr Type const& operator = (Type&& other) noexcept { + UTILS_ALWAYS_INLINE Type const& operator = (Type&& other) noexcept { return (soa.elementAt(i) = other); } // comparisons - UTILS_ALWAYS_INLINE constexpr bool operator==(Type const& other) const { + UTILS_ALWAYS_INLINE bool operator==(Type const& other) const { return (soa.elementAt(i) == other); } - UTILS_ALWAYS_INLINE constexpr bool operator!=(Type const& other) const { + UTILS_ALWAYS_INLINE bool operator!=(Type const& other) const { return (soa.elementAt(i) != other); } // calling the field template - UTILS_ALWAYS_INLINE constexpr decltype(auto) operator()(ARGS&& ... args) noexcept { + UTILS_ALWAYS_INLINE decltype(auto) operator()(ARGS&& ... args) noexcept { return soa.elementAt(i)(std::forward(args)...); } template - UTILS_ALWAYS_INLINE constexpr decltype(auto) operator()(ARGS&& ... args) const noexcept { + UTILS_ALWAYS_INLINE decltype(auto) operator()(ARGS&& ... args) const noexcept { return soa.elementAt(i)(std::forward(args)...); } }; private: template - constexpr T const* getArray(size_t arrayIndex) const { + T const* getArray(size_t arrayIndex) const { return static_cast(mArrayOffset[arrayIndex]); } template - constexpr T* getArray(size_t arrayIndex) { + T* getArray(size_t arrayIndex) { return static_cast(mArrayOffset[arrayIndex]); } @@ -509,12 +509,12 @@ private: } // this calculate the offset adjusted for all data alignment of a given array - static inline constexpr size_t getOffset(size_t index, size_t capacity) noexcept { + static inline size_t getOffset(size_t index, size_t capacity) noexcept { auto offsets = getOffsets(capacity); return offsets[index]; } - static inline constexpr std::array getOffsets(size_t capacity) noexcept { + static inline std::array getOffsets(size_t capacity) noexcept { // compute the required size of each array const size_t sizes[] = { (sizeof(Elements) * capacity)... };