diff --git a/single_include/kompute/Kompute.hpp b/single_include/kompute/Kompute.hpp index 8cbfd404f..67efbe708 100755 --- a/single_include/kompute/Kompute.hpp +++ b/single_include/kompute/Kompute.hpp @@ -1248,6 +1248,12 @@ class Algorithm { uint32_t memorySize = sizeof(decltype(pushConstants.back())); uint32_t size = pushConstants.size(); + + this->setPushConstants(pushConstants.data(), size, memorySize); + } + + void setPushConstants(void* data, uint32_t size, uint32_t memorySize) { + uint32_t totalSize = memorySize * size; uint32_t previousTotalSize = this->mPushConstantsDataTypeMemorySize * this->mPushConstantsSize; @@ -1262,11 +1268,6 @@ class Algorithm free(this->mPushConstantsData); } - this->setPushConstants(pushConstants.data(), size, memorySize); - } - - void setPushConstants(void* data, uint32_t size, uint32_t memorySize) { - uint32_t totalSize = size * memorySize; this->mPushConstantsData = malloc(totalSize); memcpy(this->mPushConstantsData, data, totalSize); this->mPushConstantsDataTypeMemorySize = memorySize; diff --git a/src/include/kompute/Algorithm.hpp b/src/include/kompute/Algorithm.hpp index a0b2ba146..9dd70b1b5 100644 --- a/src/include/kompute/Algorithm.hpp +++ b/src/include/kompute/Algorithm.hpp @@ -185,6 +185,12 @@ class Algorithm { uint32_t memorySize = sizeof(decltype(pushConstants.back())); uint32_t size = pushConstants.size(); + + this->setPushConstants(pushConstants.data(), size, memorySize); + } + + void setPushConstants(void* data, uint32_t size, uint32_t memorySize) { + uint32_t totalSize = memorySize * size; uint32_t previousTotalSize = this->mPushConstantsDataTypeMemorySize * this->mPushConstantsSize; @@ -199,11 +205,6 @@ class Algorithm free(this->mPushConstantsData); } - this->setPushConstants(pushConstants.data(), size, memorySize); - } - - void setPushConstants(void* data, uint32_t size, uint32_t memorySize) { - uint32_t totalSize = size * memorySize; this->mPushConstantsData = malloc(totalSize); memcpy(this->mPushConstantsData, data, totalSize); this->mPushConstantsDataTypeMemorySize = memorySize;