diff --git a/inc/hgl/graph/VKDeviceAttribute.h b/inc/hgl/graph/VKDeviceAttribute.h index 9de75c3f..b6ffea2b 100644 --- a/inc/hgl/graph/VKDeviceAttribute.h +++ b/inc/hgl/graph/VKDeviceAttribute.h @@ -39,6 +39,8 @@ struct GPUDeviceAttribute VkSurfaceTransformFlagBitsKHR preTransform; VkCompositeAlphaFlagBitsKHR compositeAlpha =VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; + bool blendOpAdvance =false; + bool uint8_index_type=false; bool uint32_index_type=false; diff --git a/inc/hgl/graph/VKDeviceCreater.h b/inc/hgl/graph/VKDeviceCreater.h index caead557..68acb858 100644 --- a/inc/hgl/graph/VKDeviceCreater.h +++ b/inc/hgl/graph/VKDeviceCreater.h @@ -98,6 +98,8 @@ struct VulkanHardwareRequirement uint32_t descriptor_pool; ///<描述符池大小(默认1024) + SupportLevel blendOperationAdvanced; ///<要求支持高级混合 + public: VulkanHardwareRequirement() @@ -110,6 +112,8 @@ public: fullDrawIndexUint8=SupportLevel::Want; fullDrawIndexUint32=SupportLevel::Want; + + blendOperationAdvanced=SupportLevel::Want; } }; diff --git a/inc/hgl/graph/VKPhysicalDevice.h b/inc/hgl/graph/VKPhysicalDevice.h index febaaf7c..acd00c18 100644 --- a/inc/hgl/graph/VKPhysicalDevice.h +++ b/inc/hgl/graph/VKPhysicalDevice.h @@ -19,6 +19,7 @@ class GPUPhysicalDevice VkPhysicalDeviceVulkan11Properties properties11; VkPhysicalDeviceVulkan12Properties properties12; VkPhysicalDeviceVulkan13Properties properties13; + VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT blendOpAdvProperties; VkPhysicalDeviceMemoryProperties memory_properties; List layer_properties; @@ -29,8 +30,10 @@ private: bool support_u8_index=false; bool dynamic_state=false; - -public: + + bool blendOpAdvanced=false; + +public: const VkPhysicalDeviceFeatures & GetFeatures10 ()const{return features;} const VkPhysicalDeviceVulkan11Features &GetFeatures11 ()const{return features11;} @@ -149,6 +152,13 @@ public: const VkBool32 SupportU32Index ()const{return features.fullDrawIndexUint32;} const VkBool32 SupportU8Index ()const{return support_u8_index;} + const VkBool32 SupportBlendOpAdvanced ()const{return blendOpAdvanced;} + + const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT *GetBlendOpAdvancedProperties()const + { + return blendOpAdvanced?&blendOpAdvProperties:nullptr; + } + // support != open, so please don't direct use GetFeatures(). // open any features in CreateDevice()&SetDeviceFeatures() functions. const bool SupportMDI ()const diff --git a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp index e2bd3538..711df06a 100644 --- a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp @@ -85,6 +85,9 @@ namespace if(require.fullDrawIndexUint8>=VulkanHardwareRequirement::SupportLevel::Want) ext_list->Add(VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME); + + if(require.blendOperationAdvanced>=VulkanHardwareRequirement::SupportLevel::Want) + ext_list->Add(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME); } void SetDeviceFeatures(VkPhysicalDeviceFeatures *features,const VkPhysicalDeviceFeatures &pdf,const VulkanHardwareRequirement &require) @@ -324,6 +327,9 @@ GPUDevice *VulkanDeviceCreater::CreateRenderDevice() device_attr->uint32_index_type=true; } + if(require.blendOperationAdvanced>=VulkanHardwareRequirement::SupportLevel::Want) + device_attr->blendOpAdvance=true; + device_attr->surface_format=surface_format; GetDeviceQueue(device_attr); diff --git a/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp b/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp index 2c58d5d5..94ab27ee 100644 --- a/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp +++ b/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp @@ -70,6 +70,7 @@ GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd) if(func) { VkPhysicalDeviceFeatures2 features2; + VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT boaf; features2.sType=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; features2.pNext=&features11; @@ -81,11 +82,16 @@ GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd) features12.pNext=&features13; features13.sType=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; - features13.pNext=nullptr; + features13.pNext=&boaf; + + boaf.sType=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT; + boaf.pNext=nullptr; func(physical_device,&features2); hgl_cpy(features,features2.features); + + blendOpAdvanced=boaf.advancedBlendCoherentOperations; } else { @@ -114,7 +120,10 @@ GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd) properties12.pNext=&properties13; properties13.sType=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES; - properties13.pNext=nullptr; + properties13.pNext=&blendOpAdvProperties; + + blendOpAdvProperties.sType=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT; + blendOpAdvProperties.pNext=nullptr; func(physical_device,&properties2);