Commit dd312cc6 by Mohan Maiya Committed by Angle LUCI CQ

Reland "Vulkan: Add support for EXT_texture_border_clamp"

This is a reland of 4b92e089 Initializes mPadding to 0 in SamplerDesc::update Original change's description: > Vulkan: Add support for EXT_texture_border_clamp > Add support for GL_EXT_texture_border_clamp. This is implemented by > using VK_EXT_custom_border_color. > > Bug: angleproject:3577 > Test: dEQP-GLES31.functional.texture.border_clamp* > Change-Id: Ie9fa1eb5dd03b997b5ae182787641a53080a9e51 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830192 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: angleproject:3577 Change-Id: I8684242c4bce6e1a006dbe926defaa495fcc2282 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2911571Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent 7dfabc44
......@@ -199,6 +199,13 @@ struct FeaturesVk : FeatureSetBase
"VkDevice supports the VK_EXT_index_type_uint8 extension",
&members, "http://anglebug.com/4405"};
// Whether the VkDevice supports the VK_EXT_custom_border_color extension
// http://anglebug.com/3577
Feature supportsCustomBorderColorEXT = {
"supports_custom_border_color", FeatureCategory::VulkanFeatures,
"VkDevice supports the VK_EXT_custom_border_color extension", &members,
"http://anglebug.com/3577"};
// Whether the VkDevice supports the VK_KHR_depth_stencil_resolve extension with the
// independentResolveNone feature.
// http://anglebug.com/4836
......
......@@ -8,6 +8,8 @@
#include "libANGLE/queryutils.h"
#include <algorithm>
#include "common/utilities.h"
#include "libANGLE/Buffer.h"
......@@ -86,7 +88,6 @@ void ConvertFromColor(const ColorGeneric &color, GLfloat *outParams)
}
else
{
ASSERT(color.type == ColorGeneric::Type::Float);
color.colorF.writeData(outParams);
}
}
......@@ -96,7 +97,6 @@ void ConvertFromColor(const ColorGeneric &color, GLint *outParams)
{
if (isPureInteger)
{
ASSERT(color.type == ColorGeneric::Type::Int);
outParams[0] = color.colorI.red;
outParams[1] = color.colorI.green;
outParams[2] = color.colorI.blue;
......@@ -104,7 +104,6 @@ void ConvertFromColor(const ColorGeneric &color, GLint *outParams)
}
else
{
ASSERT(color.type == ColorGeneric::Type::Float);
outParams[0] = floatToNormalized<GLint>(color.colorF.red);
outParams[1] = floatToNormalized<GLint>(color.colorF.green);
outParams[2] = floatToNormalized<GLint>(color.colorF.blue);
......@@ -117,11 +116,12 @@ void ConvertFromColor(const ColorGeneric &color, GLuint *outParams)
{
if (isPureInteger)
{
ASSERT(color.type == ColorGeneric::Type::UInt);
outParams[0] = color.colorUI.red;
outParams[1] = color.colorUI.green;
outParams[2] = color.colorUI.blue;
outParams[3] = color.colorUI.alpha;
constexpr unsigned int kMinValue = 0;
outParams[0] = std::max(color.colorUI.red, kMinValue);
outParams[1] = std::max(color.colorUI.green, kMinValue);
outParams[2] = std::max(color.colorUI.blue, kMinValue);
outParams[3] = std::max(color.colorUI.alpha, kMinValue);
}
else
{
......
......@@ -1222,6 +1222,10 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
mDepthStencilResolveProperties.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES;
mCustomBorderColorFeatures = {};
mCustomBorderColorFeatures.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT;
mMultisampledRenderToSingleSampledFeatures = {};
mMultisampledRenderToSingleSampledFeatures.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT;
......@@ -1325,6 +1329,12 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
vk::AddToPNextChain(&deviceProperties, &mDriverProperties);
}
// Query custom border color features
if (ExtensionFound(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, deviceExtensionNames))
{
vk::AddToPNextChain(&deviceFeatures, &mCustomBorderColorFeatures);
}
// Query subgroup properties
vk::AddToPNextChain(&deviceProperties, &mSubgroupProperties);
......@@ -1363,6 +1373,7 @@ void RendererVk::queryDeviceExtensionFeatures(const vk::ExtensionNameList &devic
mIndexTypeUint8Features.pNext = nullptr;
mSubgroupProperties.pNext = nullptr;
mExternalMemoryHostProperties.pNext = nullptr;
mCustomBorderColorFeatures.pNext = nullptr;
mShaderFloat16Int8Features.pNext = nullptr;
mDepthStencilResolveProperties.pNext = nullptr;
mMultisampledRenderToSingleSampledFeatures.pNext = nullptr;
......@@ -1701,6 +1712,12 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
vk::AddToPNextChain(&createInfo, &mTransformFeedbackFeatures);
}
if (getFeatures().supportsCustomBorderColorEXT.enabled)
{
enabledDeviceExtensions.push_back(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
vk::AddToPNextChain(&createInfo, &mCustomBorderColorFeatures);
}
if (getFeatures().supportsIndexTypeUint8.enabled)
{
enabledDeviceExtensions.push_back(VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME);
......@@ -2307,6 +2324,11 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
(!mFeatures.supportsTransformFeedbackExtension.enabled &&
mPhysicalDeviceFeatures.vertexPipelineStoresAndAtomics == VK_TRUE));
// TODO: http://anglebug.com/5927 - drop dependency on customBorderColorWithoutFormat.
ANGLE_FEATURE_CONDITION(&mFeatures, supportsCustomBorderColorEXT,
(mCustomBorderColorFeatures.customBorderColors == VK_TRUE &&
mCustomBorderColorFeatures.customBorderColorWithoutFormat == VK_TRUE));
ANGLE_FEATURE_CONDITION(&mFeatures, disableFifoPresentMode, IsLinux() && isIntel);
ANGLE_FEATURE_CONDITION(&mFeatures, bindEmptyForUnusedDescriptorSets,
......
......@@ -447,6 +447,7 @@ class RendererVk : angle::NonCopyable
VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT
mMultisampledRenderToSingleSampledFeatures;
VkPhysicalDeviceDriverPropertiesKHR mDriverProperties;
VkPhysicalDeviceCustomBorderColorFeaturesEXT mCustomBorderColorFeatures;
VkExternalFenceProperties mExternalFenceProperties;
VkExternalSemaphoreProperties mExternalSemaphoreProperties;
VkPhysicalDeviceSamplerYcbcrConversionFeatures mSamplerYcbcrConversionFeatures;
......
......@@ -3201,22 +3201,26 @@ SamplerDesc::SamplerDesc(const angle::FeaturesVk &featuresVk,
void SamplerDesc::reset()
{
mMipLodBias = 0.0f;
mMaxAnisotropy = 0.0f;
mMinLod = 0.0f;
mMaxLod = 0.0f;
mExternalFormat = 0;
mMagFilter = 0;
mMinFilter = 0;
mMipmapMode = 0;
mAddressModeU = 0;
mAddressModeV = 0;
mAddressModeW = 0;
mCompareEnabled = 0;
mCompareOp = 0;
mReserved[0] = 0;
mReserved[1] = 0;
mReserved[2] = 0;
mMipLodBias = 0.0f;
mMaxAnisotropy = 0.0f;
mMinLod = 0.0f;
mMaxLod = 0.0f;
mExternalFormat = 0;
mMagFilter = 0;
mMinFilter = 0;
mMipmapMode = 0;
mAddressModeU = 0;
mAddressModeV = 0;
mAddressModeW = 0;
mCompareEnabled = 0;
mCompareOp = 0;
mPadding = 0;
mBorderColorType = 0;
mBorderColor.red = 0.0f;
mBorderColor.green = 0.0f;
mBorderColor.blue = 0.0f;
mBorderColor.alpha = 0.0f;
mReserved = 0;
}
void SamplerDesc::update(const angle::FeaturesVk &featuresVk,
......@@ -3284,9 +3288,13 @@ void SamplerDesc::update(const angle::FeaturesVk &featuresVk,
mMaxLod = 0.25f;
}
mReserved[0] = 0;
mReserved[1] = 0;
mReserved[2] = 0;
mPadding = 0;
mBorderColorType =
(samplerState.getBorderColor().type == angle::ColorGeneric::Type::Float) ? 0 : 1;
mBorderColor = samplerState.getBorderColor().colorF;
mReserved = 0;
}
angle::Result SamplerDesc::init(ContextVk *contextVk, Sampler *sampler) const
......@@ -3357,6 +3365,30 @@ angle::Result SamplerDesc::init(ContextVk *contextVk, Sampler *sampler) const
createInfo.minFilter = VK_FILTER_NEAREST;
}
VkSamplerCustomBorderColorCreateInfoEXT customBorderColorInfo = {};
if (createInfo.addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER ||
createInfo.addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER ||
createInfo.addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)
{
ASSERT((contextVk->getRenderer()->getFeatures().supportsCustomBorderColorEXT.enabled));
customBorderColorInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT;
customBorderColorInfo.customBorderColor.float32[0] = mBorderColor.red;
customBorderColorInfo.customBorderColor.float32[1] = mBorderColor.green;
customBorderColorInfo.customBorderColor.float32[2] = mBorderColor.blue;
customBorderColorInfo.customBorderColor.float32[3] = mBorderColor.alpha;
if (mBorderColorType == static_cast<uint32_t>(angle::ColorGeneric::Type::Float))
{
createInfo.borderColor = VK_BORDER_COLOR_FLOAT_CUSTOM_EXT;
}
else
{
createInfo.borderColor = VK_BORDER_COLOR_INT_CUSTOM_EXT;
}
vk::AddToPNextChain(&createInfo, &customBorderColorInfo);
}
ANGLE_VK_TRY(contextVk, sampler->init(contextVk->getDevice(), createInfo));
return angle::Result::Continue;
......
......@@ -924,13 +924,19 @@ class SamplerDesc final
// 3 bits for compare op. (8 possible values)
uint16_t mCompareOp : 3;
// Border color and unnormalized coordinates implicitly set to contants.
uint16_t mPadding : 15;
// 48 extra bits reserved for future use.
uint16_t mReserved[3];
// Values from angle::ColorGeneric::Type. Float is 0 and others are 1.
uint16_t mBorderColorType : 1;
// 16*8 bits for BorderColor
angle::ColorF mBorderColor;
// 32 bits reserved for future use.
uint32_t mReserved;
};
static_assert(sizeof(SamplerDesc) == 32, "Unexpected SamplerDesc size");
static_assert(sizeof(SamplerDesc) == 48, "Unexpected SamplerDesc size");
// Disable warnings about struct padding.
ANGLE_DISABLE_STRUCT_PADDING_WARNINGS
......
......@@ -351,9 +351,9 @@ void RendererVk::ensureCapsInitialized() const
mNativeExtensions.robustness =
!IsSwiftshader(mPhysicalDeviceProperties.vendorID, mPhysicalDeviceProperties.deviceID) &&
!IsARM(mPhysicalDeviceProperties.vendorID);
mNativeExtensions.textureBorderClampOES = false; // not implemented yet
mNativeExtensions.discardFramebuffer = true;
mNativeExtensions.textureBorderClampOES = getFeatures().supportsCustomBorderColorEXT.enabled;
mNativeExtensions.textureBorderClampEXT = getFeatures().supportsCustomBorderColorEXT.enabled;
// Enable EXT_texture_type_2_10_10_10_REV
mNativeExtensions.textureFormat2101010REV = true;
......
......@@ -326,6 +326,28 @@
5641 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_24_bits.rgb8ui_rgb8i.cubemap_to_texture2d = SKIP
5641 NVIDIA VULKAN : dEQP-GLES31.functional.copy_image.non_compressed.viewclass_32_bits.rgb10_a2ui_rgba8.cubemap_to_texture3d = SKIP
// GL_EXT_texture_border_clamp related test failures on NVIDIA
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_rgb8_etc2.linear_size_not_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_rgb8_etc2.linear_size_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_rgb8_etc2.nearest_size_not_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_rgb8_etc2.nearest_size_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_srgb8_etc2.linear_size_not_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_srgb8_etc2.linear_size_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_srgb8_etc2.nearest_size_not_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.formats.compressed_srgb8_etc2.nearest_size_tile_multiple = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.nearest.s_clamp_to_edge_t_clamp_to_border_pot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.nearest.s_clamp_to_edge_t_clamp_to_border_npot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.nearest.s_repeat_t_clamp_to_border_pot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.nearest.s_repeat_t_clamp_to_border_npot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.nearest.s_mirrored_repeat_t_clamp_to_border_pot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.nearest.s_mirrored_repeat_t_clamp_to_border_npot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.linear.s_clamp_to_edge_t_clamp_to_border_pot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.linear.s_clamp_to_edge_t_clamp_to_border_npot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.linear.s_repeat_t_clamp_to_border_pot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.linear.s_repeat_t_clamp_to_border_npot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.linear.s_mirrored_repeat_t_clamp_to_border_pot = SKIP
5978 VULKAN NVIDIA : dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.compressed_color.linear.s_mirrored_repeat_t_clamp_to_border_npot = SKIP
// Pixel 4 expectations.
5990 PIXEL4ORXL VULKAN : dEQP-GLES31.functional.android_extension_pack.extensions.oes_sample_variables = SKIP
5990 PIXEL4ORXL VULKAN : dEQP-GLES31.functional.android_extension_pack.shaders.es31.extension_directive.oes_texture_storage_multisample_2d_array = SKIP
......
......@@ -76,6 +76,10 @@
4128 VULKAN NVIDIA : KHR-GLES31.core.shader_storage_buffer_object.advanced-unsizedArrayLength-vs-*-matR* = SKIP
4128 VULKAN NVIDIA : KHR-GLES31.core.shader_storage_buffer_object.advanced-unsizedArrayLength-fs-*-matR* = SKIP
// GL_EXT_texture_border_clamp related test failures on NVIDIA
5978 VULKAN NVIDIA : KHR-GLES31.core.texture_border_clamp.Texture2DDC16Linear = SKIP
5978 VULKAN NVIDIA : KHR-GLES31.core.texture_border_clamp.Texture2DDC32FLinear = SKIP
////
//// SwANGLE expectations
////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment