diff --git a/app/src/main/cpp/skyline/gpu.cpp b/app/src/main/cpp/skyline/gpu.cpp index b00a9e49..f395cd4d 100644 --- a/app/src/main/cpp/skyline/gpu.cpp +++ b/app/src/main/cpp/skyline/gpu.cpp @@ -182,21 +182,29 @@ namespace skyline::gpu { auto queueFamilies{physicalDevice.getQueueFamilyProperties()}; float queuePriority{1.0f}; //!< The priority of the only queue we use, it's set to the maximum of 1.0 - vk::DeviceQueueCreateInfo queue{[&] { - decltype(vk::DeviceQueueCreateInfo::queueFamilyIndex) index{}; - for (const auto &queueFamily : queueFamilies) { - if (queueFamily.queueFlags & vk::QueueFlagBits::eGraphics && queueFamily.queueFlags & vk::QueueFlagBits::eCompute) { - vkQueueFamilyIndex = index; - return vk::DeviceQueueCreateInfo{ - .queueFamilyIndex = index, - .queueCount = 1, - .pQueuePriorities = &queuePriority, - }; + vk::StructureChain queueCreateInfo{ + [&]() -> vk::DeviceQueueCreateInfo { + decltype(vk::DeviceQueueCreateInfo::queueFamilyIndex) index{}; + for (const auto &queueFamily : queueFamilies) { + if (queueFamily.queueFlags & vk::QueueFlagBits::eGraphics && queueFamily.queueFlags & vk::QueueFlagBits::eCompute) { + vkQueueFamilyIndex = index; + return vk::DeviceQueueCreateInfo{ + .queueFamilyIndex = index, + .queueCount = 1, + .pQueuePriorities = &queuePriority, + }; + } + index++; } - index++; + throw exception("Cannot find a queue family with both eGraphics and eCompute bits set"); + }(), + vk::DeviceQueueGlobalPriorityCreateInfoEXT{ + .globalPriority = vk::QueueGlobalPriorityEXT::eHigh, } - throw exception("Cannot find a queue family with both eGraphics and eCompute bits set"); - }()}; + }; + + if (!traits.supportsGlobalPriority) + queueCreateInfo.unlink(); if (Logger::configLevel >= Logger::LogLevel::Info) { std::string extensionString; @@ -220,7 +228,7 @@ namespace skyline::gpu { return vk::raii::Device(physicalDevice, vk::DeviceCreateInfo{ .pNext = &enabledFeatures2, .queueCreateInfoCount = 1, - .pQueueCreateInfos = &queue, + .pQueueCreateInfos = &queueCreateInfo.get(), .enabledExtensionCount = static_cast(pEnabledExtensions.size()), .ppEnabledExtensionNames = pEnabledExtensions.data(), }); diff --git a/app/src/main/cpp/skyline/gpu/trait_manager.cpp b/app/src/main/cpp/skyline/gpu/trait_manager.cpp index 1dcc2644..43b7ea73 100644 --- a/app/src/main/cpp/skyline/gpu/trait_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/trait_manager.cpp @@ -35,6 +35,7 @@ namespace skyline::gpu { EXT_SET("VK_EXT_custom_border_color", hasCustomBorderColorExt); EXT_SET("VK_EXT_provoking_vertex", hasProvokingVertexExt); EXT_SET("VK_EXT_vertex_attribute_divisor", hasVertexAttributeDivisorExt); + EXT_SET("VK_EXT_global_priority", supportsGlobalPriority); EXT_SET("VK_EXT_shader_viewport_index_layer", supportsShaderViewportIndexLayer); EXT_SET("VK_KHR_spirv_1_4", supportsSpirv14); EXT_SET("VK_EXT_shader_demote_to_helper_invocation", hasShaderDemoteToHelperExt); @@ -130,8 +131,8 @@ namespace skyline::gpu { std::string TraitManager::Summary() { return fmt::format( - "\n* Supports U8 Indices: {}\n* Supports Sampler Mirror Clamp To Edge: {}\n* Supports Sampler Reduction Mode: {}\n* Supports Custom Border Color (Without Format): {}\n* Supports Last Provoking Vertex: {}\n* Supports Logical Operations: {}\n* Supports Vertex Attribute Divisor: {}\n* Supports Vertex Attribute Zero Divisor: {}\n* Supports Multiple Viewports: {}\n* Supports Shader Viewport Index: {}\n* Supports SPIR-V 1.4: {}\n* Supports Shader Invocation Demotion: {}\n* Supports 16-bit FP: {}\n* Supports 8-bit Integers: {}\n* Supports 16-bit Integers: {}\n* Supports 64-bit Integers: {}\n* Supports Atomic 64-bit Integers: {}\n* Supports Floating Point Behavior Control: {}\n* Supports Image Read Without Format: {}\n* Supports List Primitive Topology Restart: {}\n* Supports Patch List Primitive Topology Restart: {}\n* Supports Subgroup Vote: {}\n* Subgroup Size: {}", - supportsUint8Indices, supportsSamplerMirrorClampToEdge, supportsSamplerReductionMode, supportsCustomBorderColor, supportsLastProvokingVertex, supportsLogicOp, supportsVertexAttributeDivisor, supportsVertexAttributeZeroDivisor, supportsMultipleViewports, supportsShaderViewportIndexLayer, supportsSpirv14, supportsShaderDemoteToHelper, supportsFloat16, supportsInt8, supportsInt16, supportsInt64, supportsAtomicInt64, supportsFloatControls, supportsImageReadWithoutFormat, supportsTopologyListRestart, supportsTopologyPatchListRestart, supportsSubgroupVote, subgroupSize + "\n* Supports U8 Indices: {}\n* Supports Sampler Mirror Clamp To Edge: {}\n* Supports Sampler Reduction Mode: {}\n* Supports Custom Border Color (Without Format): {}\n* Supports Last Provoking Vertex: {}\n* Supports Logical Operations: {}\n* Supports Vertex Attribute Divisor: {}\n* Supports Vertex Attribute Zero Divisor: {}\n* Supports Global Priority: {}\n* Supports Multiple Viewports: {}\n* Supports Shader Viewport Index: {}\n* Supports SPIR-V 1.4: {}\n* Supports Shader Invocation Demotion: {}\n* Supports 16-bit FP: {}\n* Supports 8-bit Integers: {}\n* Supports 16-bit Integers: {}\n* Supports 64-bit Integers: {}\n* Supports Atomic 64-bit Integers: {}\n* Supports Floating Point Behavior Control: {}\n* Supports Image Read Without Format: {}\n* Supports List Primitive Topology Restart: {}\n* Supports Patch List Primitive Topology Restart: {}\n* Supports Subgroup Vote: {}\n* Subgroup Size: {}", + supportsUint8Indices, supportsSamplerMirrorClampToEdge, supportsSamplerReductionMode, supportsCustomBorderColor, supportsLastProvokingVertex, supportsLogicOp, supportsVertexAttributeDivisor, supportsVertexAttributeZeroDivisor, supportsGlobalPriority, supportsMultipleViewports, supportsShaderViewportIndexLayer, supportsSpirv14, supportsShaderDemoteToHelper, supportsFloat16, supportsInt8, supportsInt16, supportsInt64, supportsAtomicInt64, supportsFloatControls, supportsImageReadWithoutFormat, supportsTopologyListRestart, supportsTopologyPatchListRestart, supportsSubgroupVote, subgroupSize ); } diff --git a/app/src/main/cpp/skyline/gpu/trait_manager.h b/app/src/main/cpp/skyline/gpu/trait_manager.h index cf52f433..afa92197 100644 --- a/app/src/main/cpp/skyline/gpu/trait_manager.h +++ b/app/src/main/cpp/skyline/gpu/trait_manager.h @@ -20,6 +20,7 @@ namespace skyline::gpu { bool supportsLogicOp{}; //!< If the device supports framebuffer logical operations during blending bool supportsVertexAttributeDivisor{}; //!< If the device supports a divisor for instance-rate vertex attributes (with VK_EXT_vertex_attribute_divisor) bool supportsVertexAttributeZeroDivisor{}; //!< If the device supports a zero divisor for instance-rate vertex attributes (with VK_EXT_vertex_attribute_divisor) + bool supportsGlobalPriority{}; //!< If the device supports global priorities for queues (with VK_EXT_global_priority) bool supportsMultipleViewports{}; //!< If the device supports more than one viewport bool supportsShaderViewportIndexLayer{}; //!< If the device supports retrieving the viewport index in shaders (with VK_EXT_shader_viewport_index_layer) bool supportsSpirv14{}; //!< If SPIR-V 1.4 is supported (with VK_KHR_spirv_1_4)