Skip to content

Commit

Permalink
Vulkan: Add feature for coherent blend advanced op
Browse files Browse the repository at this point in the history
  This change will add features that will be used in
the follow-up CL.

* Added the following feature to the Vulkan backend:
  * supports_blend_operation_advanced_coherent

* Added the following feature to the renderer:
  * mBlendOperationAdvancedFeatures
  * It will be used to query advancedBlendCoherentOperations
    from the physical device.

Bug: angleproject:42262258
Change-Id: I2949002d053700e89d92358d6e7c80c714ea36ee
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5634380
Reviewed-by: Cody Northrop <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
Commit-Queue: Amirali Abdolrashidi <[email protected]>
  • Loading branch information
aabdolrashidi authored and Angle LUCI CQ committed Jun 20, 2024
1 parent 0b888d5 commit 0580153
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/platform/autogen/FeaturesVk_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,13 @@ struct FeaturesVk : FeatureSetBase
&members, "http:https://anglebug.com/42262249"
};

FeatureInfo supportsBlendOperationAdvancedCoherent = {
"supportsBlendOperationAdvancedCoherent",
FeatureCategory::VulkanFeatures,
"VkDevice supports VK_EXT_blend_operation_advanced_coherent extension.",
&members, "http:https://anglebug.com/42262258"
};

FeatureInfo forceMaxUniformBufferSize16KB = {
"forceMaxUniformBufferSize16KB",
FeatureCategory::VulkanWorkarounds,
Expand Down
8 changes: 8 additions & 0 deletions include/platform/vk_features.json
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,14 @@
],
"issue": "http:https://anglebug.com/42262249"
},
{
"name": "supports_blend_operation_advanced_coherent",
"category": "Features",
"description": [
"VkDevice supports VK_EXT_blend_operation_advanced_coherent extension."
],
"issue": "http:https://anglebug.com/42262258"
},
{
"name": "force_max_uniform_buffer_size_16KB",
"category": "Workarounds",
Expand Down
15 changes: 15 additions & 0 deletions src/libANGLE/renderer/vulkan/vk_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2387,6 +2387,11 @@ void Renderer::appendDeviceExtensionFeaturesNotPromoted(
{
vk::AddToPNextChain(deviceFeatures, &mDynamicRenderingLocalReadFeatures);
}

if (ExtensionFound(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME, deviceExtensionNames))
{
vk::AddToPNextChain(deviceFeatures, &mBlendOperationAdvancedFeatures);
}
}

// The following features and properties used by ANGLE have been promoted to Vulkan 1.1:
Expand Down Expand Up @@ -2726,6 +2731,10 @@ void Renderer::queryDeviceExtensionFeatures(const vk::ExtensionNameList &deviceE
mSynchronization2Features = {};
mSynchronization2Features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES;

mBlendOperationAdvancedFeatures = {};
mBlendOperationAdvancedFeatures.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT;

#if defined(ANGLE_PLATFORM_ANDROID)
mExternalFormatResolveFeatures = {};
mExternalFormatResolveFeatures.sType =
Expand Down Expand Up @@ -2805,6 +2814,7 @@ void Renderer::queryDeviceExtensionFeatures(const vk::ExtensionNameList &deviceE
m8BitStorageFeatures.pNext = nullptr;
m16BitStorageFeatures.pNext = nullptr;
mSynchronization2Features.pNext = nullptr;
mBlendOperationAdvancedFeatures.pNext = nullptr;
#if defined(ANGLE_PLATFORM_ANDROID)
mExternalFormatResolveFeatures.pNext = nullptr;
mExternalFormatResolveProperties.pNext = nullptr;
Expand Down Expand Up @@ -3003,6 +3013,7 @@ void Renderer::enableDeviceExtensionsNotPromoted(const vk::ExtensionNameList &de
if (mFeatures.supportsBlendOperationAdvanced.enabled)
{
mEnabledDeviceExtensions.push_back(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME);
vk::AddToPNextChain(&mEnabledFeatures, &mBlendOperationAdvancedFeatures);
}

if (mFeatures.supportsGraphicsPipelineLibrary.enabled)
Expand Down Expand Up @@ -4765,6 +4776,10 @@ void Renderer::initFeatures(const vk::ExtensionNameList &deviceExtensionNames,
!mFeatures.supportsBlendOperationAdvanced.enabled &&
(IsAndroid() || !isIntel || (isIntel && IsLinux() && isMesaAtLeast22_0_0)));

// GL_KHR_blend_equation_advanced_coherent ensures that the blending operations are performed in
// API primitive order.
ANGLE_FEATURE_CONDITION(&mFeatures, supportsBlendOperationAdvancedCoherent, false);

// http:https://anglebug.com/42265410
// Android expects VkPresentRegionsKHR rectangles with a bottom-left origin, while spec
// states they should have a top-left origin.
Expand Down
1 change: 1 addition & 0 deletions src/libANGLE/renderer/vulkan/vk_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ class Renderer : angle::NonCopyable
VkPhysicalDeviceHostQueryResetFeaturesEXT mHostQueryResetFeatures;
VkPhysicalDeviceDepthClampZeroOneFeaturesEXT mDepthClampZeroOneFeatures;
VkPhysicalDeviceDepthClipControlFeaturesEXT mDepthClipControlFeatures;
VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT mBlendOperationAdvancedFeatures;
VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT mPrimitivesGeneratedQueryFeatures;
VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT mPrimitiveTopologyListRestartFeatures;
VkPhysicalDeviceSamplerYcbcrConversionFeatures mSamplerYcbcrConversionFeatures;
Expand Down
1 change: 1 addition & 0 deletions util/autogen/angle_features_autogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{
{Feature::SupportsAndroidNativeFenceSync, "supportsAndroidNativeFenceSync"},
{Feature::SupportsBindMemory2, "supportsBindMemory2"},
{Feature::SupportsBlendOperationAdvanced, "supportsBlendOperationAdvanced"},
{Feature::SupportsBlendOperationAdvancedCoherent, "supportsBlendOperationAdvancedCoherent"},
{Feature::SupportsColorWriteEnable, "supportsColorWriteEnable"},
{Feature::SupportsComputeTranscodeEtcToBc, "supportsComputeTranscodeEtcToBc"},
{Feature::SupportsCustomBorderColor, "supportsCustomBorderColor"},
Expand Down
1 change: 1 addition & 0 deletions util/autogen/angle_features_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ enum class Feature
SupportsAndroidNativeFenceSync,
SupportsBindMemory2,
SupportsBlendOperationAdvanced,
SupportsBlendOperationAdvancedCoherent,
SupportsColorWriteEnable,
SupportsComputeTranscodeEtcToBc,
SupportsCustomBorderColor,
Expand Down

0 comments on commit 0580153

Please sign in to comment.