From 248029c59211670c8d82da222eecfc23fca0f0ed Mon Sep 17 00:00:00 2001
From: Carsten Rudolph <18394207+crud89@users.noreply.github.com>
Date: Fri, 3 Nov 2023 20:57:47 +0100
Subject: [PATCH 1/8] Replace references with integrated types in core
projects.
---
src/AppModel/include/litefx/app.hpp | 15 +-
src/AppModel/src/app.cpp | 8 +-
src/Backends/DirectX12/src/command_buffer.cpp | 2 +-
src/Backends/Vulkan/src/command_buffer.cpp | 2 +-
src/Logging/include/litefx/logging.hpp | 8 +-
src/Logging/src/console.cpp | 4 +-
src/Logging/src/logger.cpp | 2 +-
src/Logging/src/rolling_file.cpp | 4 +-
src/Math/include/litefx/math.hpp | 162 +++++++++---------
src/Math/include/litefx/vector.hpp | 14 +-
src/Math/src/rect.cpp | 24 +--
src/Math/src/size.cpp | 54 +++---
src/Math/src/vector.cpp | 84 ++++-----
13 files changed, 190 insertions(+), 193 deletions(-)
diff --git a/src/AppModel/include/litefx/app.hpp b/src/AppModel/include/litefx/app.hpp
index 462514d41..5f43b3446 100644
--- a/src/AppModel/include/litefx/app.hpp
+++ b/src/AppModel/include/litefx/app.hpp
@@ -330,7 +330,7 @@ namespace LiteFX {
/// Returns the new window width.
///
/// The new window width.
- const int& width() const noexcept {
+ inline int width() const noexcept {
return m_width;
}
@@ -338,7 +338,7 @@ namespace LiteFX {
/// Returns the new window height.
///
/// The new window height.
- const int& height() const noexcept {
+ inline int height() const noexcept {
return m_height;
}
};
@@ -449,21 +449,21 @@ namespace LiteFX {
///
/// The backend type for which the active backend should be stopped.
///
- virtual void stopActiveBackends(const BackendType& type) const;
+ virtual void stopActiveBackends(BackendType type) const;
///
/// Returns the active backend of the provided backend .
///
/// The type of the backend.
/// The active backend of the provided backend type, or std::nullptr, if no backend is active.
- virtual IBackend* activeBackend(const BackendType& type) const;
+ virtual IBackend* activeBackend(BackendType type) const;
///
/// Returns the type index of the active backend of the provided backend .
///
/// The type of the backend.
/// Type index of the active backend of the provided backend type, or the type index of std::nullptr_t, if no backend is active.
- virtual std::type_index activeBackendType(const BackendType& type) const;
+ virtual std::type_index activeBackendType(BackendType type) const;
private:
///
@@ -619,12 +619,9 @@ namespace LiteFX {
///
/// Called, if the application window resizes.
///
- ///
- /// Calling this method ensures, that the and parameters are valid.
- ///
/// The new width of the application window.
/// The new height of the application window.
- void resize(int& width, int& height);
+ void resize(int width, int height);
public:
///
diff --git a/src/AppModel/src/app.cpp b/src/AppModel/src/app.cpp
index f1515da0a..4b3910597 100644
--- a/src/AppModel/src/app.cpp
+++ b/src/AppModel/src/app.cpp
@@ -111,13 +111,13 @@ void App::stopBackend(std::type_index type) const
}
}
-void App::stopActiveBackends(const BackendType& type) const
+void App::stopActiveBackends(BackendType type) const
{
for (auto& backend : m_impl->m_backends | std::views::filter([type](const auto& b) { return b.second->type() == type && b.second->state() == BackendState::Active; }))
this->stopBackend(backend.first);
}
-IBackend* App::activeBackend(const BackendType& type) const
+IBackend* App::activeBackend(BackendType type) const
{
for (auto& backend : m_impl->m_backends | std::views::filter([type](const auto& b) { return b.second->type() == type && b.second->state() == BackendState::Active; }))
return backend.second.get();
@@ -125,7 +125,7 @@ IBackend* App::activeBackend(const BackendType& type) const
return nullptr;
}
-std::type_index App::activeBackendType(const BackendType& type) const
+std::type_index App::activeBackendType(BackendType type) const
{
for (auto& backend : m_impl->m_backends | std::views::filter([type](const auto& b) { return b.second->type() == type && b.second->state() == BackendState::Active; }))
return backend.first;
@@ -193,7 +193,7 @@ void App::run()
this->shutdown(this, { });
}
-void App::resize(int& width, int& height)
+void App::resize(int width, int height)
{
// Ensure the area is at least 1 pixel into each direction.
width = std::max(width, 1);
diff --git a/src/Backends/DirectX12/src/command_buffer.cpp b/src/Backends/DirectX12/src/command_buffer.cpp
index 7a74c534a..aaf9bc513 100644
--- a/src/Backends/DirectX12/src/command_buffer.cpp
+++ b/src/Backends/DirectX12/src/command_buffer.cpp
@@ -138,7 +138,7 @@ void DirectX12CommandBuffer::setScissors(const IScissor* scissor) const noexcept
void DirectX12CommandBuffer::setBlendFactors(const Vector4f& blendFactors) const noexcept
{
- this->handle()->OMSetBlendFactor(&blendFactors[0]);
+ this->handle()->OMSetBlendFactor(blendFactors.elements());
}
void DirectX12CommandBuffer::setStencilRef(const UInt32& stencilRef) const noexcept
diff --git a/src/Backends/Vulkan/src/command_buffer.cpp b/src/Backends/Vulkan/src/command_buffer.cpp
index 1597a4246..d5d791e00 100644
--- a/src/Backends/Vulkan/src/command_buffer.cpp
+++ b/src/Backends/Vulkan/src/command_buffer.cpp
@@ -166,7 +166,7 @@ void VulkanCommandBuffer::setScissors(const IScissor* scissor) const noexcept
void VulkanCommandBuffer::setBlendFactors(const Vector4f& blendFactors) const noexcept
{
- ::vkCmdSetBlendConstants(this->handle(), &blendFactors[0]);
+ ::vkCmdSetBlendConstants(this->handle(), blendFactors.elements());
}
void VulkanCommandBuffer::setStencilRef(const UInt32& stencilRef) const noexcept
diff --git a/src/Logging/include/litefx/logging.hpp b/src/Logging/include/litefx/logging.hpp
index ab71206bc..deb2cf5e3 100644
--- a/src/Logging/include/litefx/logging.hpp
+++ b/src/Logging/include/litefx/logging.hpp
@@ -59,7 +59,7 @@ namespace LiteFX::Logging {
LITEFX_IMPLEMENTATION(ConsoleSinkImpl);
public:
- ConsoleSink(const LogLevel& level = LogLevel::Info, const String& pattern = "%+");
+ ConsoleSink(LogLevel level = LogLevel::Info, const String& pattern = "%+");
ConsoleSink(const ConsoleSink&) = delete;
ConsoleSink(ConsoleSink&&) = delete;
virtual ~ConsoleSink() noexcept;
@@ -82,7 +82,7 @@ namespace LiteFX::Logging {
LITEFX_IMPLEMENTATION(RollingFileSinkImpl);
public:
- RollingFileSink(const String& fileName, const LogLevel& level = LogLevel::Info, const String& pattern = "%+", const bool& truncate = false, const int& maxFiles = 0);
+ RollingFileSink(const String& fileName, LogLevel level = LogLevel::Info, const String& pattern = "%+", bool truncate = false, int maxFiles = 0);
RollingFileSink(const RollingFileSink&) = delete;
RollingFileSink(RollingFileSink&&) = delete;
virtual ~RollingFileSink() noexcept;
@@ -123,11 +123,11 @@ namespace LiteFX::Logging {
virtual inline const String& getName() const noexcept;
protected:
- virtual void log(const LogLevel& level, StringView message);
+ virtual void log(LogLevel level, StringView message);
public:
template
- inline void log(const LogLevel& level, StringView format, TArgs&&... args) {
+ inline void log(LogLevel level, StringView format, TArgs&&... args) {
this->log(level, fmt::format(fmt::runtime(format), std::forward(args)...));
}
diff --git a/src/Logging/src/console.cpp b/src/Logging/src/console.cpp
index 5ecf52f59..51263703f 100644
--- a/src/Logging/src/console.cpp
+++ b/src/Logging/src/console.cpp
@@ -17,7 +17,7 @@ class ConsoleSink::ConsoleSinkImpl : public Implement {
SharedPtr m_sink;
public:
- ConsoleSinkImpl(ConsoleSink* parent, const LogLevel& level, const String& pattern) :
+ ConsoleSinkImpl(ConsoleSink* parent, LogLevel level, const String& pattern) :
base(parent), m_pattern(pattern), m_level(level), m_sink(makeShared())
{
m_sink->set_level(static_cast(level));
@@ -29,7 +29,7 @@ class ConsoleSink::ConsoleSinkImpl : public Implement {
// Shared interface.
// ------------------------------------------------------------------------------------------------
-ConsoleSink::ConsoleSink(const LogLevel& level, const String& pattern) :
+ConsoleSink::ConsoleSink(LogLevel level, const String& pattern) :
m_impl(makePimpl(this, level, pattern))
{
}
diff --git a/src/Logging/src/logger.cpp b/src/Logging/src/logger.cpp
index 775e22182..ea8770534 100644
--- a/src/Logging/src/logger.cpp
+++ b/src/Logging/src/logger.cpp
@@ -35,7 +35,7 @@ const String& Log::getName() const noexcept
return m_impl->m_name;
}
-void Log::log(const LogLevel& level, StringView message)
+void Log::log(LogLevel level, StringView message)
{
auto logger = spdlog::get(this->getName());
assert(logger != nullptr);
diff --git a/src/Logging/src/rolling_file.cpp b/src/Logging/src/rolling_file.cpp
index 008feb92c..9a87cd524 100644
--- a/src/Logging/src/rolling_file.cpp
+++ b/src/Logging/src/rolling_file.cpp
@@ -20,7 +20,7 @@ class RollingFileSink::RollingFileSinkImpl : public Implement {
SharedPtr m_sink;
public:
- RollingFileSinkImpl(RollingFileSink* parent, const LogLevel& level, const String& fileName, const String& pattern, bool truncate, int maxFiles) :
+ RollingFileSinkImpl(RollingFileSink* parent, LogLevel level, const String& fileName, const String& pattern, bool truncate, int maxFiles) :
base(parent), m_pattern(pattern), m_level(level), m_fileName(fileName), m_truncate(truncate), m_maxFiles(maxFiles),
m_sink(makeShared(fileName, 23, 59, truncate, maxFiles))
{
@@ -33,7 +33,7 @@ class RollingFileSink::RollingFileSinkImpl : public Implement {
// Shared interface.
// ------------------------------------------------------------------------------------------------
-RollingFileSink::RollingFileSink(const String& fileName, const LogLevel& level, const String& pattern, const bool& truncate, const int& maxFiles) :
+RollingFileSink::RollingFileSink(const String& fileName, LogLevel level, const String& pattern, bool truncate, int maxFiles) :
m_impl(makePimpl(this, level, fileName, pattern, truncate, maxFiles))
{
}
diff --git a/src/Math/include/litefx/math.hpp b/src/Math/include/litefx/math.hpp
index 886df6dc0..f5cd716f6 100644
--- a/src/Math/include/litefx/math.hpp
+++ b/src/Math/include/litefx/math.hpp
@@ -80,7 +80,7 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector1f : public Vector {
public:
Vector1f() noexcept;
- Vector1f(const Float& v) noexcept;
+ Vector1f(Float v) noexcept;
Vector1f(const Vector1f&) noexcept;
Vector1f(const Vector&) noexcept;
Vector1f(Vector1f&&) noexcept;
@@ -93,8 +93,8 @@ namespace LiteFX::Math {
inline Vector1f& operator=(const Enumerable& _other) noexcept;
inline Vector1f& operator=(const Vector1f& _other) noexcept;
inline Vector1f& operator=(Vector1f&& _other) noexcept;
- inline const Float& operator[](const unsigned int& i) const noexcept;
- inline Float& operator[](const unsigned int& i) noexcept;
+ inline Float operator[](UInt32 i) const noexcept;
+ inline Float& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -115,7 +115,7 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector1u : public Vector {
public:
Vector1u() noexcept;
- Vector1u(const UInt32& v) noexcept;
+ Vector1u(UInt32 v) noexcept;
Vector1u(const Vector1u&) noexcept;
Vector1u(const Vector&) noexcept;
Vector1u(Vector1u&&) noexcept;
@@ -129,8 +129,8 @@ namespace LiteFX::Math {
inline Vector1u& operator=(const Enumerable& _other) noexcept;
inline Vector1u& operator=(const Vector1u& _other) noexcept;
inline Vector1u& operator=(Vector1u&& _other) noexcept;
- inline const UInt32& operator[](const unsigned int& i) const noexcept;
- inline UInt32& operator[](const unsigned int& i) noexcept;
+ inline UInt32 operator[](UInt32 i) const noexcept;
+ inline UInt32& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -151,8 +151,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector2f : public Vector {
public:
Vector2f() noexcept;
- Vector2f(const Float& v) noexcept;
- Vector2f(const Float& x, const Float& y) noexcept;
+ Vector2f(Float v) noexcept;
+ Vector2f(Float x, Float y) noexcept;
Vector2f(const Vector2f&) noexcept;
Vector2f(const Vector&) noexcept;
Vector2f(Vector2f&&) noexcept;
@@ -165,8 +165,8 @@ namespace LiteFX::Math {
inline Vector2f& operator=(const Enumerable& _other) noexcept;
inline Vector2f& operator=(const Vector2f& _other) noexcept;
inline Vector2f& operator=(Vector2f&& _other) noexcept;
- inline const Float& operator[](const unsigned int& i) const noexcept;
- inline Float& operator[](const unsigned int& i) noexcept;
+ inline Float operator[](UInt32 i) const noexcept;
+ inline Float& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -190,8 +190,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector2u : public Vector {
public:
Vector2u() noexcept;
- Vector2u(const UInt32& v) noexcept;
- Vector2u(const UInt32& x, const UInt32& y) noexcept;
+ Vector2u(UInt32 v) noexcept;
+ Vector2u(UInt32 x, UInt32 y) noexcept;
Vector2u(const Vector2u&) noexcept;
Vector2u(const Vector&) noexcept;
Vector2u(Vector2u&&) noexcept;
@@ -204,8 +204,8 @@ namespace LiteFX::Math {
inline Vector2u& operator=(const Enumerable& _other) noexcept;
inline Vector2u& operator=(const Vector2u& _other) noexcept;
inline Vector2u& operator=(Vector2u&& _other) noexcept;
- inline const UInt32& operator[](const unsigned int& i) const noexcept;
- inline UInt32& operator[](const unsigned int& i) noexcept;
+ inline UInt32 operator[](UInt32 i) const noexcept;
+ inline UInt32& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -229,8 +229,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector2i : public Vector {
public:
Vector2i() noexcept;
- Vector2i(const Int32& v) noexcept;
- Vector2i(const Int32& x, const Int32& y) noexcept;
+ Vector2i(Int32 v) noexcept;
+ Vector2i(Int32 x, Int32 y) noexcept;
Vector2i(const Vector2i&) noexcept;
Vector2i(const Vector&) noexcept;
Vector2i(Vector2i&&) noexcept;
@@ -243,8 +243,8 @@ namespace LiteFX::Math {
inline Vector2i& operator=(const Enumerable& _other) noexcept;
inline Vector2i& operator=(const Vector2i& _other) noexcept;
inline Vector2i& operator=(Vector2i&& _other) noexcept;
- inline const Int32& operator[](const unsigned int& i) const noexcept;
- inline Int32& operator[](const unsigned int& i) noexcept;
+ inline Int32 operator[](UInt32 i) const noexcept;
+ inline Int32& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -268,8 +268,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector3f : public Vector {
public:
Vector3f() noexcept;
- Vector3f(const Float& v) noexcept;
- Vector3f(const Float& x, const Float& y, const Float& z) noexcept;
+ Vector3f(Float v) noexcept;
+ Vector3f(Float x, Float y, Float z) noexcept;
Vector3f(const Vector3f&) noexcept;
Vector3f(const Vector&) noexcept;
Vector3f(Vector3f&&) noexcept;
@@ -282,8 +282,8 @@ namespace LiteFX::Math {
inline Vector3f& operator=(const Enumerable& _other) noexcept;
inline Vector3f& operator=(const Vector3f& _other) noexcept;
inline Vector3f& operator=(Vector3f&& _other) noexcept;
- inline const Float& operator[](const unsigned int& i) const noexcept;
- inline Float& operator[](const unsigned int& i) noexcept;
+ inline Float operator[](UInt32 i) const noexcept;
+ inline Float& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -307,8 +307,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector3u : public Vector {
public:
Vector3u() noexcept;
- Vector3u(const UInt32& v) noexcept;
- Vector3u(const UInt32& x, const UInt32& y, const UInt32& z) noexcept;
+ Vector3u(UInt32 v) noexcept;
+ Vector3u(UInt32 x, UInt32 y, UInt32 z) noexcept;
Vector3u(const Vector3u&) noexcept;
Vector3u(const Vector&) noexcept;
Vector3u(Vector3u&&) noexcept;
@@ -321,8 +321,8 @@ namespace LiteFX::Math {
inline Vector3u& operator=(const Enumerable& _other) noexcept;
inline Vector3u& operator=(const Vector3u& _other) noexcept;
inline Vector3u& operator=(Vector3u&& _other) noexcept;
- inline const UInt32& operator[](const unsigned int& i) const noexcept;
- inline UInt32& operator[](const unsigned int& i) noexcept;
+ inline UInt32 operator[](UInt32 i) const noexcept;
+ inline UInt32& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -346,8 +346,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector3i : public Vector {
public:
Vector3i() noexcept;
- Vector3i(const Int32& v) noexcept;
- Vector3i(const Int32& x, const Int32& y, const Int32& z) noexcept;
+ Vector3i(Int32 v) noexcept;
+ Vector3i(Int32 x, Int32 y, Int32 z) noexcept;
Vector3i(const Vector3i&) noexcept;
Vector3i(const Vector&) noexcept;
Vector3i(Vector3i&&) noexcept;
@@ -360,8 +360,8 @@ namespace LiteFX::Math {
inline Vector3i& operator=(const Enumerable& _other) noexcept;
inline Vector3i& operator=(const Vector3i& _other) noexcept;
inline Vector3i& operator=(Vector3i&& _other) noexcept;
- inline const Int32& operator[](const unsigned int& i) const noexcept;
- inline Int32& operator[](const unsigned int& i) noexcept;
+ inline Int32 operator[](UInt32 i) const noexcept;
+ inline Int32& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -385,8 +385,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector4f : public Vector {
public:
Vector4f() noexcept;
- Vector4f(const Float& v) noexcept;
- Vector4f(const Float& x, const Float& y, const Float& z, const Float& w) noexcept;
+ Vector4f(Float v) noexcept;
+ Vector4f(Float x, Float y, Float z, Float w) noexcept;
Vector4f(const Vector4f&) noexcept;
Vector4f(const Vector&) noexcept;
Vector4f(Vector4f&&) noexcept;
@@ -399,8 +399,8 @@ namespace LiteFX::Math {
inline Vector4f& operator=(const Enumerable& _other) noexcept;
inline Vector4f& operator=(const Vector4f& _other) noexcept;
inline Vector4f& operator=(Vector4f&& _other) noexcept;
- inline const Float& operator[](const unsigned int& i) const noexcept;
- inline Float& operator[](const unsigned int& i) noexcept;
+ inline Float operator[](UInt32 i) const noexcept;
+ inline Float& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -424,8 +424,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector4u : public Vector {
public:
Vector4u() noexcept;
- Vector4u(const UInt32& v) noexcept;
- Vector4u(const UInt32& x, const UInt32& y, const UInt32& z, const UInt32& w) noexcept;
+ Vector4u(UInt32 v) noexcept;
+ Vector4u(UInt32 x, UInt32 y, UInt32 z, UInt32 w) noexcept;
Vector4u(const Vector4u&) noexcept;
Vector4u(const Vector&) noexcept;
Vector4u(Vector4u&&) noexcept;
@@ -438,8 +438,8 @@ namespace LiteFX::Math {
inline Vector4u& operator=(const Enumerable& _other) noexcept;
inline Vector4u& operator=(const Vector4u& _other) noexcept;
inline Vector4u& operator=(Vector4u&& _other) noexcept;
- inline const UInt32& operator[](const unsigned int& i) const noexcept;
- inline UInt32& operator[](const unsigned int& i) noexcept;
+ inline UInt32 operator[](UInt32 i) const noexcept;
+ inline UInt32& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -463,8 +463,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Vector4i : public Vector {
public:
Vector4i() noexcept;
- Vector4i(const Int32& v) noexcept;
- Vector4i(const Int32& x, const Int32& y, const Int32& z, const Int32& w) noexcept;
+ Vector4i(Int32 v) noexcept;
+ Vector4i(Int32 x, Int32 y, Int32 z, Int32 w) noexcept;
Vector4i(const Vector4i&) noexcept;
Vector4i(const Vector&) noexcept;
Vector4i(Vector4i&&) noexcept;
@@ -477,8 +477,8 @@ namespace LiteFX::Math {
inline Vector4i& operator=(const Enumerable& _other) noexcept;
inline Vector4i& operator=(const Vector4i& _other) noexcept;
inline Vector4i& operator=(Vector4i&& _other) noexcept;
- inline const Int32& operator[](const unsigned int& i) const noexcept;
- inline Int32& operator[](const unsigned int& i) noexcept;
+ inline Int32 operator[](UInt32 i) const noexcept;
+ inline Int32& operator[](UInt32 i) noexcept;
inline operator Enumerable() noexcept;
#if defined(BUILD_WITH_GLM)
@@ -544,8 +544,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Size4d : public Vector {
public:
Size4d() noexcept;
- Size4d(const size_t& v) noexcept;
- Size4d(const size_t& w, const size_t& h, const size_t& d, const size_t& a) noexcept;
+ Size4d(size_t v) noexcept;
+ Size4d(size_t w, size_t h, size_t d, size_t a) noexcept;
Size4d(const Size4d&) noexcept;
Size4d(Size4d&&) noexcept;
//virtual ~Size4d() noexcept = default;
@@ -553,31 +553,31 @@ namespace LiteFX::Math {
public:
inline Size4d& operator=(const Size4d& _other) noexcept;
inline Size4d& operator=(Size4d&& _other) noexcept;
- inline Size4d operator/(const size_t& s) noexcept;
- inline Size4d& operator/=(const size_t& s) noexcept;
- inline Size4d operator*(const size_t& s) noexcept;
- inline Size4d& operator*=(const size_t& s) noexcept;
+ inline Size4d operator/(size_t s) noexcept;
+ inline Size4d& operator/=(size_t s) noexcept;
+ inline Size4d operator*(size_t s) noexcept;
+ inline Size4d& operator*=(size_t s) noexcept;
inline Size4d operator+(const Size4d& s) noexcept;
inline Size4d& operator+=(const Size4d& s) noexcept;
inline Size4d operator-(const Size4d& s) noexcept;
inline Size4d& operator-=(const Size4d& s) noexcept;
public:
- inline const size_t& width() const noexcept;
+ inline size_t width() const noexcept;
inline size_t& width() noexcept;
- inline const size_t& height() const noexcept;
+ inline size_t height() const noexcept;
inline size_t& height() noexcept;
- inline const size_t& depth() const noexcept;
+ inline size_t depth() const noexcept;
inline size_t& depth() noexcept;
- inline const size_t& alpha() const noexcept;
+ inline size_t alpha() const noexcept;
inline size_t& alpha() noexcept;
};
class LITEFX_MATH_API Size3d : public Vector {
public:
Size3d() noexcept;
- Size3d(const size_t& v) noexcept;
- Size3d(const size_t& w, const size_t& h, const size_t& d) noexcept;
+ Size3d(size_t v) noexcept;
+ Size3d(size_t w, size_t h, size_t d) noexcept;
Size3d(const Size3d&) noexcept;
Size3d(Size3d&&) noexcept;
//virtual ~Size3d() noexcept = default;
@@ -586,29 +586,29 @@ namespace LiteFX::Math {
inline Size3d& operator=(const Size3d& _other) noexcept;
inline Size3d& operator=(Size3d&& _other) noexcept;
inline operator Size4d() const noexcept;
- inline Size3d operator/(const size_t& s) noexcept;
- inline Size3d& operator/=(const size_t& s) noexcept;
- inline Size3d operator*(const size_t& s) noexcept;
- inline Size3d& operator*=(const size_t& s) noexcept;
+ inline Size3d operator/(size_t s) noexcept;
+ inline Size3d& operator/=(size_t s) noexcept;
+ inline Size3d operator*(size_t s) noexcept;
+ inline Size3d& operator*=(size_t s) noexcept;
inline Size3d operator+(const Size3d& s) noexcept;
inline Size3d& operator+=(const Size3d& s) noexcept;
inline Size3d operator-(const Size3d& s) noexcept;
inline Size3d& operator-=(const Size3d& s) noexcept;
public:
- inline const size_t& width() const noexcept;
+ inline size_t width() const noexcept;
inline size_t& width() noexcept;
- inline const size_t& height() const noexcept;
+ inline size_t height() const noexcept;
inline size_t& height() noexcept;
- inline const size_t& depth() const noexcept;
+ inline size_t depth() const noexcept;
inline size_t& depth() noexcept;
};
class LITEFX_MATH_API Size2d : public Vector {
public:
Size2d() noexcept;
- Size2d(const size_t& v) noexcept;
- Size2d(const size_t& w, const size_t& h) noexcept;
+ Size2d(size_t v) noexcept;
+ Size2d(size_t w, size_t h) noexcept;
Size2d(const Size2d&) noexcept;
Size2d(Size2d&&) noexcept;
//virtual ~Size2d() noexcept = default;
@@ -618,19 +618,19 @@ namespace LiteFX::Math {
inline Size2d& operator=(Size2d&& _other) noexcept;
inline operator Size3d() const noexcept;
inline operator Size4d() const noexcept;
- inline Size2d operator/(const size_t& s) noexcept;
- inline Size2d& operator/=(const size_t& s) noexcept;
- inline Size2d operator*(const size_t& s) noexcept;
- inline Size2d& operator*=(const size_t& s) noexcept;
+ inline Size2d operator/(size_t s) noexcept;
+ inline Size2d& operator/=(size_t s) noexcept;
+ inline Size2d operator*(size_t s) noexcept;
+ inline Size2d& operator*=(size_t s) noexcept;
inline Size2d operator+(const Size2d& s) noexcept;
inline Size2d& operator+=(const Size2d& s) noexcept;
inline Size2d operator-(const Size2d& s) noexcept;
inline Size2d& operator-=(const Size2d& s) noexcept;
public:
- inline const size_t& width() const noexcept;
+ inline size_t width() const noexcept;
inline size_t& width() noexcept;
- inline const size_t& height() const noexcept;
+ inline size_t height() const noexcept;
inline size_t& height() noexcept;
};
#pragma endregion
@@ -639,8 +639,8 @@ namespace LiteFX::Math {
class LITEFX_MATH_API Rect : public Vector {
public:
Rect() noexcept;
- Rect(const Vector& pos, const size_t& w, const size_t& h) noexcept;
- Rect(const size_t& x, const size_t& y, const size_t& w, const size_t& h) noexcept;
+ Rect(const Vector& pos, size_t w, size_t h) noexcept;
+ Rect(size_t x, size_t y, size_t w, size_t h) noexcept;
Rect(const Rect&) noexcept;
Rect(Rect&&) noexcept;
//virtual ~Rect() noexcept = default;
@@ -652,17 +652,17 @@ namespace LiteFX::Math {
public:
inline Vector position() const noexcept;
inline Size2d extent() const noexcept;
- inline const size_t& width() const noexcept;
+ inline size_t width() const noexcept;
inline size_t& width() noexcept;
- inline const size_t& height() const noexcept;
+ inline size_t height() const noexcept;
inline size_t& height() noexcept;
};
class LITEFX_MATH_API RectI : public Vector {
public:
RectI() noexcept;
- RectI(const Vector& pos, const Int32& w, const Int32& h) noexcept;
- RectI(const Int32& x, const Int32& y, const Int32& w, const Int32& h) noexcept;
+ RectI(const Vector& pos, Int32 w, Int32 h) noexcept;
+ RectI(Int32 x, Int32 y, Int32 w, Int32 h) noexcept;
RectI(const RectI&) noexcept;
RectI(RectI&&) noexcept;
//virtual ~RectI() noexcept = default;
@@ -674,17 +674,17 @@ namespace LiteFX::Math {
public:
inline Vector position() const noexcept;
inline Size2d extent() const noexcept;
- inline const Int32& width() const noexcept;
+ inline Int32 width() const noexcept;
inline Int32& width() noexcept;
- inline const Int32& height() const noexcept;
+ inline Int32 height() const noexcept;
inline Int32& height() noexcept;
};
class LITEFX_MATH_API RectF : public Vector {
public:
RectF() noexcept;
- RectF(const Vector& pos, const Float& w, const Float& h) noexcept;
- RectF(const Float& x, const Float& y, const Float& w, const Float& h) noexcept;
+ RectF(const Vector& pos, Float w, Float h) noexcept;
+ RectF(Float x, Float y, Float w, Float h) noexcept;
RectF(const RectF&) noexcept;
RectF(RectF&&) noexcept;
//virtual ~RectF() noexcept = default;
@@ -696,9 +696,9 @@ namespace LiteFX::Math {
public:
inline Vector position() const noexcept;
inline Size2d extent() const noexcept;
- inline const Float& width() const noexcept;
+ inline Float width() const noexcept;
inline Float& width() noexcept;
- inline const Float& height() const noexcept;
+ inline Float height() const noexcept;
inline Float& height() noexcept;
};
#pragma endregion
diff --git a/src/Math/include/litefx/vector.hpp b/src/Math/include/litefx/vector.hpp
index 7b021a620..c8477cfe3 100644
--- a/src/Math/include/litefx/vector.hpp
+++ b/src/Math/include/litefx/vector.hpp
@@ -19,7 +19,7 @@ namespace LiteFX::Math {
public:
Vector() noexcept = default;
- Vector(const T& val) noexcept {
+ Vector(T val) noexcept {
std::fill(std::begin(m_elements), std::end(m_elements), val);
}
@@ -56,13 +56,13 @@ namespace LiteFX::Math {
return *this;
}
- inline const T& operator[](const unsigned int& i) const noexcept {
+ inline T operator[](unsigned int i) const noexcept {
assert(i < DIM);
return m_elements[i];
}
- inline T& operator[](const unsigned int& i) noexcept {
+ inline T& operator[](unsigned int i) noexcept {
assert(i < DIM);
return m_elements[i];
@@ -85,7 +85,7 @@ namespace LiteFX::Math {
return vec_size;
}
- inline const scalar_type& x() const noexcept requires (DIM > 0) {
+ inline scalar_type x() const noexcept requires (DIM > 0) {
return m_elements[0];
}
@@ -93,7 +93,7 @@ namespace LiteFX::Math {
return m_elements[0];
}
- inline const scalar_type& y() const noexcept requires (DIM > 1) {
+ inline scalar_type y() const noexcept requires (DIM > 1) {
return m_elements[1];
}
@@ -101,7 +101,7 @@ namespace LiteFX::Math {
return m_elements[1];
}
- inline const scalar_type& z() const noexcept requires (DIM > 2) {
+ inline scalar_type z() const noexcept requires (DIM > 2) {
return m_elements[2];
}
@@ -109,7 +109,7 @@ namespace LiteFX::Math {
return m_elements[2];
}
- inline const scalar_type& w() const noexcept requires (DIM > 3) {
+ inline scalar_type w() const noexcept requires (DIM > 3) {
return m_elements[3];
}
diff --git a/src/Math/src/rect.cpp b/src/Math/src/rect.cpp
index 5253984e1..52ae9e844 100644
--- a/src/Math/src/rect.cpp
+++ b/src/Math/src/rect.cpp
@@ -10,14 +10,14 @@ Rect::Rect() noexcept : Vector() {}
Rect::Rect(const Rect& _other) noexcept : Vector(static_cast>(_other)) {}
Rect::Rect(Rect&& _other) noexcept : Vector(std::move(static_cast>(_other))) {}
-Rect::Rect(const Vector& pos, const size_t& w, const size_t& h) noexcept : Vector() {
+Rect::Rect(const Vector& pos, size_t w, size_t h) noexcept : Vector() {
this->x() = pos.x();
this->y() = pos.y();
this->z() = w;
this->w() = h;
}
-Rect::Rect(const size_t& x, const size_t& y, const size_t& w, const size_t& h) noexcept : Vector() {
+Rect::Rect(size_t x, size_t y, size_t w, size_t h) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = w;
@@ -45,7 +45,7 @@ Size2d Rect::extent() const noexcept {
return Size2d(this->z(), this->w());
}
-const size_t& Rect::width() const noexcept {
+size_t Rect::width() const noexcept {
return this->z();
}
@@ -53,7 +53,7 @@ size_t& Rect::width() noexcept {
return this->z();
}
-const size_t& Rect::height() const noexcept {
+size_t Rect::height() const noexcept {
return this->w();
}
@@ -69,14 +69,14 @@ RectI::RectI() noexcept : Vector() {}
RectI::RectI(const RectI& _other) noexcept : Vector(static_cast>(_other)) {}
RectI::RectI(RectI&& _other) noexcept : Vector(std::move(static_cast>(_other))) {}
-RectI::RectI(const Vector& pos, const Int32& w, const Int32& h) noexcept : Vector() {
+RectI::RectI(const Vector& pos, Int32 w, Int32 h) noexcept : Vector() {
this->x() = pos.x();
this->y() = pos.y();
this->z() = w;
this->w() = h;
}
-RectI::RectI(const Int32& x, const Int32& y, const Int32& w, const Int32& h) noexcept : Vector() {
+RectI::RectI(Int32 x, Int32 y, Int32 w, Int32 h) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = w;
@@ -101,7 +101,7 @@ Size2d RectI::extent() const noexcept {
return Size2d(this->z(), this->w());
}
-const Int32& RectI::width() const noexcept {
+Int32 RectI::width() const noexcept {
return this->z();
}
@@ -109,7 +109,7 @@ Int32& RectI::width() noexcept {
return this->z();
}
-const Int32& RectI::height() const noexcept {
+Int32 RectI::height() const noexcept {
return this->w();
}
@@ -125,14 +125,14 @@ RectF::RectF() noexcept : Vector() {}
RectF::RectF(const RectF& _other) noexcept : Vector(static_cast>(_other)) {}
RectF::RectF(RectF&& _other) noexcept : Vector(std::move(static_cast>(_other))) {}
-RectF::RectF(const Vector& pos, const Float& w, const Float& h) noexcept : Vector() {
+RectF::RectF(const Vector& pos, Float w, Float h) noexcept : Vector() {
this->x() = pos.x();
this->y() = pos.y();
this->z() = w;
this->w() = h;
}
-RectF::RectF(const Float& x, const Float& y, const Float& w, const Float& h) noexcept : Vector() {
+RectF::RectF(Float x, Float y, Float w, Float h) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = w;
@@ -157,7 +157,7 @@ Size2d RectF::extent() const noexcept {
return Size2d(this->z(), this->w());
}
-const Float& RectF::width() const noexcept {
+Float RectF::width() const noexcept {
return this->z();
}
@@ -165,7 +165,7 @@ Float& RectF::width() noexcept {
return this->z();
}
-const Float& RectF::height() const noexcept {
+Float RectF::height() const noexcept {
return this->w();
}
diff --git a/src/Math/src/size.cpp b/src/Math/src/size.cpp
index 6429d82f0..ba0b9ad40 100644
--- a/src/Math/src/size.cpp
+++ b/src/Math/src/size.cpp
@@ -7,8 +7,8 @@ using namespace LiteFX::Math;
// ------------------------------------------------------------------------------------------------
Size2d::Size2d() noexcept : Vector() {}
-Size2d::Size2d(const size_t& v) noexcept : Vector(v) {}
-Size2d::Size2d(const size_t& w, const size_t& h) noexcept : Vector() {
+Size2d::Size2d(size_t v) noexcept : Vector(v) {}
+Size2d::Size2d(size_t w, size_t h) noexcept : Vector() {
this->x() = w;
this->y() = h;
}
@@ -28,18 +28,18 @@ Size2d& Size2d::operator=(Size2d&& _other) noexcept {
Size2d::operator Size3d() const noexcept { return Size3d{ this->width(), this->height(), 1 }; }
Size2d::operator Size4d() const noexcept { return Size4d{ this->width(), this->height(), 1, 1 }; }
-Size2d Size2d::operator/(const size_t& s) noexcept { return Size2d{ this->width() / s, this->height() / s }; }
-Size2d& Size2d::operator/=(const size_t& s) noexcept { this->width() /= s; this->height() /= s; return *this; }
-Size2d Size2d::operator*(const size_t& s) noexcept { return Size2d{ this->width() * s, this->height() * s }; }
-Size2d& Size2d::operator*=(const size_t& s) noexcept { this->width() *= s; this->height() *= s; return *this; }
+Size2d Size2d::operator/(size_t s) noexcept { return Size2d{ this->width() / s, this->height() / s }; }
+Size2d& Size2d::operator/=(size_t s) noexcept { this->width() /= s; this->height() /= s; return *this; }
+Size2d Size2d::operator*(size_t s) noexcept { return Size2d{ this->width() * s, this->height() * s }; }
+Size2d& Size2d::operator*=(size_t s) noexcept { this->width() *= s; this->height() *= s; return *this; }
Size2d Size2d::operator+(const Size2d& s) noexcept { return Size2d{ this->width() + s.width(), this->height() + s.height() }; }
Size2d& Size2d::operator+=(const Size2d& s) noexcept { this->width() += s.width(); this->height() += s.height(); return *this; }
Size2d Size2d::operator-(const Size2d& s) noexcept { return Size2d{ this->width() - s.width(), this->height() - s.height() }; }
Size2d& Size2d::operator-=(const Size2d& s) noexcept { this->width() -= s.width(); this->height() -= s.height(); return *this; }
-const size_t& Size2d::width() const noexcept{ return this->x(); }
+size_t Size2d::width() const noexcept{ return this->x(); }
size_t& Size2d::width() noexcept { return this->x(); }
-const size_t& Size2d::height() const noexcept { return this->y(); }
+size_t Size2d::height() const noexcept { return this->y(); }
size_t& Size2d::height() noexcept { return this->y(); }
// ------------------------------------------------------------------------------------------------
@@ -47,8 +47,8 @@ size_t& Size2d::height() noexcept { return this->y(); }
// ------------------------------------------------------------------------------------------------
Size3d::Size3d() noexcept : Vector() {}
-Size3d::Size3d(const size_t& v) noexcept : Vector(v) {}
-Size3d::Size3d(const size_t& w, const size_t& h, const size_t& d) noexcept : Vector() {
+Size3d::Size3d(size_t v) noexcept : Vector(v) {}
+Size3d::Size3d(size_t w, size_t h, size_t d) noexcept : Vector() {
this->x() = w;
this->y() = h;
this->z() = d;
@@ -68,19 +68,19 @@ Size3d& Size3d::operator=(Size3d&& _other) noexcept {
}
Size3d::operator Size4d() const noexcept { return Size4d{ this->width(), this->height(), this->depth(), 1 }; }
-Size3d Size3d::operator/(const size_t& s) noexcept { return Size3d{ this->width() / s, this->height() / s, this->depth() / s }; }
-Size3d& Size3d::operator/=(const size_t& s) noexcept { this->width() /= s; this->height() /= s; this->depth() /= s; return *this; }
-Size3d Size3d::operator*(const size_t& s) noexcept { return Size3d{ this->width() * s, this->height() * s, this->depth() * s }; }
-Size3d& Size3d::operator*=(const size_t& s) noexcept { this->width() *= s; this->height() *= s; this->depth() *= s; return *this; }
+Size3d Size3d::operator/(size_t s) noexcept { return Size3d{ this->width() / s, this->height() / s, this->depth() / s }; }
+Size3d& Size3d::operator/=(size_t s) noexcept { this->width() /= s; this->height() /= s; this->depth() /= s; return *this; }
+Size3d Size3d::operator*(size_t s) noexcept { return Size3d{ this->width() * s, this->height() * s, this->depth() * s }; }
+Size3d& Size3d::operator*=(size_t s) noexcept { this->width() *= s; this->height() *= s; this->depth() *= s; return *this; }
Size3d Size3d::operator+(const Size3d& s) noexcept { return Size3d{ this->width() + s.width(), this->height() + s.height(), this->depth() + s.depth() }; }
Size3d& Size3d::operator+=(const Size3d& s) noexcept { this->width() += s.width(); this->height() += s.height(); this->depth() += s.depth() ; return *this; }
Size3d Size3d::operator-(const Size3d& s) noexcept { return Size3d{ this->width() - s.width(), this->height() - s.height(), this->depth() - s.depth() }; }
Size3d& Size3d::operator-=(const Size3d& s) noexcept { this->width() -= s.width(); this->height() -= s.height(); this->depth() -= s.depth(); return *this; }
-const size_t& Size3d::width() const noexcept { return this->x(); }
+size_t Size3d::width() const noexcept { return this->x(); }
size_t& Size3d::width() noexcept { return this->x(); }
-const size_t& Size3d::height() const noexcept { return this->y(); }
+size_t Size3d::height() const noexcept { return this->y(); }
size_t& Size3d::height() noexcept { return this->y(); }
-const size_t& Size3d::depth() const noexcept { return this->z(); }
+size_t Size3d::depth() const noexcept { return this->z(); }
size_t& Size3d::depth() noexcept { return this->z(); }
// ------------------------------------------------------------------------------------------------
@@ -88,8 +88,8 @@ size_t& Size3d::depth() noexcept { return this->z(); }
// ------------------------------------------------------------------------------------------------
Size4d::Size4d() noexcept : Vector() {}
-Size4d::Size4d(const size_t& v) noexcept : Vector(v) {}
-Size4d::Size4d(const size_t& w, const size_t& h, const size_t& d, const size_t& a) noexcept : Vector() {
+Size4d::Size4d(size_t v) noexcept : Vector(v) {}
+Size4d::Size4d(size_t w, size_t h, size_t d, size_t a) noexcept : Vector() {
this->x() = w;
this->y() = h;
this->z() = d;
@@ -109,20 +109,20 @@ Size4d& Size4d::operator=(Size4d&& _other) noexcept {
return *this;
}
-Size4d Size4d::operator/(const size_t& s) noexcept { return Size4d{ this->width() / s, this->height() / s, this->depth() / s, this->alpha() / s }; }
-Size4d& Size4d::operator/=(const size_t& s) noexcept { this->width() /= s; this->height() /= s; this->depth() /= s; this->alpha() /= s; return *this; }
-Size4d Size4d::operator*(const size_t& s) noexcept { return Size4d{ this->width() * s, this->height() * s, this->depth() * s, this->alpha() * s }; }
-Size4d& Size4d::operator*=(const size_t& s) noexcept { this->width() *= s; this->height() *= s; this->depth() *= s; this->alpha() *= s; return *this; }
+Size4d Size4d::operator/(size_t s) noexcept { return Size4d{ this->width() / s, this->height() / s, this->depth() / s, this->alpha() / s }; }
+Size4d& Size4d::operator/=(size_t s) noexcept { this->width() /= s; this->height() /= s; this->depth() /= s; this->alpha() /= s; return *this; }
+Size4d Size4d::operator*(size_t s) noexcept { return Size4d{ this->width() * s, this->height() * s, this->depth() * s, this->alpha() * s }; }
+Size4d& Size4d::operator*=(size_t s) noexcept { this->width() *= s; this->height() *= s; this->depth() *= s; this->alpha() *= s; return *this; }
Size4d Size4d::operator+(const Size4d& s) noexcept { return Size4d{ this->width() + s.width(), this->height() + s.height(), this->depth() + s.depth(), this->alpha() + s.alpha() }; }
Size4d& Size4d::operator+=(const Size4d& s) noexcept { this->width() += s.width(); this->height() += s.height(); this->depth() += s.depth(); this->alpha() += s.alpha(); return *this; }
Size4d Size4d::operator-(const Size4d& s) noexcept { return Size4d{ this->width() - s.width(), this->height() - s.height(), this->depth() - s.depth(), this->alpha() - s.alpha() }; }
Size4d& Size4d::operator-=(const Size4d& s) noexcept { this->width() -= s.width(); this->height() -= s.height(); this->depth() -= s.depth(); this->alpha() -= s.alpha(); return *this; }
-const size_t& Size4d::width() const noexcept { return this->x(); }
+size_t Size4d::width() const noexcept { return this->x(); }
size_t& Size4d::width() noexcept { return this->x(); }
-const size_t& Size4d::height() const noexcept { return this->y(); }
+size_t Size4d::height() const noexcept { return this->y(); }
size_t& Size4d::height() noexcept { return this->y(); }
-const size_t& Size4d::depth() const noexcept { return this->z(); }
+size_t Size4d::depth() const noexcept { return this->z(); }
size_t& Size4d::depth() noexcept { return this->z(); }
-const size_t& Size4d::alpha() const noexcept { return this->w(); }
+size_t Size4d::alpha() const noexcept { return this->w(); }
size_t& Size4d::alpha() noexcept { return this->w(); }
\ No newline at end of file
diff --git a/src/Math/src/vector.cpp b/src/Math/src/vector.cpp
index 31de856cb..fa8711c7e 100644
--- a/src/Math/src/vector.cpp
+++ b/src/Math/src/vector.cpp
@@ -7,7 +7,7 @@ using namespace LiteFX::Math;
// ------------------------------------------------------------------------------------------------
Vector1f::Vector1f() noexcept : Vector() { }
-Vector1f::Vector1f(const Float& v) noexcept : Vector(v) { }
+Vector1f::Vector1f(Float v) noexcept : Vector(v) { }
Vector1f::Vector1f(const Vector1f& _v) noexcept : Vector(_v) { }
Vector1f::Vector1f(const Vector& _v) noexcept : Vector(_v) { }
Vector1f::Vector1f(Vector1f&& _v) noexcept : Vector(_v) { }
@@ -36,11 +36,11 @@ Vector1f& Vector1f::operator=(Vector1f&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const Float& Vector1f::operator[](const unsigned int& i) const noexcept {
+Float Vector1f::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-Float& Vector1f::operator[](const unsigned int& i) noexcept {
+Float& Vector1f::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -81,7 +81,7 @@ Vector1f::operator DirectX::XMVECTOR() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector1u::Vector1u() noexcept : Vector() { }
-Vector1u::Vector1u(const UInt32& v) noexcept : Vector(v) { }
+Vector1u::Vector1u(UInt32 v) noexcept : Vector(v) { }
Vector1u::Vector1u(const Vector1u& _v) noexcept : Vector(_v) { }
Vector1u::Vector1u(const Vector& _v) noexcept : Vector(_v) { }
Vector1u::Vector1u(Vector1u&& _v) noexcept : Vector(_v) { }
@@ -113,11 +113,11 @@ Vector1u& Vector1u::operator=(Vector1u&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const UInt32& Vector1u::operator[](const unsigned int& i) const noexcept {
+UInt32 Vector1u::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-UInt32& Vector1u::operator[](const unsigned int& i) noexcept {
+UInt32& Vector1u::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -158,8 +158,8 @@ Vector1u::operator DirectX::XMVECTOR() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector2f::Vector2f() noexcept : Vector() { }
-Vector2f::Vector2f(const Float& v) noexcept : Vector(v) { }
-Vector2f::Vector2f(const Float& x, const Float& y) noexcept : Vector() {
+Vector2f::Vector2f(Float v) noexcept : Vector(v) { }
+Vector2f::Vector2f(Float x, Float y) noexcept : Vector() {
this->x() = x;
this->y() = y;
}
@@ -192,11 +192,11 @@ Vector2f& Vector2f::operator=(Vector2f&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const Float& Vector2f::operator[](const unsigned int& i) const noexcept {
+Float Vector2f::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-Float& Vector2f::operator[](const unsigned int& i) noexcept {
+Float& Vector2f::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -260,8 +260,8 @@ Vector2f::operator DirectX::XMFLOAT2() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector2u::Vector2u() noexcept : Vector() { }
-Vector2u::Vector2u(const UInt32& v) noexcept : Vector(v) { }
-Vector2u::Vector2u(const UInt32& x, const UInt32& y) noexcept : Vector() {
+Vector2u::Vector2u(UInt32 v) noexcept : Vector(v) { }
+Vector2u::Vector2u(UInt32 x, UInt32 y) noexcept : Vector() {
this->x() = x;
this->y() = y;
}
@@ -294,11 +294,11 @@ Vector2u& Vector2u::operator=(Vector2u&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const UInt32& Vector2u::operator[](const unsigned int& i) const noexcept {
+UInt32 Vector2u::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-UInt32& Vector2u::operator[](const unsigned int& i) noexcept {
+UInt32& Vector2u::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -362,8 +362,8 @@ Vector2u::operator DirectX::XMUINT2() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector2i::Vector2i() noexcept : Vector() { }
-Vector2i::Vector2i(const Int32& v) noexcept : Vector(v) { }
-Vector2i::Vector2i(const Int32& x, const Int32& y) noexcept : Vector() {
+Vector2i::Vector2i(Int32 v) noexcept : Vector(v) { }
+Vector2i::Vector2i(Int32 x, Int32 y) noexcept : Vector() {
this->x() = x;
this->y() = y;
}
@@ -396,11 +396,11 @@ Vector2i& Vector2i::operator=(Vector2i&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const Int32& Vector2i::operator[](const unsigned int& i) const noexcept {
+Int32 Vector2i::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-Int32& Vector2i::operator[](const unsigned int& i) noexcept {
+Int32& Vector2i::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -464,8 +464,8 @@ Vector2i::operator DirectX::XMINT2() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector3f::Vector3f() noexcept : Vector() { }
-Vector3f::Vector3f(const Float& v) noexcept : Vector(v) { }
-Vector3f::Vector3f(const Float& x, const Float& y, const Float& z) noexcept : Vector() {
+Vector3f::Vector3f(Float v) noexcept : Vector(v) { }
+Vector3f::Vector3f(Float x, Float y, Float z) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = z;
@@ -499,11 +499,11 @@ Vector3f& Vector3f::operator=(Vector3f&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const Float& Vector3f::operator[](const unsigned int& i) const noexcept {
+Float Vector3f::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-Float& Vector3f::operator[](const unsigned int& i) noexcept {
+Float& Vector3f::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -571,8 +571,8 @@ Vector3f::operator DirectX::XMFLOAT3() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector3u::Vector3u() noexcept : Vector() { }
-Vector3u::Vector3u(const UInt32& v) noexcept : Vector(v) { }
-Vector3u::Vector3u(const UInt32& x, const UInt32& y, const UInt32& z) noexcept : Vector() {
+Vector3u::Vector3u(UInt32 v) noexcept : Vector(v) { }
+Vector3u::Vector3u(UInt32 x, UInt32 y, UInt32 z) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = z;
@@ -606,11 +606,11 @@ Vector3u& Vector3u::operator=(Vector3u&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const UInt32& Vector3u::operator[](const unsigned int& i) const noexcept {
+UInt32 Vector3u::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-UInt32& Vector3u::operator[](const unsigned int& i) noexcept {
+UInt32& Vector3u::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -678,8 +678,8 @@ Vector3u::operator DirectX::XMUINT3() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector3i::Vector3i() noexcept : Vector() { }
-Vector3i::Vector3i(const Int32& v) noexcept : Vector(v) { }
-Vector3i::Vector3i(const Int32& x, const Int32& y, const Int32& z) noexcept : Vector() {
+Vector3i::Vector3i(Int32 v) noexcept : Vector(v) { }
+Vector3i::Vector3i(Int32 x, Int32 y, Int32 z) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = z;
@@ -713,11 +713,11 @@ Vector3i& Vector3i::operator=(Vector3i&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const Int32& Vector3i::operator[](const unsigned int& i) const noexcept {
+Int32 Vector3i::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-Int32& Vector3i::operator[](const unsigned int& i) noexcept {
+Int32& Vector3i::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -785,8 +785,8 @@ Vector3i::operator DirectX::XMINT3() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector4f::Vector4f() noexcept : Vector() { }
-Vector4f::Vector4f(const Float& v) noexcept : Vector(v) { }
-Vector4f::Vector4f(const Float& x, const Float& y, const Float& z, const Float& w) noexcept : Vector() {
+Vector4f::Vector4f(Float v) noexcept : Vector(v) { }
+Vector4f::Vector4f(Float x, Float y, Float z, Float w) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = z;
@@ -821,11 +821,11 @@ Vector4f& Vector4f::operator=(Vector4f&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const Float& Vector4f::operator[](const unsigned int& i) const noexcept {
+Float Vector4f::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-Float& Vector4f::operator[](const unsigned int& i) noexcept {
+Float& Vector4f::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -897,8 +897,8 @@ Vector4f::operator DirectX::XMFLOAT4() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector4u::Vector4u() noexcept : Vector() { }
-Vector4u::Vector4u(const UInt32& v) noexcept : Vector(v) { }
-Vector4u::Vector4u(const UInt32& x, const UInt32& y, const UInt32& z, const UInt32& w) noexcept : Vector() {
+Vector4u::Vector4u(UInt32 v) noexcept : Vector(v) { }
+Vector4u::Vector4u(UInt32 x, UInt32 y, UInt32 z, UInt32 w) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = z;
@@ -933,11 +933,11 @@ Vector4u& Vector4u::operator=(Vector4u&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const UInt32& Vector4u::operator[](const unsigned int& i) const noexcept {
+UInt32 Vector4u::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-UInt32& Vector4u::operator[](const unsigned int& i) noexcept {
+UInt32& Vector4u::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
@@ -1009,8 +1009,8 @@ Vector4u::operator DirectX::XMUINT4() const noexcept {
// ------------------------------------------------------------------------------------------------
Vector4i::Vector4i() noexcept : Vector() { }
-Vector4i::Vector4i(const Int32& v) noexcept : Vector(v) { }
-Vector4i::Vector4i(const Int32& x, const Int32& y, const Int32& z, const Int32& w) noexcept : Vector() {
+Vector4i::Vector4i(Int32 v) noexcept : Vector(v) { }
+Vector4i::Vector4i(Int32 x, Int32 y, Int32 z, Int32 w) noexcept : Vector() {
this->x() = x;
this->y() = y;
this->z() = z;
@@ -1045,11 +1045,11 @@ Vector4i& Vector4i::operator=(Vector4i&& _other) noexcept {
return this->operator=(std::move(static_cast>(_other)));
}
-const Int32& Vector4i::operator[](const unsigned int& i) const noexcept {
+Int32 Vector4i::operator[](UInt32 i) const noexcept {
return Vector::operator[](i);
}
-Int32& Vector4i::operator[](const unsigned int& i) noexcept {
+Int32& Vector4i::operator[](UInt32 i) noexcept {
return Vector::operator[](i);
}
From 43f180c9ff51535ccede0fda788f78a4b2477b0a Mon Sep 17 00:00:00 2001
From: Carsten Rudolph <18394207+crud89@users.noreply.github.com>
Date: Sat, 4 Nov 2023 09:29:54 +0100
Subject: [PATCH 2/8] Allow conversions at compile-time.
---
.../include/litefx/backends/dx12_api.hpp | 42 ++++++++---------
src/Backends/DirectX12/src/convert.cpp | 42 ++++++++---------
.../include/litefx/backends/vulkan_api.hpp | 46 +++++++++----------
src/Backends/Vulkan/src/convert.cpp | 44 +++++++++---------
4 files changed, 87 insertions(+), 87 deletions(-)
diff --git a/src/Backends/DirectX12/include/litefx/backends/dx12_api.hpp b/src/Backends/DirectX12/include/litefx/backends/dx12_api.hpp
index 971324798..b0648e656 100644
--- a/src/Backends/DirectX12/include/litefx/backends/dx12_api.hpp
+++ b/src/Backends/DirectX12/include/litefx/backends/dx12_api.hpp
@@ -107,109 +107,109 @@ namespace LiteFX::Rendering::Backends {
///
///
///
- Format LITEFX_DIRECTX12_API getFormat(const DXGI_FORMAT& format);
+ constexpr inline Format LITEFX_DIRECTX12_API getFormat(const DXGI_FORMAT& format);
///
///
///
- DXGI_FORMAT LITEFX_DIRECTX12_API getFormat(const Format& format);
+ constexpr inline DXGI_FORMAT LITEFX_DIRECTX12_API getFormat(const Format& format);
///
///
///
- DXGI_FORMAT LITEFX_DIRECTX12_API getFormat(const BufferFormat& format);
+ constexpr inline DXGI_FORMAT LITEFX_DIRECTX12_API getFormat(const BufferFormat& format);
///
///
///
- bool LITEFX_DIRECTX12_API isSRGB(const Format& format);
+ constexpr inline bool LITEFX_DIRECTX12_API isSRGB(const Format& format);
///
///
///
- D3D12_RESOURCE_DIMENSION LITEFX_DIRECTX12_API getImageType(const ImageDimensions& dimensions);
+ constexpr inline D3D12_RESOURCE_DIMENSION LITEFX_DIRECTX12_API getImageType(const ImageDimensions& dimensions);
///
///
///
- PolygonMode LITEFX_DIRECTX12_API getPolygonMode(const D3D12_FILL_MODE& mode);
+ constexpr inline PolygonMode LITEFX_DIRECTX12_API getPolygonMode(const D3D12_FILL_MODE& mode);
///
///
///
- D3D12_FILL_MODE LITEFX_DIRECTX12_API getPolygonMode(const PolygonMode& mode);
+ constexpr inline D3D12_FILL_MODE LITEFX_DIRECTX12_API getPolygonMode(const PolygonMode& mode);
///
///
///
- CullMode LITEFX_DIRECTX12_API getCullMode(const D3D12_CULL_MODE& mode);
+ constexpr inline CullMode LITEFX_DIRECTX12_API getCullMode(const D3D12_CULL_MODE& mode);
///
///
///
- D3D12_CULL_MODE LITEFX_DIRECTX12_API getCullMode(const CullMode& mode);
+ constexpr inline D3D12_CULL_MODE LITEFX_DIRECTX12_API getCullMode(const CullMode& mode);
///
///
///
- PrimitiveTopology LITEFX_DIRECTX12_API getPrimitiveTopology(const D3D12_PRIMITIVE_TOPOLOGY& topology);
+ constexpr inline PrimitiveTopology LITEFX_DIRECTX12_API getPrimitiveTopology(const D3D12_PRIMITIVE_TOPOLOGY& topology);
///
///
///
- D3D12_PRIMITIVE_TOPOLOGY LITEFX_DIRECTX12_API getPrimitiveTopology(const PrimitiveTopology& topology);
+ constexpr inline D3D12_PRIMITIVE_TOPOLOGY LITEFX_DIRECTX12_API getPrimitiveTopology(const PrimitiveTopology& topology);
///
///
///
- D3D12_PRIMITIVE_TOPOLOGY_TYPE LITEFX_DIRECTX12_API getPrimitiveTopologyType(const PrimitiveTopology& topology);
+ constexpr inline D3D12_PRIMITIVE_TOPOLOGY_TYPE LITEFX_DIRECTX12_API getPrimitiveTopologyType(const PrimitiveTopology& topology);
///
///
///
- LPCTSTR LITEFX_DIRECTX12_API getSemanticName(const AttributeSemantic& semantic);
+ constexpr inline LPCTSTR LITEFX_DIRECTX12_API getSemanticName(const AttributeSemantic& semantic);
///
///
///
///
///
- String LITEFX_DIRECTX12_API getVendorName(const UInt32& vendorId);
+ constexpr inline String LITEFX_DIRECTX12_API getVendorName(const UInt32& vendorId);
///
///
///
- D3D12_COMPARISON_FUNC LITEFX_DIRECTX12_API getCompareOp(const CompareOperation& compareOp);
+ constexpr inline D3D12_COMPARISON_FUNC LITEFX_DIRECTX12_API getCompareOp(const CompareOperation& compareOp);
///
///
///
- D3D12_STENCIL_OP LITEFX_DIRECTX12_API getStencilOp(const StencilOperation& stencilOp);
+ constexpr inline D3D12_STENCIL_OP LITEFX_DIRECTX12_API getStencilOp(const StencilOperation& stencilOp);
///
///
///
- D3D12_BLEND LITEFX_DIRECTX12_API getBlendFactor(const BlendFactor& blendFactor);
+ constexpr inline D3D12_BLEND LITEFX_DIRECTX12_API getBlendFactor(const BlendFactor& blendFactor);
///
///
///
- D3D12_BLEND_OP LITEFX_DIRECTX12_API getBlendOperation(const BlendOperation& blendOperation);
+ constexpr inline D3D12_BLEND_OP LITEFX_DIRECTX12_API getBlendOperation(const BlendOperation& blendOperation);
///
///
///
- D3D12_BARRIER_SYNC LITEFX_DIRECTX12_API getPipelineStage(const PipelineStage& pipelineStage);
+ constexpr inline D3D12_BARRIER_SYNC LITEFX_DIRECTX12_API getPipelineStage(const PipelineStage& pipelineStage);
///
///
///
- D3D12_BARRIER_ACCESS LITEFX_DIRECTX12_API getResourceAccess(const ResourceAccess& resourceAccess);
+ constexpr inline D3D12_BARRIER_ACCESS LITEFX_DIRECTX12_API getResourceAccess(const ResourceAccess& resourceAccess);
///
///
///
- D3D12_BARRIER_LAYOUT LITEFX_DIRECTX12_API getImageLayout(const ImageLayout& imageLayout);
+ constexpr inline D3D12_BARRIER_LAYOUT LITEFX_DIRECTX12_API getImageLayout(const ImageLayout& imageLayout);
}
///
diff --git a/src/Backends/DirectX12/src/convert.cpp b/src/Backends/DirectX12/src/convert.cpp
index 6f9cb3f9b..14c09ade2 100644
--- a/src/Backends/DirectX12/src/convert.cpp
+++ b/src/Backends/DirectX12/src/convert.cpp
@@ -2,7 +2,7 @@
using namespace LiteFX::Rendering::Backends;
-Format LiteFX::Rendering::Backends::DX12::getFormat(const DXGI_FORMAT& format)
+constexpr Format LiteFX::Rendering::Backends::DX12::getFormat(const DXGI_FORMAT& format)
{
switch (format)
{
@@ -149,7 +149,7 @@ Format LiteFX::Rendering::Backends::DX12::getFormat(const DXGI_FORMAT& format)
}
}
-DXGI_FORMAT LiteFX::Rendering::Backends::DX12::getFormat(const Format& format)
+constexpr DXGI_FORMAT LiteFX::Rendering::Backends::DX12::getFormat(const Format& format)
{
switch (format)
{
@@ -294,7 +294,7 @@ DXGI_FORMAT LiteFX::Rendering::Backends::DX12::getFormat(const Format& format)
}
}
-DXGI_FORMAT LiteFX::Rendering::Backends::DX12::getFormat(const BufferFormat& format)
+constexpr DXGI_FORMAT LiteFX::Rendering::Backends::DX12::getFormat(const BufferFormat& format)
{
switch (format)
{
@@ -345,7 +345,7 @@ DXGI_FORMAT LiteFX::Rendering::Backends::DX12::getFormat(const BufferFormat& for
}
}
-bool LiteFX::Rendering::Backends::DX12::isSRGB(const Format& format)
+constexpr bool LiteFX::Rendering::Backends::DX12::isSRGB(const Format& format)
{
return
format == Format::A8B8G8R8_SRGB ||
@@ -362,7 +362,7 @@ bool LiteFX::Rendering::Backends::DX12::isSRGB(const Format& format)
format == Format::R8_SRGB;
}
-D3D12_RESOURCE_DIMENSION LiteFX::Rendering::Backends::DX12::getImageType(const ImageDimensions& dimensions)
+constexpr D3D12_RESOURCE_DIMENSION LiteFX::Rendering::Backends::DX12::getImageType(const ImageDimensions& dimensions)
{
switch (dimensions)
{
@@ -378,7 +378,7 @@ D3D12_RESOURCE_DIMENSION LiteFX::Rendering::Backends::DX12::getImageType(const I
}
}
-PolygonMode LiteFX::Rendering::Backends::DX12::getPolygonMode(const D3D12_FILL_MODE& mode)
+constexpr PolygonMode LiteFX::Rendering::Backends::DX12::getPolygonMode(const D3D12_FILL_MODE& mode)
{
switch (mode)
{
@@ -391,7 +391,7 @@ PolygonMode LiteFX::Rendering::Backends::DX12::getPolygonMode(const D3D12_FILL_M
}
}
-D3D12_FILL_MODE LiteFX::Rendering::Backends::DX12::getPolygonMode(const PolygonMode& mode)
+constexpr D3D12_FILL_MODE LiteFX::Rendering::Backends::DX12::getPolygonMode(const PolygonMode& mode)
{
switch (mode)
{
@@ -404,7 +404,7 @@ D3D12_FILL_MODE LiteFX::Rendering::Backends::DX12::getPolygonMode(const PolygonM
}
}
-CullMode LiteFX::Rendering::Backends::DX12::getCullMode(const D3D12_CULL_MODE& mode)
+constexpr CullMode LiteFX::Rendering::Backends::DX12::getCullMode(const D3D12_CULL_MODE& mode)
{
switch (mode)
{
@@ -419,7 +419,7 @@ CullMode LiteFX::Rendering::Backends::DX12::getCullMode(const D3D12_CULL_MODE& m
}
}
-D3D12_CULL_MODE LiteFX::Rendering::Backends::DX12::getCullMode(const CullMode& mode)
+constexpr D3D12_CULL_MODE LiteFX::Rendering::Backends::DX12::getCullMode(const CullMode& mode)
{
switch (mode)
{
@@ -434,7 +434,7 @@ D3D12_CULL_MODE LiteFX::Rendering::Backends::DX12::getCullMode(const CullMode& m
}
}
-PrimitiveTopology LiteFX::Rendering::Backends::DX12::getPrimitiveTopology(const D3D12_PRIMITIVE_TOPOLOGY& topology)
+constexpr PrimitiveTopology LiteFX::Rendering::Backends::DX12::getPrimitiveTopology(const D3D12_PRIMITIVE_TOPOLOGY& topology)
{
switch (topology)
{
@@ -453,7 +453,7 @@ PrimitiveTopology LiteFX::Rendering::Backends::DX12::getPrimitiveTopology(const
}
}
-D3D12_PRIMITIVE_TOPOLOGY LiteFX::Rendering::Backends::DX12::getPrimitiveTopology(const PrimitiveTopology& topology)
+constexpr D3D12_PRIMITIVE_TOPOLOGY LiteFX::Rendering::Backends::DX12::getPrimitiveTopology(const PrimitiveTopology& topology)
{
switch (topology)
{
@@ -472,7 +472,7 @@ D3D12_PRIMITIVE_TOPOLOGY LiteFX::Rendering::Backends::DX12::getPrimitiveTopology
}
}
-D3D12_PRIMITIVE_TOPOLOGY_TYPE LiteFX::Rendering::Backends::DX12::getPrimitiveTopologyType(const PrimitiveTopology& topology)
+constexpr D3D12_PRIMITIVE_TOPOLOGY_TYPE LiteFX::Rendering::Backends::DX12::getPrimitiveTopologyType(const PrimitiveTopology& topology)
{
switch (topology)
{
@@ -489,7 +489,7 @@ D3D12_PRIMITIVE_TOPOLOGY_TYPE LiteFX::Rendering::Backends::DX12::getPrimitiveTop
}
}
-LPCTSTR LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getSemanticName(const AttributeSemantic& semantic)
+constexpr LPCTSTR LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getSemanticName(const AttributeSemantic& semantic)
{
switch (semantic)
{
@@ -518,7 +518,7 @@ LPCTSTR LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getSemanticName(
}
}
-String LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getVendorName(const UInt32& vendorId)
+constexpr String LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getVendorName(const UInt32& vendorId)
{
switch (vendorId)
{
@@ -538,7 +538,7 @@ String LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getVendorName(con
}
}
-D3D12_COMPARISON_FUNC LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getCompareOp(const CompareOperation& compareOp)
+constexpr D3D12_COMPARISON_FUNC LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getCompareOp(const CompareOperation& compareOp)
{
switch (compareOp) {
case CompareOperation::Never: return D3D12_COMPARISON_FUNC::D3D12_COMPARISON_FUNC_NEVER;
@@ -553,7 +553,7 @@ D3D12_COMPARISON_FUNC LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::ge
}
}
-D3D12_STENCIL_OP LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getStencilOp(const StencilOperation& stencilOp)
+constexpr D3D12_STENCIL_OP LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getStencilOp(const StencilOperation& stencilOp)
{
switch (stencilOp) {
case StencilOperation::Keep: return D3D12_STENCIL_OP::D3D12_STENCIL_OP_KEEP;
@@ -568,7 +568,7 @@ D3D12_STENCIL_OP LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getSten
}
}
-D3D12_BLEND LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getBlendFactor(const BlendFactor& blendFactor)
+constexpr D3D12_BLEND LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getBlendFactor(const BlendFactor& blendFactor)
{
switch (blendFactor) {
case BlendFactor::Zero: return D3D12_BLEND_ZERO;
@@ -594,7 +594,7 @@ D3D12_BLEND LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getBlendFact
}
}
-D3D12_BLEND_OP LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getBlendOperation(const BlendOperation& blendOperation)
+constexpr D3D12_BLEND_OP LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getBlendOperation(const BlendOperation& blendOperation)
{
switch (blendOperation) {
case BlendOperation::Add: return D3D12_BLEND_OP_ADD;
@@ -606,7 +606,7 @@ D3D12_BLEND_OP LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getBlendO
}
}
-D3D12_BARRIER_SYNC LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getPipelineStage(const PipelineStage& pipelineStage)
+constexpr D3D12_BARRIER_SYNC LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getPipelineStage(const PipelineStage& pipelineStage)
{
if (pipelineStage == PipelineStage::None)
return D3D12_BARRIER_SYNC_NONE;
@@ -649,7 +649,7 @@ D3D12_BARRIER_SYNC LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getPi
return sync;
}
-D3D12_BARRIER_ACCESS LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getResourceAccess(const ResourceAccess& resourceAccess)
+constexpr D3D12_BARRIER_ACCESS LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getResourceAccess(const ResourceAccess& resourceAccess)
{
if (resourceAccess == ResourceAccess::None)
return D3D12_BARRIER_ACCESS_NO_ACCESS;
@@ -701,7 +701,7 @@ D3D12_BARRIER_ACCESS LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::get
return access;
}
-D3D12_BARRIER_LAYOUT LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getImageLayout(const ImageLayout& imageLayout)
+constexpr D3D12_BARRIER_LAYOUT LITEFX_DIRECTX12_API LiteFX::Rendering::Backends::DX12::getImageLayout(const ImageLayout& imageLayout)
{
switch (imageLayout) {
case ImageLayout::Common: return D3D12_BARRIER_LAYOUT_COMMON;
diff --git a/src/Backends/Vulkan/include/litefx/backends/vulkan_api.hpp b/src/Backends/Vulkan/include/litefx/backends/vulkan_api.hpp
index e1e82a373..9ade5b83f 100644
--- a/src/Backends/Vulkan/include/litefx/backends/vulkan_api.hpp
+++ b/src/Backends/Vulkan/include/litefx/backends/vulkan_api.hpp
@@ -86,117 +86,117 @@ namespace LiteFX::Rendering::Backends {
///
///
///
- Format LITEFX_VULKAN_API getFormat(const VkFormat& format);
+ constexpr inline Format LITEFX_VULKAN_API getFormat(const VkFormat& format);
///
///
///
- VkFormat LITEFX_VULKAN_API getFormat(const Format& format);
+ constexpr inline VkFormat LITEFX_VULKAN_API getFormat(const Format& format);
///
///
///
- //BufferFormat LITEFX_VULKAN_API getFormat(const VkFormat& format);
+ //constexpr inline BufferFormat LITEFX_VULKAN_API getFormat(const VkFormat& format);
///
///
///
- VkFormat LITEFX_VULKAN_API getFormat(const BufferFormat& format);
+ constexpr inline VkFormat LITEFX_VULKAN_API getFormat(const BufferFormat& format);
///
///
///
- PolygonMode LITEFX_VULKAN_API getPolygonMode(const VkPolygonMode& mode);
+ constexpr inline PolygonMode LITEFX_VULKAN_API getPolygonMode(const VkPolygonMode& mode);
///
///
///
- VkPolygonMode LITEFX_VULKAN_API getPolygonMode(const PolygonMode& mode);
+ constexpr inline VkPolygonMode LITEFX_VULKAN_API getPolygonMode(const PolygonMode& mode);
///
///
///
- CullMode LITEFX_VULKAN_API getCullMode(const VkCullModeFlags& mode);
+ constexpr inline CullMode LITEFX_VULKAN_API getCullMode(const VkCullModeFlags& mode);
///
///
///
- VkCullModeFlags LITEFX_VULKAN_API getCullMode(const CullMode& mode);
+ constexpr inline VkCullModeFlags LITEFX_VULKAN_API getCullMode(const CullMode& mode);
///
///
///
- PrimitiveTopology LITEFX_VULKAN_API getPrimitiveTopology(const VkPrimitiveTopology& topology);
+ constexpr inline PrimitiveTopology LITEFX_VULKAN_API getPrimitiveTopology(const VkPrimitiveTopology& topology);
///
///
///
- VkPrimitiveTopology LITEFX_VULKAN_API getPrimitiveTopology(const PrimitiveTopology& topology);
+ constexpr inline VkPrimitiveTopology LITEFX_VULKAN_API getPrimitiveTopology(const PrimitiveTopology& topology);
///
///
///
- ShaderStage LITEFX_VULKAN_API getShaderStage(const VkShaderStageFlagBits& shaderType);
+ constexpr inline ShaderStage LITEFX_VULKAN_API getShaderStage(const VkShaderStageFlagBits& shaderType);
///
///
///
- VkShaderStageFlagBits LITEFX_VULKAN_API getShaderStage(const ShaderStage& shaderType);
+ constexpr inline VkShaderStageFlagBits LITEFX_VULKAN_API getShaderStage(const ShaderStage& shaderType);
///
///
///
- MultiSamplingLevel LITEFX_VULKAN_API getSamples(const VkSampleCountFlagBits& samples);
+ constexpr inline MultiSamplingLevel LITEFX_VULKAN_API getSamples(const VkSampleCountFlagBits& samples);
///
///
///
- VkImageType LITEFX_VULKAN_API getImageType(const ImageDimensions& dimension);
+ constexpr inline VkImageType LITEFX_VULKAN_API getImageType(const ImageDimensions& dimension);
///
///
///
- VkImageViewType LITEFX_VULKAN_API getImageViewType(const ImageDimensions& dimension, const UInt32& layers = 1);
+ constexpr inline VkImageViewType LITEFX_VULKAN_API getImageViewType(const ImageDimensions& dimension, const UInt32& layers = 1);
///
///
///
- VkSampleCountFlagBits LITEFX_VULKAN_API getSamples(const MultiSamplingLevel& samples);
+ constexpr inline VkSampleCountFlagBits LITEFX_VULKAN_API getSamples(const MultiSamplingLevel& samples);
///
///
///
- VkCompareOp LITEFX_VULKAN_API getCompareOp(const CompareOperation& compareOp);
+ constexpr inline VkCompareOp LITEFX_VULKAN_API getCompareOp(const CompareOperation& compareOp);
///
///
///
- VkStencilOp LITEFX_VULKAN_API getStencilOp(const StencilOperation& stencilOp);
+ constexpr inline VkStencilOp LITEFX_VULKAN_API getStencilOp(const StencilOperation& stencilOp);
///
///
///
- VkBlendFactor LITEFX_VULKAN_API getBlendFactor(const BlendFactor& blendFactor);
+ constexpr inline VkBlendFactor LITEFX_VULKAN_API getBlendFactor(const BlendFactor& blendFactor);
///
///
///
- VkBlendOp LITEFX_VULKAN_API getBlendOperation(const BlendOperation& blendOperation);
+ constexpr inline VkBlendOp LITEFX_VULKAN_API getBlendOperation(const BlendOperation& blendOperation);
///
///
///
- VkPipelineStageFlags LITEFX_VULKAN_API getPipelineStage(const PipelineStage& pipelineStage);
+ constexpr inline VkPipelineStageFlags LITEFX_VULKAN_API getPipelineStage(const PipelineStage& pipelineStage);
///
///
///
- VkAccessFlags LITEFX_VULKAN_API getResourceAccess(const ResourceAccess& resourceAccess);
+ constexpr inline VkAccessFlags LITEFX_VULKAN_API getResourceAccess(const ResourceAccess& resourceAccess);
///
///
///
- VkImageLayout LITEFX_VULKAN_API getImageLayout(const ImageLayout& imageLayout);
+ constexpr inline VkImageLayout LITEFX_VULKAN_API getImageLayout(const ImageLayout& imageLayout);
}
///
diff --git a/src/Backends/Vulkan/src/convert.cpp b/src/Backends/Vulkan/src/convert.cpp
index 9f42b0dcf..e4621ed14 100644
--- a/src/Backends/Vulkan/src/convert.cpp
+++ b/src/Backends/Vulkan/src/convert.cpp
@@ -2,7 +2,7 @@
using namespace LiteFX::Rendering::Backends;
-Format LiteFX::Rendering::Backends::Vk::getFormat(const VkFormat& format)
+constexpr Format LiteFX::Rendering::Backends::Vk::getFormat(const VkFormat& format)
{
switch (format)
{
@@ -303,7 +303,7 @@ Format LiteFX::Rendering::Backends::Vk::getFormat(const VkFormat& format)
}
}
-VkFormat LiteFX::Rendering::Backends::Vk::getFormat(const Format& format)
+constexpr VkFormat LiteFX::Rendering::Backends::Vk::getFormat(const Format& format)
{
switch (format)
{
@@ -604,7 +604,7 @@ VkFormat LiteFX::Rendering::Backends::Vk::getFormat(const Format& format)
}
}
-VkFormat LiteFX::Rendering::Backends::Vk::getFormat(const BufferFormat& format)
+constexpr VkFormat LiteFX::Rendering::Backends::Vk::getFormat(const BufferFormat& format)
{
switch (format)
{
@@ -661,7 +661,7 @@ VkFormat LiteFX::Rendering::Backends::Vk::getFormat(const BufferFormat& format)
}
}
-PolygonMode LiteFX::Rendering::Backends::Vk::getPolygonMode(const VkPolygonMode& mode)
+constexpr PolygonMode LiteFX::Rendering::Backends::Vk::getPolygonMode(const VkPolygonMode& mode)
{
switch (mode)
{
@@ -676,7 +676,7 @@ PolygonMode LiteFX::Rendering::Backends::Vk::getPolygonMode(const VkPolygonMode&
}
}
-VkPolygonMode LiteFX::Rendering::Backends::Vk::getPolygonMode(const PolygonMode& mode)
+constexpr VkPolygonMode LiteFX::Rendering::Backends::Vk::getPolygonMode(const PolygonMode& mode)
{
switch (mode)
{
@@ -691,7 +691,7 @@ VkPolygonMode LiteFX::Rendering::Backends::Vk::getPolygonMode(const PolygonMode&
}
}
-CullMode LiteFX::Rendering::Backends::Vk::getCullMode(const VkCullModeFlags& mode)
+constexpr CullMode LiteFX::Rendering::Backends::Vk::getCullMode(const VkCullModeFlags& mode)
{
switch (mode)
{
@@ -708,7 +708,7 @@ CullMode LiteFX::Rendering::Backends::Vk::getCullMode(const VkCullModeFlags& mod
}
}
-VkCullModeFlags LiteFX::Rendering::Backends::Vk::getCullMode(const CullMode& mode)
+constexpr VkCullModeFlags LiteFX::Rendering::Backends::Vk::getCullMode(const CullMode& mode)
{
switch (mode)
{
@@ -725,7 +725,7 @@ VkCullModeFlags LiteFX::Rendering::Backends::Vk::getCullMode(const CullMode& mod
}
}
-PrimitiveTopology LiteFX::Rendering::Backends::Vk::getPrimitiveTopology(const VkPrimitiveTopology& topology)
+constexpr PrimitiveTopology LiteFX::Rendering::Backends::Vk::getPrimitiveTopology(const VkPrimitiveTopology& topology)
{
switch (topology)
{
@@ -744,7 +744,7 @@ PrimitiveTopology LiteFX::Rendering::Backends::Vk::getPrimitiveTopology(const Vk
}
}
-VkPrimitiveTopology LiteFX::Rendering::Backends::Vk::getPrimitiveTopology(const PrimitiveTopology& topology)
+constexpr VkPrimitiveTopology LiteFX::Rendering::Backends::Vk::getPrimitiveTopology(const PrimitiveTopology& topology)
{
switch (topology)
{
@@ -763,7 +763,7 @@ VkPrimitiveTopology LiteFX::Rendering::Backends::Vk::getPrimitiveTopology(const
}
}
-ShaderStage LiteFX::Rendering::Backends::Vk::getShaderStage(const VkShaderStageFlagBits& shaderType)
+constexpr ShaderStage LiteFX::Rendering::Backends::Vk::getShaderStage(const VkShaderStageFlagBits& shaderType)
{
switch (shaderType)
{
@@ -784,7 +784,7 @@ ShaderStage LiteFX::Rendering::Backends::Vk::getShaderStage(const VkShaderStageF
}
}
-VkShaderStageFlagBits LiteFX::Rendering::Backends::Vk::getShaderStage(const ShaderStage& shaderType)
+constexpr VkShaderStageFlagBits LiteFX::Rendering::Backends::Vk::getShaderStage(const ShaderStage& shaderType)
{
switch (shaderType)
{
@@ -806,7 +806,7 @@ VkShaderStageFlagBits LiteFX::Rendering::Backends::Vk::getShaderStage(const Shad
}
}
-MultiSamplingLevel LiteFX::Rendering::Backends::Vk::getSamples(const VkSampleCountFlagBits& samples)
+constexpr MultiSamplingLevel LiteFX::Rendering::Backends::Vk::getSamples(const VkSampleCountFlagBits& samples)
{
switch (samples)
{
@@ -829,7 +829,7 @@ MultiSamplingLevel LiteFX::Rendering::Backends::Vk::getSamples(const VkSampleCou
}
}
-VkImageType LiteFX::Rendering::Backends::Vk::getImageType(const ImageDimensions& dimension)
+constexpr VkImageType LiteFX::Rendering::Backends::Vk::getImageType(const ImageDimensions& dimension)
{
switch (dimension)
{
@@ -845,7 +845,7 @@ VkImageType LiteFX::Rendering::Backends::Vk::getImageType(const ImageDimensions&
}
}
-VkImageViewType LiteFX::Rendering::Backends::Vk::getImageViewType(const ImageDimensions& dimension, const UInt32& layers)
+constexpr VkImageViewType LiteFX::Rendering::Backends::Vk::getImageViewType(const ImageDimensions& dimension, const UInt32& layers)
{
switch (dimension)
{
@@ -862,7 +862,7 @@ VkImageViewType LiteFX::Rendering::Backends::Vk::getImageViewType(const ImageDim
}
}
-VkSampleCountFlagBits LiteFX::Rendering::Backends::Vk::getSamples(const MultiSamplingLevel& samples)
+constexpr VkSampleCountFlagBits LiteFX::Rendering::Backends::Vk::getSamples(const MultiSamplingLevel& samples)
{
switch (samples)
{
@@ -885,7 +885,7 @@ VkSampleCountFlagBits LiteFX::Rendering::Backends::Vk::getSamples(const MultiSam
}
}
-VkCompareOp LiteFX::Rendering::Backends::Vk::getCompareOp(const CompareOperation& compareOp)
+constexpr VkCompareOp LiteFX::Rendering::Backends::Vk::getCompareOp(const CompareOperation& compareOp)
{
switch (compareOp) {
case CompareOperation::Never: return VkCompareOp::VK_COMPARE_OP_NEVER;
@@ -900,7 +900,7 @@ VkCompareOp LiteFX::Rendering::Backends::Vk::getCompareOp(const CompareOperation
}
}
-VkStencilOp LiteFX::Rendering::Backends::Vk::getStencilOp(const StencilOperation& stencilOp)
+constexpr VkStencilOp LiteFX::Rendering::Backends::Vk::getStencilOp(const StencilOperation& stencilOp)
{
switch (stencilOp) {
case StencilOperation::Keep: return VkStencilOp::VK_STENCIL_OP_KEEP;
@@ -915,7 +915,7 @@ VkStencilOp LiteFX::Rendering::Backends::Vk::getStencilOp(const StencilOperation
}
}
-VkBlendFactor LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getBlendFactor(const BlendFactor& blendFactor)
+constexpr VkBlendFactor LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getBlendFactor(const BlendFactor& blendFactor)
{
switch (blendFactor) {
case BlendFactor::Zero: return VkBlendFactor::VK_BLEND_FACTOR_ZERO;
@@ -941,7 +941,7 @@ VkBlendFactor LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getBlendFactor(
}
}
-VkBlendOp LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getBlendOperation(const BlendOperation& blendOperation)
+constexpr VkBlendOp LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getBlendOperation(const BlendOperation& blendOperation)
{
switch (blendOperation) {
case BlendOperation::Add: return VkBlendOp::VK_BLEND_OP_ADD;
@@ -953,7 +953,7 @@ VkBlendOp LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getBlendOperation(c
}
}
-VkPipelineStageFlags LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getPipelineStage(const PipelineStage& pipelineStage)
+constexpr VkPipelineStageFlags LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getPipelineStage(const PipelineStage& pipelineStage)
{
if (pipelineStage == PipelineStage::None)
return VK_PIPELINE_STAGE_NONE;
@@ -1000,7 +1000,7 @@ VkPipelineStageFlags LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getPipel
return sync;
}
-VkAccessFlags LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getResourceAccess(const ResourceAccess& resourceAccess)
+constexpr VkAccessFlags LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getResourceAccess(const ResourceAccess& resourceAccess)
{
if (resourceAccess == ResourceAccess::None)
return VK_ACCESS_NONE;
@@ -1052,7 +1052,7 @@ VkAccessFlags LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getResourceAcce
return access;
}
-VkImageLayout LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getImageLayout(const ImageLayout& imageLayout)
+constexpr VkImageLayout LITEFX_VULKAN_API LiteFX::Rendering::Backends::Vk::getImageLayout(const ImageLayout& imageLayout)
{
switch (imageLayout) {
case ImageLayout::Common: return VK_IMAGE_LAYOUT_GENERAL;
From 03b6bfcf81ad83bed5f1851b9232231004863128 Mon Sep 17 00:00:00 2001
From: Carsten Rudolph <18394207+crud89@users.noreply.github.com>
Date: Sat, 4 Nov 2023 09:55:19 +0100
Subject: [PATCH 3/8] Pass enumerations by value.
---
.../include/litefx/backends/dx12.hpp | 110 +++++-----
.../include/litefx/backends/dx12_api.hpp | 28 +--
src/Backends/DirectX12/src/barrier.cpp | 22 +-
src/Backends/DirectX12/src/buffer.cpp | 10 +-
src/Backends/DirectX12/src/buffer.h | 8 +-
src/Backends/DirectX12/src/convert.cpp | 28 +--
.../DirectX12/src/descriptor_layout.cpp | 8 +-
src/Backends/DirectX12/src/descriptor_set.cpp | 4 +-
.../DirectX12/src/descriptor_set_layout.cpp | 6 +-
src/Backends/DirectX12/src/device.cpp | 12 +-
src/Backends/DirectX12/src/factory.cpp | 28 +--
src/Backends/DirectX12/src/image.cpp | 32 +--
src/Backends/DirectX12/src/image.h | 28 +--
.../DirectX12/src/index_buffer_layout.cpp | 8 +-
.../DirectX12/src/pipeline_layout.cpp | 4 +-
.../DirectX12/src/push_constants_layout.cpp | 2 +-
.../DirectX12/src/push_constants_range.cpp | 6 +-
src/Backends/DirectX12/src/queue.cpp | 8 +-
src/Backends/DirectX12/src/rasterizer.cpp | 2 +-
src/Backends/DirectX12/src/render_pass.cpp | 10 +-
src/Backends/DirectX12/src/shader_module.cpp | 8 +-
src/Backends/DirectX12/src/swapchain.cpp | 16 +-
.../DirectX12/src/vertex_buffer_layout.cpp | 2 +-
.../Vulkan/include/litefx/backends/vulkan.hpp | 110 +++++-----
.../include/litefx/backends/vulkan_api.hpp | 30 +--
src/Backends/Vulkan/src/barrier.cpp | 22 +-
src/Backends/Vulkan/src/buffer.cpp | 10 +-
src/Backends/Vulkan/src/buffer.h | 8 +-
src/Backends/Vulkan/src/convert.cpp | 30 +--
src/Backends/Vulkan/src/descriptor_layout.cpp | 8 +-
.../Vulkan/src/descriptor_set_layout.cpp | 6 +-
src/Backends/Vulkan/src/device.cpp | 22 +-
src/Backends/Vulkan/src/factory.cpp | 28 +--
src/Backends/Vulkan/src/image.cpp | 38 ++--
src/Backends/Vulkan/src/image.h | 28 +--
.../Vulkan/src/index_buffer_layout.cpp | 8 +-
.../Vulkan/src/push_constants_layout.cpp | 2 +-
.../Vulkan/src/push_constants_range.cpp | 6 +-
src/Backends/Vulkan/src/queue.cpp | 8 +-
src/Backends/Vulkan/src/rasterizer.cpp | 2 +-
src/Backends/Vulkan/src/render_pass.cpp | 10 +-
src/Backends/Vulkan/src/shader_module.cpp | 8 +-
src/Backends/Vulkan/src/swapchain.cpp | 26 +--
.../Vulkan/src/vertex_buffer_layout.cpp | 2 +-
src/Rendering/include/litefx/rendering.hpp | 88 ++++----
.../include/litefx/rendering_api.hpp | 206 +++++++++---------
src/Rendering/src/buffer_attribute.cpp | 8 +-
src/Rendering/src/convert.cpp | 10 +-
src/Rendering/src/rasterizer.cpp | 10 +-
src/Rendering/src/render_target.cpp | 10 +-
50 files changed, 567 insertions(+), 567 deletions(-)
diff --git a/src/Backends/DirectX12/include/litefx/backends/dx12.hpp b/src/Backends/DirectX12/include/litefx/backends/dx12.hpp
index c585e8dfe..64d078222 100644
--- a/src/Backends/DirectX12/include/litefx/backends/dx12.hpp
+++ b/src/Backends/DirectX12/include/litefx/backends/dx12.hpp
@@ -44,7 +44,7 @@ namespace LiteFX::Rendering::Backends {
virtual const UInt32& binding() const noexcept override;
///
- virtual const BufferType& type() const noexcept override;
+ virtual BufferType type() const noexcept override;
};
///
@@ -60,7 +60,7 @@ namespace LiteFX::Rendering::Backends {
/// Initializes a new index buffer layout
///
/// The type of the indices within the index buffer.
- explicit DirectX12IndexBufferLayout(const IndexType& type);
+ explicit DirectX12IndexBufferLayout(IndexType type);
DirectX12IndexBufferLayout(DirectX12IndexBufferLayout&&) = delete;
DirectX12IndexBufferLayout(const DirectX12IndexBufferLayout&) = delete;
virtual ~DirectX12IndexBufferLayout() noexcept;
@@ -68,7 +68,7 @@ namespace LiteFX::Rendering::Backends {
// IIndexBufferLayout interface.
public:
///
- virtual const IndexType& indexType() const noexcept override;
+ virtual IndexType indexType() const noexcept override;
// IBufferLayout interface.
public:
@@ -79,7 +79,7 @@ namespace LiteFX::Rendering::Backends {
virtual const UInt32& binding() const noexcept override;
///
- virtual const BufferType& type() const noexcept override;
+ virtual BufferType type() const noexcept override;
};
///
@@ -171,7 +171,7 @@ namespace LiteFX::Rendering::Backends {
///
/// The pipeline stage(s) all previous commands have to finish before the barrier is executed.
/// The pipeline stage(s) all subsequent commands are blocked at until the barrier is executed.
- constexpr inline explicit DirectX12Barrier(const PipelineStage& syncBefore, const PipelineStage& syncAfter) noexcept;
+ constexpr inline explicit DirectX12Barrier(PipelineStage syncBefore, PipelineStage syncAfter) noexcept;
DirectX12Barrier(const DirectX12Barrier&) = delete;
DirectX12Barrier(DirectX12Barrier&&) = delete;
constexpr inline virtual ~DirectX12Barrier() noexcept;
@@ -184,31 +184,31 @@ namespace LiteFX::Rendering::Backends {
// Barrier interface.
public:
///
- constexpr inline const PipelineStage& syncBefore() const noexcept override;
+ constexpr inline PipelineStage syncBefore() const noexcept override;
///
- constexpr inline const PipelineStage& syncAfter() const noexcept override;
+ constexpr inline PipelineStage syncAfter() const noexcept override;
///
- constexpr inline void wait(const ResourceAccess& accessBefore, const ResourceAccess& accessAfter) noexcept override;
+ constexpr inline void wait(ResourceAccess accessBefore, ResourceAccess accessAfter) noexcept override;
///
- constexpr inline void transition(IDirectX12Buffer& buffer, const ResourceAccess& accessBefore, const ResourceAccess& accessAfter) override;
+ constexpr inline void transition(IDirectX12Buffer& buffer, ResourceAccess accessBefore, ResourceAccess accessAfter) override;
///
- constexpr inline void transition(IDirectX12Buffer& buffer, const UInt32& element, const ResourceAccess& accessBefore, const ResourceAccess& accessAfter) override;
+ constexpr inline void transition(IDirectX12Buffer& buffer, const UInt32& element, ResourceAccess accessBefore, ResourceAccess accessAfter) override;
///
- constexpr inline void transition(IDirectX12Image& image, const ResourceAccess& accessBefore, const ResourceAccess& accessAfter, const ImageLayout& layout) override;
+ constexpr inline void transition(IDirectX12Image& image, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout layout) override;
///
- constexpr inline void transition(IDirectX12Image& image, const ResourceAccess& accessBefore, const ResourceAccess& accessAfter, const ImageLayout& fromLayout, const ImageLayout& toLayout) override;
+ constexpr inline void transition(IDirectX12Image& image, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout fromLayout, ImageLayout toLayout) override;
///
- constexpr inline void transition(IDirectX12Image& image, const UInt32& level, const UInt32& levels, const UInt32& layer, const UInt32& layers, const UInt32& plane, const ResourceAccess& accessBefore, const ResourceAccess& accessAfter, const ImageLayout& layout) override;
+ constexpr inline void transition(IDirectX12Image& image, const UInt32& level, const UInt32& levels, const UInt32& layer, const UInt32& layers, const UInt32& plane, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout layout) override;
///
- constexpr inline void transition(IDirectX12Image& image, const UInt32& level, const UInt32& levels, const UInt32& layer, const UInt32& layers, const UInt32& plane, const ResourceAccess& accessBefore, const ResourceAccess& accessAfter, const ImageLayout& fromLayout, const ImageLayout& toLayout) override;
+ constexpr inline void transition(IDirectX12Image& image, const UInt32& level, const UInt32& levels, const UInt32& layer, const UInt32& layers, const UInt32& plane, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout fromLayout, ImageLayout toLayout) override;
public:
///
@@ -235,7 +235,7 @@ namespace LiteFX::Rendering::Backends {
/// The shader stage, this module is used in.
/// The file name of the module source.
/// The name of the module entry point.
- explicit DirectX12ShaderModule(const DirectX12Device& device, const ShaderStage& type, const String& fileName, const String& entryPoint = "main");
+ explicit DirectX12ShaderModule(const DirectX12Device& device, ShaderStage type, const String& fileName, const String& entryPoint = "main");
///
/// Initializes a new DirectX 12 shader module.
@@ -245,7 +245,7 @@ namespace LiteFX::Rendering::Backends {
/// The file stream to read the shader module from.
/// The file name of the module source.
/// The name of the module entry point.
- explicit DirectX12ShaderModule(const DirectX12Device& device, const ShaderStage& type, std::istream& stream, const String& name, const String& entryPoint = "main");
+ explicit DirectX12ShaderModule(const DirectX12Device& device, ShaderStage type, std::istream& stream, const String& name, const String& entryPoint = "main");
DirectX12ShaderModule(const DirectX12ShaderModule&) noexcept = delete;
DirectX12ShaderModule(DirectX12ShaderModule&&) noexcept = delete;
virtual ~DirectX12ShaderModule() noexcept;
@@ -259,7 +259,7 @@ namespace LiteFX::Rendering::Backends {
virtual const String& entryPoint() const noexcept override;
///
- virtual const ShaderStage& type() const noexcept override;
+ virtual ShaderStage type() const noexcept override;
};
///
@@ -406,7 +406,7 @@ namespace LiteFX::Rendering::Backends {
/// The binding point for the descriptor.
/// The size of the descriptor.
/// The number of descriptors in the descriptor array.
- explicit DirectX12DescriptorLayout(const DescriptorType& type, const UInt32& binding, const size_t& elementSize, const UInt32& descriptors = 1);
+ explicit DirectX12DescriptorLayout(DescriptorType type, const UInt32& binding, const size_t& elementSize, const UInt32& descriptors = 1);
///
/// Initializes a new DirectX 12 descriptor layout for a static sampler.
@@ -422,7 +422,7 @@ namespace LiteFX::Rendering::Backends {
// IDescriptorLayout interface.
public:
///
- virtual const DescriptorType& descriptorType() const noexcept override;
+ virtual DescriptorType descriptorType() const noexcept override;
///
virtual const UInt32& descriptors() const noexcept override;
@@ -439,7 +439,7 @@ namespace LiteFX::Rendering::Backends {
virtual const UInt32& binding() const noexcept override;
///
- virtual const BufferType& type() const noexcept override;
+ virtual BufferType type() const noexcept override;
};
///
@@ -464,7 +464,7 @@ namespace LiteFX::Rendering::Backends {
/// The descriptor layouts of the descriptors within the descriptor set.
/// The space or set id of the descriptor set.
/// The shader stages, the descriptor sets are bound to.
- explicit DirectX12DescriptorSetLayout(const DirectX12Device& device, Enumerable>&& descriptorLayouts, const UInt32& space, const ShaderStage& stages);
+ explicit DirectX12DescriptorSetLayout(const DirectX12Device& device, Enumerable>&& descriptorLayouts, const UInt32& space, ShaderStage stages);
DirectX12DescriptorSetLayout(DirectX12DescriptorSetLayout&&) = delete;
DirectX12DescriptorSetLayout(const DirectX12DescriptorSetLayout&) = delete;
virtual ~DirectX12DescriptorSetLayout() noexcept;
@@ -525,7 +525,7 @@ namespace LiteFX::Rendering::Backends {
virtual const UInt32& space() const noexcept override;
///
- virtual const ShaderStage& shaderStages() const noexcept override;
+ virtual ShaderStage shaderStages() const noexcept override;
///
virtual UInt32 uniforms() const noexcept override;
@@ -588,7 +588,7 @@ namespace LiteFX::Rendering::Backends {
/// The size of the push constants range.
/// The space from which the push constants of the range will be accessible in the shader.
/// The register from which the push constants of the range will be accessible in the shader.
- explicit DirectX12PushConstantsRange(const ShaderStage& shaderStages, const UInt32& offset, const UInt32& size, const UInt32& space, const UInt32& binding);
+ explicit DirectX12PushConstantsRange(ShaderStage shaderStages, const UInt32& offset, const UInt32& size, const UInt32& space, const UInt32& binding);
DirectX12PushConstantsRange(const DirectX12PushConstantsRange&) = delete;
DirectX12PushConstantsRange(DirectX12PushConstantsRange&&) = delete;
virtual ~DirectX12PushConstantsRange() noexcept;
@@ -607,7 +607,7 @@ namespace LiteFX::Rendering::Backends {
virtual const UInt32& size() const noexcept override;
///
- virtual const ShaderStage& stage() const noexcept override;
+ virtual ShaderStage stage() const noexcept override;
public:
///
@@ -663,7 +663,7 @@ namespace LiteFX::Rendering::Backends {
virtual const UInt32& size() const noexcept override;
///
- virtual const DirectX12PushConstantsRange& range(const ShaderStage& stage) const override;
+ virtual const DirectX12PushConstantsRange& range(ShaderStage stage) const override;
///
virtual Enumerable ranges() const noexcept override;
@@ -778,7 +778,7 @@ namespace LiteFX::Rendering::Backends {
/// The cull order used by the pipeline.
/// The line width used by the pipeline.
/// The rasterizer depth/stencil state.
- explicit DirectX12Rasterizer(const PolygonMode& polygonMode, const CullMode& cullMode, const CullOrder& cullOrder, const Float& lineWidth = 1.f, const DepthStencilState& depthStencilState = {}) noexcept;
+ explicit DirectX12Rasterizer(PolygonMode polygonMode, CullMode cullMode, CullOrder cullOrder, const Float& lineWidth = 1.f, const DepthStencilState& depthStencilState = {}) noexcept;
DirectX12Rasterizer(DirectX12Rasterizer&&) noexcept = delete;
DirectX12Rasterizer(const DirectX12Rasterizer&) noexcept = delete;
virtual ~DirectX12Rasterizer() noexcept;
@@ -1151,7 +1151,7 @@ namespace LiteFX::Rendering::Backends {
/// The render targets that are output by the render pass.
/// The number of samples for the render targets in this render pass.
/// The input attachments that are read by the render pass.
- explicit DirectX12RenderPass(const DirectX12Device& device, Span renderTargets, const UInt32& commandBuffers = 1, const MultiSamplingLevel& samples = MultiSamplingLevel::x1, Span inputAttachments = { });
+ explicit DirectX12RenderPass(const DirectX12Device& device, Span renderTargets, const UInt32& commandBuffers = 1, MultiSamplingLevel samples = MultiSamplingLevel::x1, Span inputAttachments = { });
///
/// Creates and initializes a new DirectX 12 render pass instance.
@@ -1162,7 +1162,7 @@ namespace LiteFX::Rendering::Backends {
/// The render targets that are output by the render pass.
/// The number of samples for the render targets in this render pass.
/// The input attachments that are read by the render pass.
- explicit DirectX12RenderPass(const DirectX12Device& device, const String& name, Span renderTargets, const UInt32& commandBuffers = 1, const MultiSamplingLevel& samples = MultiSamplingLevel::x1, Span inputAttachments = { });
+ explicit DirectX12RenderPass(const DirectX12Device& device, const String& name, Span renderTargets, const UInt32& commandBuffers = 1, MultiSamplingLevel samples = MultiSamplingLevel::x1, Span inputAttachments = { });
DirectX12RenderPass(const DirectX12RenderPass&) = delete;
DirectX12RenderPass(DirectX12RenderPass&&) = delete;
@@ -1215,7 +1215,7 @@ namespace LiteFX::Rendering::Backends {
virtual Span inputAttachments() const noexcept override;
///
- virtual const MultiSamplingLevel& multiSamplingLevel() const noexcept override;
+ virtual MultiSamplingLevel multiSamplingLevel() const noexcept override;
public:
///
@@ -1228,7 +1228,7 @@ namespace LiteFX::Rendering::Backends {
virtual void resizeFrameBuffers(const Size2d& renderArea) override;
///
- virtual void changeMultiSamplingLevel(const MultiSamplingLevel& samples) override;
+ virtual void changeMultiSamplingLevel(MultiSamplingLevel samples) override;
///
virtual void updateAttachments(const DirectX12DescriptorSet& descriptorSet) const override;
@@ -1309,7 +1309,7 @@ namespace LiteFX::Rendering::Backends {
/// The initial surface format.
/// The initial size of the render area.
/// The initial number of buffers.
- explicit DirectX12SwapChain(const DirectX12Device& device, const Format& surfaceFormat = Format::B8G8R8A8_SRGB, const Size2d& renderArea = { 800, 600 }, const UInt32& buffers = 3);
+ explicit DirectX12SwapChain(const DirectX12Device& device, Format surfaceFormat = Format::B8G8R8A8_SRGB, const Size2d& renderArea = { 800, 600 }, const UInt32& buffers = 3);
DirectX12SwapChain(const DirectX12SwapChain&) = delete;
DirectX12SwapChain(DirectX12SwapChain&&) = delete;
virtual ~DirectX12SwapChain() noexcept;
@@ -1343,7 +1343,7 @@ namespace LiteFX::Rendering::Backends {
virtual UInt32 resolveQueryId(SharedPtr timingEvent) const override;
///
- virtual const Format& surfaceFormat() const noexcept override;
+ virtual Format surfaceFormat() const noexcept override;
///
virtual const UInt32& buffers() const noexcept override;
@@ -1368,7 +1368,7 @@ namespace LiteFX::Rendering::Backends {
virtual void addTimingEvent(SharedPtr timingEvent) override;
///
- virtual void reset(const Format& surfaceFormat, const Size2d& renderArea, const UInt32& buffers) override;
+ virtual void reset(Format surfaceFormat, const Size2d& renderArea, const UInt32& buffers) override;
///
[[nodiscard]] virtual UInt32 swapBackBuffer() const override;
@@ -1395,7 +1395,7 @@ namespace LiteFX::Rendering::Backends {
/// The device, commands get send to.
/// The type of the command queue.
/// The priority, of which commands are issued on the device.
- explicit DirectX12Queue(const DirectX12Device& device, const QueueType& type, const QueuePriority& priority);
+ explicit DirectX12Queue(const DirectX12Device& device, QueueType type, QueuePriority priority);
DirectX12Queue(const DirectX12Queue&) = delete;
DirectX12Queue(DirectX12Queue&&) = delete;
virtual ~DirectX12Queue() noexcept;
@@ -1414,10 +1414,10 @@ namespace LiteFX::Rendering::Backends {
virtual bool isBound() const noexcept override;
///
- virtual const QueuePriority& priority() const noexcept override;
+ virtual QueuePriority priority() const noexcept override;
///
- virtual const QueueType& type() const noexcept override;
+ virtual QueueType type() const noexcept override;
#if !defined(NDEBUG) && defined(_WIN64)
public:
@@ -1486,46 +1486,46 @@ namespace LiteFX::Rendering::Backends {
public:
///
- virtual UniquePtr createBuffer(const BufferType& type, const BufferUsage& usage, const size_t& elementSize, const UInt32& elements = 1, const bool& allowWrite = false) const override;
+ virtual UniquePtr createBuffer(BufferType type, BufferUsage usage, const size_t& elementSize, const UInt32& elements = 1, const bool& allowWrite = false) const override;
///
- virtual UniquePtr createBuffer(const String& name, const BufferType& type, const BufferUsage& usage, const size_t& elementSize, const UInt32& elements = 1, const bool& allowWrite = false) const override;
+ virtual UniquePtr createBuffer(const String& name, BufferType type, BufferUsage usage, const size_t& elementSize, const UInt32& elements = 1, const bool& allowWrite = false) const override;
///
- virtual UniquePtr createVertexBuffer(const DirectX12VertexBufferLayout& layout, const BufferUsage& usage, const UInt32& elements = 1) const override;
+ virtual UniquePtr createVertexBuffer(const DirectX12VertexBufferLayout& layout, BufferUsage usage, const UInt32& elements = 1) const override;
///
- virtual UniquePtr createVertexBuffer(const String& name, const DirectX12VertexBufferLayout& layout, const BufferUsage& usage, const UInt32& elements = 1) const override;
+ virtual UniquePtr createVertexBuffer(const String& name, const DirectX12VertexBufferLayout& layout, BufferUsage usage, const UInt32& elements = 1) const override;
///
- virtual UniquePtr createIndexBuffer(const DirectX12IndexBufferLayout& layout, const BufferUsage& usage, const UInt32& elements) const override;
+ virtual UniquePtr createIndexBuffer(const DirectX12IndexBufferLayout& layout, BufferUsage usage, const UInt32& elements) const override;
///
- virtual UniquePtr createIndexBuffer(const String& name, const DirectX12IndexBufferLayout& layout, const BufferUsage& usage, const UInt32& elements) const override;
+ virtual UniquePtr createIndexBuffer(const String& name, const DirectX12IndexBufferLayout& layout, BufferUsage usage, const UInt32& elements) const override;
///
- virtual UniquePtr createAttachment(const Format& format, const Size2d& size, const MultiSamplingLevel& samples = MultiSamplingLevel::x1) const override;
+ virtual UniquePtr createAttachment(Format format, const Size2d& size, MultiSamplingLevel samples = MultiSamplingLevel::x1) const override;
///
- virtual UniquePtr createAttachment(const String& name, const Format& format, const Size2d& size, const MultiSamplingLevel& samples = MultiSamplingLevel::x1) const override;
+ virtual UniquePtr createAttachment(const String& name, Format format, const Size2d& size, MultiSamplingLevel samples = MultiSamplingLevel::x1) const override;
///
- virtual UniquePtr createTexture(const Format& format, const Size3d& size, const ImageDimensions& dimension = ImageDimensions::DIM_2, const UInt32& levels = 1, const UInt32& layers = 1, const MultiSamplingLevel& samples = MultiSamplingLevel::x1, const bool& allowWrite = false) const override;
+ virtual UniquePtr