Skip to content
Snippets Groups Projects
Verified Commit 48639293 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Adjusted doxygen to get rid of internal code in docs and added remaining new classes

parent 4e99ec85
No related branches found
No related tags found
1 merge request!105Resolve "Refactor Core API"
...@@ -874,8 +874,7 @@ WARN_LOGFILE = ...@@ -874,8 +874,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = src \ INPUT = include \
include \
modules modules
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
......
...@@ -10,13 +10,30 @@ ...@@ -10,13 +10,30 @@
namespace vkcv { namespace vkcv {
/**
* @brief Class representing a dispatch size to invoke a compute pipeline with.
*/
class DispatchSize final { class DispatchSize final {
private: private:
std::array<uint32_t, 3> m_Dispatch; std::array<uint32_t, 3> m_Dispatch;
public: public:
/**
* Implicit constructor to convert an unsigned integer to a
* one dimensional dispatch size.
*
* @param[in] count Count of invocations
*/
DispatchSize(uint32_t count); DispatchSize(uint32_t count);
/**
* Explicit constructor to create a dispatch size with two or
* three dimensions setting each value specifically.
*
* @param[in] dimensionX Size of X dimension
* @param[in] dimentionY Size of Y dimension
* @param[in] dimensionZ Size of Z dimension (optional)
*/
DispatchSize(uint32_t dimensionX, uint32_t dimentionY, uint32_t dimensionZ = 1); DispatchSize(uint32_t dimensionX, uint32_t dimentionY, uint32_t dimensionZ = 1);
DispatchSize(const DispatchSize& other) = default; DispatchSize(const DispatchSize& other) = default;
...@@ -27,25 +44,71 @@ namespace vkcv { ...@@ -27,25 +44,71 @@ namespace vkcv {
DispatchSize& operator=(const DispatchSize& other) = default; DispatchSize& operator=(const DispatchSize& other) = default;
DispatchSize& operator=(DispatchSize&& other) = default; DispatchSize& operator=(DispatchSize&& other) = default;
/**
* Returns the raw data of the dispatch size as readonly unsigned
* integer pointer.
*
* @return Pointer to data
*/
[[nodiscard]] [[nodiscard]]
const uint32_t* data() const; const uint32_t* data() const;
/**
* Returns the size value of the dispatch size by a given index.
*
* @param[in] index Size index
* @return Size value by index
*/
[[nodiscard]] [[nodiscard]]
uint32_t operator[](size_t index) const; uint32_t operator[](size_t index) const;
/**
* Returns the value for the X dimension of the dispatch size.
*
* @return Size of X dimension
*/
[[nodiscard]] [[nodiscard]]
uint32_t x() const; uint32_t x() const;
/**
* Returns the value for the Y dimension of the dispatch size.
*
* @return Size of Y dimension
*/
[[nodiscard]] [[nodiscard]]
uint32_t y() const; uint32_t y() const;
/**
* Returns the value for the Z dimension of the dispatch size.
*
* @return Size of Z dimension
*/
[[nodiscard]] [[nodiscard]]
uint32_t z() const; uint32_t z() const;
/**
* Checks whether the dispatch size is valid for compute shader
* invocations and returns the result as boolean value.
*
* @return True if the dispatch size is valid, otherwise false.
*/
bool check() const; bool check() const;
}; };
/**
* Returns the proper dispatch size by dividing a global amount of invocations
* as three dimensional dispatch size into invocations of a fixed group size
* for the used work groups of the compute shader.
*
* This function will generate over fitted results to make sure all global
* invocations get computed. So make sure the used compute shader handles those
* additional invocations out of bounds from the original global invocations.
*
* @param[in] globalInvocations Size of planned global invocations
* @param[in] groupSize Size of work group in compute stage
* @return Dispatch size respecting the actual work group size
*/
[[nodiscard]] [[nodiscard]]
DispatchSize dispatchInvocations(DispatchSize globalInvocations, DispatchSize groupSize); DispatchSize dispatchInvocations(DispatchSize globalInvocations, DispatchSize groupSize);
......
...@@ -33,6 +33,9 @@ namespace vkcv { ...@@ -33,6 +33,9 @@ namespace vkcv {
} }
/**
* @cond VULKAN_TYPES
*/
namespace vk { namespace vk {
template<> template<>
...@@ -58,6 +61,9 @@ namespace vk { ...@@ -58,6 +61,9 @@ namespace vk {
}; };
} }
/**
* @endcond
*/
namespace vkcv { namespace vkcv {
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
namespace vkcv { namespace vkcv {
/**
* @brief Class bringing type safety during runtime to other classes.
*/
class TypeGuard { class TypeGuard {
private: private:
#ifndef NDEBUG #ifndef NDEBUG
...@@ -25,20 +28,60 @@ namespace vkcv { ...@@ -25,20 +28,60 @@ namespace vkcv {
bool checkTypeSize(size_t size) const; bool checkTypeSize(size_t size) const;
public: public:
/**
* Explicit constructor to create a type guard by a specific
* size only. The guard will not verify an individual type but
* whether its size matches the requirement.
*
* @param[in] size Size of type
*/
explicit TypeGuard(size_t size = 0); explicit TypeGuard(size_t size = 0);
/**
* Explicit constructor to create a type guard by a types
* ID information and its size. The guard will verify a type
* by all available information in debug mode.
*
* @param[in] info ID information of type
* @param[in] size Size of type
*/
TypeGuard(const std::type_info &info, size_t size); TypeGuard(const std::type_info &info, size_t size);
TypeGuard(const TypeGuard &other) = default; TypeGuard(const TypeGuard &other) = default;
TypeGuard(TypeGuard &&other) noexcept; TypeGuard(TypeGuard &&other) noexcept = default;
~TypeGuard() = default; ~TypeGuard() = default;
TypeGuard& operator=(const TypeGuard &other) = default; TypeGuard& operator=(const TypeGuard &other) = default;
TypeGuard& operator=(TypeGuard &&other) noexcept; TypeGuard& operator=(TypeGuard &&other) noexcept = default;
/**
* Operator to compare two type guards and returns
* whether their stored type information and size
* match as boolean value.
*
* @param[in] other Other type guard
* @return True if the details match, otherwise false.
*/
bool operator==(const TypeGuard &other) const; bool operator==(const TypeGuard &other) const;
/**
* Operator to compare two type guards and returns
* whether their stored type information and size
* do not match as boolean value.
*
* @param[in] other Other type guard
* @return True if the details differ, otherwise false.
*/
bool operator!=(const TypeGuard &other) const; bool operator!=(const TypeGuard &other) const;
/**
* Checks whether a type from a template parameter
* matches with the used type by the given guard.
*
* @tparam T Type to check against
* @return True if both types match, otherwise false.
*/
template<typename T> template<typename T>
[[nodiscard]] [[nodiscard]]
bool check() const { bool check() const {
...@@ -49,27 +92,60 @@ namespace vkcv { ...@@ -49,27 +92,60 @@ namespace vkcv {
#endif #endif
} }
/**
* Returns the size of this guards type in bytes.
*
* @return Size of type
*/
[[nodiscard]] [[nodiscard]]
size_t typeSize() const; size_t typeSize() const;
}; };
/**
* Creates a new type guard with a given type specified
* as template parameter.
*
* @tparam T Type
* @return New type guard
*/
template<typename T> template<typename T>
TypeGuard typeGuard() { TypeGuard typeGuard() {
static TypeGuard guard (typeid(T), sizeof(T)); static TypeGuard guard (typeid(T), sizeof(T));
return guard; return guard;
} }
/**
* Creates a new type guard with a given type specified
* as template parameter by the passed parameter.
*
* @tparam T Type
* @return New type guard
*/
template<typename T> template<typename T>
TypeGuard typeGuard(T) { TypeGuard typeGuard(T) {
return typeGuard<T>(); return typeGuard<T>();
} }
/**
* Creates a new type guard with a given type specified
* as template parameter by the passed parameter.
*
* @tparam T Type
* @return New type guard
*/
template<typename T> template<typename T>
TypeGuard typeGuard(const T&) { TypeGuard typeGuard(const T&) {
return typeGuard<T>(); return typeGuard<T>();
} }
/**
* Creates a new type guard with a given type specified
* as template parameter by the passed parameter.
*
* @tparam T Type
* @return New type guard
*/
template<typename T> template<typename T>
TypeGuard typeGuard(T&&) { TypeGuard typeGuard(T&&) {
return typeGuard<T>(); return typeGuard<T>();
......
...@@ -69,22 +69,6 @@ namespace vkcv { ...@@ -69,22 +69,6 @@ namespace vkcv {
#endif #endif
m_typeSize(size) m_typeSize(size)
{} {}
TypeGuard::TypeGuard(TypeGuard &&other) noexcept :
#ifndef NDEBUG
m_typeName(other.m_typeName), m_typeHash(other.m_typeHash),
#endif
m_typeSize(other.m_typeSize)
{}
TypeGuard& TypeGuard::operator=(TypeGuard &&other) noexcept {
#ifndef NDEBUG
m_typeName = other.m_typeName;
m_typeHash = other.m_typeHash;
#endif
m_typeSize = other.m_typeSize;
return *this;
}
bool TypeGuard::operator==(const TypeGuard &other) const { bool TypeGuard::operator==(const TypeGuard &other) const {
#ifndef NDEBUG #ifndef NDEBUG
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment