Skip to content
Snippets Groups Projects
Commit 165dcc32 authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#96] Add doxygen comments to PushConstants

parent 929cfc95
No related branches found
No related tags found
1 merge request!97Resolve "Dokumentation vervollständigen"
Pipeline #27510 passed
......@@ -28,25 +28,44 @@ namespace vkcv {
PushConstants& operator=(const PushConstants& other) = default;
PushConstants& operator=(PushConstants&& other) = default;
/**
* @return The size of the data that is bound per drawcall in bytes
*/
[[nodiscard]]
size_t getSizePerDrawcall() const {
return m_sizePerDrawcall;
}
/**
* @return The size of the total data stored for push constants in bytes
*/
[[nodiscard]]
size_t getFullSize() const {
return m_data.size();
}
/**
* @return The number of drawcalls that data is stored for
*/
[[nodiscard]]
size_t getDrawcallCount() const {
return (m_data.size() / m_sizePerDrawcall);
}
/**
* @brief Clear the drawcall data
*/
void clear() {
m_data.clear();
}
/**
* @brief Append data for a single drawcall
*
* @tparam T Type of data to append, must match the size of the #PushConstants per drawcall size
* @param value Data to append
* @return If operation was successfull
*/
template<typename T = uint8_t>
bool appendDrawcall(const T& value) {
if (sizeof(T) != m_sizePerDrawcall) {
......@@ -61,24 +80,49 @@ namespace vkcv {
return true;
}
/**
* @brief Get the data for a single drawcall as reference
*
* @tparam T Type of data to return
* @param index Index of the drawcall data to return
* @return Drawcall data
*/
template<typename T = uint8_t>
T& getDrawcall(size_t index) {
const size_t offset = (index * m_sizePerDrawcall);
return *reinterpret_cast<T*>(m_data.data() + offset);
}
/**
* @brief Get the data for a single drawcall as const reference
*
* @tparam T Type of data to return
* @param index Index of the drawcall data to return
* @return Drawcall data
*/
template<typename T = uint8_t>
const T& getDrawcall(size_t index) const {
const size_t offset = (index * m_sizePerDrawcall);
return *reinterpret_cast<const T*>(m_data.data() + offset);
}
/**
* @brief Get the data for a single drawcall as a void pointer
*
* @param index Index of the drawcall data to return
* @return Drawcall data
*/
[[nodiscard]]
const void* getDrawcallData(size_t index) const {
const size_t offset = (index * m_sizePerDrawcall);
return reinterpret_cast<const void*>(m_data.data() + offset);
}
/**
* @return Raw pointer to the entire drawcall data array,
* might be nullptr if data is empty,
* pointer might be invalidated by clearing or adding data
*/
[[nodiscard]]
const void* getData() const {
if (m_data.empty()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment