mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Introduce QuirkManager
for runtime GPU quirk tracking
We require a way to track certain host GPU features that are optional such as Vulkan extensions, this is what the `QuirkManager` class does as it checks for all quirks and holds them allowing other components to branch based off these quirks.
This commit is contained in:
@ -68,7 +68,6 @@ namespace skyline::gpu::memory {
|
||||
.vulkanApiVersion = GPU::VkApiVersion,
|
||||
};
|
||||
ThrowOnFail(vmaCreateAllocator(&allocatorCreateInfo, &vmaAllocator));
|
||||
// TODO: Use VK_KHR_dedicated_allocation when available (Should be on Adreno GPUs)
|
||||
}
|
||||
|
||||
MemoryManager::~MemoryManager() {
|
||||
|
31
app/src/main/cpp/skyline/gpu/quirk_manager.cpp
Normal file
31
app/src/main/cpp/skyline/gpu/quirk_manager.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "quirk_manager.h"
|
||||
|
||||
namespace skyline {
|
||||
QuirkManager::QuirkManager(vk::PhysicalDeviceProperties properties, vk::PhysicalDeviceFeatures2 features, const std::vector<vk::ExtensionProperties> &extensions) {
|
||||
for (auto &extension : extensions) {
|
||||
#define EXT_SET(name, property) \
|
||||
case util::Hash(name): \
|
||||
if (name == extensionName) \
|
||||
property = true; \
|
||||
break
|
||||
|
||||
#define EXT_SET_V(name, property, version) \
|
||||
case util::Hash(name): \
|
||||
if (name == extensionName && extensionVersion >= version) \
|
||||
property = true; \
|
||||
break
|
||||
|
||||
std::string_view extensionName{extension.extensionName};
|
||||
auto extensionVersion{extension.specVersion};
|
||||
switch (util::Hash(extensionName)) {
|
||||
EXT_SET("VK_EXT_provoking_vertex", supportsLastProvokingVertex);
|
||||
}
|
||||
|
||||
#undef EXT_SET
|
||||
#undef EXT_SET_V
|
||||
}
|
||||
}
|
||||
}
|
21
app/src/main/cpp/skyline/gpu/quirk_manager.h
Normal file
21
app/src/main/cpp/skyline/gpu/quirk_manager.h
Normal file
@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
#include <common.h>
|
||||
|
||||
namespace skyline {
|
||||
/**
|
||||
* @brief Checks and stores all the quirks of the host GPU discovered at runtime
|
||||
*/
|
||||
class QuirkManager {
|
||||
public:
|
||||
bool supportsLastProvokingVertex{}; //!< If the device supports setting the last vertex as the provoking vertex (with VK_EXT_provoking_vertex)
|
||||
|
||||
QuirkManager() = default;
|
||||
|
||||
QuirkManager(vk::PhysicalDeviceProperties properties, vk::PhysicalDeviceFeatures2 features, const std::vector<vk::ExtensionProperties>& extensions);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user