mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2026-02-09 07:15:55 +00:00
refactor(cleanup): fix string lifetimes
This commit is contained in:
parent
8bff30edc5
commit
32da2283b4
3 changed files with 7 additions and 7 deletions
|
|
@ -24,17 +24,17 @@ namespace {
|
|||
|
||||
/// helper function to add required extensions
|
||||
std::vector<const char*> add_extensions(const char* const* existingExtensions, size_t count,
|
||||
const std::vector<std::string>& requiredExtensions) {
|
||||
const std::vector<const char*>& requiredExtensions) {
|
||||
std::vector<const char*> extensions(count);
|
||||
std::copy_n(existingExtensions, count, extensions.data());
|
||||
|
||||
for (const auto& requiredExtension : requiredExtensions) {
|
||||
auto it = std::ranges::find_if(extensions,
|
||||
[requiredExtension](const char* extension) {
|
||||
return std::string(extension) == requiredExtension;
|
||||
return std::string(extension) == std::string(requiredExtension);
|
||||
});
|
||||
if (it == extensions.end())
|
||||
extensions.push_back(requiredExtension.c_str());
|
||||
extensions.push_back(requiredExtension);
|
||||
}
|
||||
|
||||
return extensions;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ bool Layer::tick() {
|
|||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> Layer::instanceExtensions() const {
|
||||
std::vector<const char*> Layer::instanceExtensions() const {
|
||||
if (!this->profile.has_value())
|
||||
return {};
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ std::vector<std::string> Layer::instanceExtensions() const {
|
|||
};
|
||||
}
|
||||
|
||||
std::vector<std::string> Layer::deviceExtensions() const {
|
||||
std::vector<const char*> Layer::deviceExtensions() const {
|
||||
if (!this->profile.has_value())
|
||||
return {};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ namespace lsfgvk::layer {
|
|||
|
||||
/// required instance extensions
|
||||
/// @return list of extension names
|
||||
[[nodiscard]] std::vector<std::string> instanceExtensions() const;
|
||||
[[nodiscard]] std::vector<const char*> instanceExtensions() const;
|
||||
/// required device extensions
|
||||
/// @return list of extension names
|
||||
[[nodiscard]] std::vector<std::string> deviceExtensions() const;
|
||||
[[nodiscard]] std::vector<const char*> deviceExtensions() const;
|
||||
|
||||
/// tick the layer
|
||||
/// @throws lsfgvk::error on failure
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue