[Vulkan UI] VulkanDevice::HasEnabledExtension

This commit is contained in:
DrChat 2018-03-03 11:53:24 -06:00
parent 199328f971
commit 3fb7b9d944
2 changed files with 19 additions and 2 deletions

View File

@ -57,10 +57,15 @@ VulkanDevice::VulkanDevice(VulkanInstance* instance) : instance_(instance) {
*/
}
DeclareRequiredExtension(VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME,
Version::Make(0, 0, 0), false);
// AMD shader info (optional)
DeclareRequiredExtension(VK_AMD_SHADER_INFO_EXTENSION_NAME,
Version::Make(0, 0, 0), true);
// Debug markers (optional)
DeclareRequiredExtension(VK_EXT_DEBUG_MARKER_EXTENSION_NAME,
Version::Make(0, 0, 0), true);
DeclareRequiredExtension(VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME,
Version::Make(0, 0, 0), false);
}
VulkanDevice::~VulkanDevice() {
@ -252,6 +257,16 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) {
return true;
}
bool VulkanDevice::HasEnabledExtension(const char* name) {
for (auto extension : enabled_extensions_) {
if (!std::strcmp(extension, name)) {
return true;
}
}
return false;
}
VkQueue VulkanDevice::AcquireQueue(uint32_t queue_family_index) {
std::lock_guard<std::mutex> lock(queue_mutex_);
if (free_queues_[queue_family_index].empty()) {

View File

@ -57,6 +57,8 @@ class VulkanDevice {
// issues will occur.
bool Initialize(DeviceInfo device_info);
bool HasEnabledExtension(const char* name);
uint32_t queue_family_index() const { return queue_family_index_; }
std::mutex& primary_queue_mutex() { return queue_mutex_; }
// Access to the primary queue must be synchronized with primary_queue_mutex.