mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-27 04:25:12 +00:00
vk_instance: Better feature check
This commit is contained in:
parent
3f123bbce2
commit
f619049bc3
@ -109,16 +109,13 @@ std::string Instance::GetDriverVersionName() {
|
|||||||
|
|
||||||
bool Instance::CreateDevice() {
|
bool Instance::CreateDevice() {
|
||||||
const vk::StructureChain feature_chain = physical_device.getFeatures2<
|
const vk::StructureChain feature_chain = physical_device.getFeatures2<
|
||||||
vk::PhysicalDeviceFeatures2, vk::PhysicalDevicePortabilitySubsetFeaturesKHR,
|
vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT,
|
||||||
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT,
|
|
||||||
vk::PhysicalDeviceExtendedDynamicState2FeaturesEXT,
|
vk::PhysicalDeviceExtendedDynamicState2FeaturesEXT,
|
||||||
vk::PhysicalDeviceExtendedDynamicState3FeaturesEXT,
|
vk::PhysicalDeviceExtendedDynamicState3FeaturesEXT,
|
||||||
vk::PhysicalDeviceTimelineSemaphoreFeaturesKHR,
|
vk::PhysicalDeviceCustomBorderColorFeaturesEXT,
|
||||||
vk::PhysicalDeviceCustomBorderColorFeaturesEXT, vk::PhysicalDeviceIndexTypeUint8FeaturesEXT,
|
vk::PhysicalDeviceColorWriteEnableFeaturesEXT, vk::PhysicalDeviceVulkan12Features,
|
||||||
vk::PhysicalDeviceFragmentShaderInterlockFeaturesEXT,
|
vk::PhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR,
|
||||||
vk::PhysicalDevicePipelineCreationCacheControlFeaturesEXT,
|
vk::PhysicalDeviceDepthClipControlFeaturesEXT>();
|
||||||
vk::PhysicalDeviceColorWriteEnableFeaturesEXT,
|
|
||||||
vk::PhysicalDeviceFragmentShaderBarycentricFeaturesKHR>();
|
|
||||||
const vk::StructureChain properties_chain =
|
const vk::StructureChain properties_chain =
|
||||||
physical_device.getProperties2<vk::PhysicalDeviceProperties2,
|
physical_device.getProperties2<vk::PhysicalDeviceProperties2,
|
||||||
vk::PhysicalDevicePortabilitySubsetPropertiesKHR,
|
vk::PhysicalDevicePortabilitySubsetPropertiesKHR,
|
||||||
@ -156,7 +153,8 @@ bool Instance::CreateDevice() {
|
|||||||
add_extension(VK_KHR_MAINTENANCE_4_EXTENSION_NAME);
|
add_extension(VK_KHR_MAINTENANCE_4_EXTENSION_NAME);
|
||||||
add_extension(VK_EXT_DEPTH_CLIP_CONTROL_EXTENSION_NAME);
|
add_extension(VK_EXT_DEPTH_CLIP_CONTROL_EXTENSION_NAME);
|
||||||
add_extension(VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME);
|
add_extension(VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME);
|
||||||
add_extension(VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME);
|
workgroup_memory_explicit_layout =
|
||||||
|
add_extension(VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME);
|
||||||
// The next two extensions are required to be available together in order to support write masks
|
// The next two extensions are required to be available together in order to support write masks
|
||||||
color_write_en = add_extension(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME);
|
color_write_en = add_extension(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME);
|
||||||
color_write_en &= add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
|
color_write_en &= add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
|
||||||
@ -190,6 +188,7 @@ bool Instance::CreateDevice() {
|
|||||||
.pQueuePriorities = queue_priorities.data(),
|
.pQueuePriorities = queue_priorities.data(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto vk12_features = feature_chain.get<vk::PhysicalDeviceVulkan12Features>();
|
||||||
vk::StructureChain device_chain = {
|
vk::StructureChain device_chain = {
|
||||||
vk::DeviceCreateInfo{
|
vk::DeviceCreateInfo{
|
||||||
.queueCreateInfoCount = 1u,
|
.queueCreateInfoCount = 1u,
|
||||||
@ -200,27 +199,28 @@ bool Instance::CreateDevice() {
|
|||||||
vk::PhysicalDeviceFeatures2{
|
vk::PhysicalDeviceFeatures2{
|
||||||
.features{
|
.features{
|
||||||
.robustBufferAccess = features.robustBufferAccess,
|
.robustBufferAccess = features.robustBufferAccess,
|
||||||
.independentBlend = true,
|
.independentBlend = features.independentBlend,
|
||||||
.geometryShader = features.geometryShader,
|
.geometryShader = features.geometryShader,
|
||||||
.logicOp = features.logicOp,
|
.logicOp = features.logicOp,
|
||||||
.multiViewport = true,
|
.multiViewport = features.multiViewport,
|
||||||
.samplerAnisotropy = features.samplerAnisotropy,
|
.samplerAnisotropy = features.samplerAnisotropy,
|
||||||
.fragmentStoresAndAtomics = features.fragmentStoresAndAtomics,
|
.fragmentStoresAndAtomics = features.fragmentStoresAndAtomics,
|
||||||
.shaderImageGatherExtended = true,
|
.shaderImageGatherExtended = features.shaderImageGatherExtended,
|
||||||
.shaderStorageImageMultisample = true,
|
.shaderStorageImageExtendedFormats = features.shaderStorageImageExtendedFormats,
|
||||||
|
.shaderStorageImageMultisample = features.shaderStorageImageMultisample,
|
||||||
.shaderClipDistance = features.shaderClipDistance,
|
.shaderClipDistance = features.shaderClipDistance,
|
||||||
.shaderInt16 = true,
|
.shaderInt16 = features.shaderInt16,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
vk::PhysicalDeviceVulkan11Features{
|
vk::PhysicalDeviceVulkan11Features{
|
||||||
.shaderDrawParameters = true,
|
.shaderDrawParameters = true,
|
||||||
},
|
},
|
||||||
vk::PhysicalDeviceVulkan12Features{
|
vk::PhysicalDeviceVulkan12Features{
|
||||||
.shaderFloat16 = true,
|
.shaderFloat16 = vk12_features.shaderFloat16,
|
||||||
.scalarBlockLayout = true,
|
.scalarBlockLayout = vk12_features.scalarBlockLayout,
|
||||||
.uniformBufferStandardLayout = true,
|
.uniformBufferStandardLayout = vk12_features.uniformBufferStandardLayout,
|
||||||
.hostQueryReset = true,
|
.hostQueryReset = vk12_features.hostQueryReset,
|
||||||
.timelineSemaphore = true,
|
.timelineSemaphore = vk12_features.timelineSemaphore,
|
||||||
},
|
},
|
||||||
vk::PhysicalDeviceVulkan13Features{
|
vk::PhysicalDeviceVulkan13Features{
|
||||||
.shaderDemoteToHelperInvocation = true,
|
.shaderDemoteToHelperInvocation = true,
|
||||||
|
@ -231,6 +231,7 @@ private:
|
|||||||
bool fragment_shader_barycentric{};
|
bool fragment_shader_barycentric{};
|
||||||
bool shader_stencil_export{};
|
bool shader_stencil_export{};
|
||||||
bool external_memory_host{};
|
bool external_memory_host{};
|
||||||
|
bool workgroup_memory_explicit_layout{};
|
||||||
bool color_write_en{};
|
bool color_write_en{};
|
||||||
u64 min_imported_host_pointer_alignment{};
|
u64 min_imported_host_pointer_alignment{};
|
||||||
bool tooling_info{};
|
bool tooling_info{};
|
||||||
|
Loading…
Reference in New Issue
Block a user