Commit b1b6a171 by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Disable robustness support

Swiftshader does not currently have the ability to behave in a way for ANGLE to support KHR_robustness. Disable for now until that functionality is available. Bug: angleproject:3058 Bug: swiftshader:145 Change-Id: I1c1b8147f6b9cf6f8d0da633dfe0f61ebfab5175 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2097053 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarIan Elliott <ianelliott@google.com>
parent c5ee8e03
...@@ -140,6 +140,11 @@ bool IsQualcomm(VendorID vendorId) ...@@ -140,6 +140,11 @@ bool IsQualcomm(VendorID vendorId)
return vendorId == kVendorID_Qualcomm; return vendorId == kVendorID_Qualcomm;
} }
bool IsGoogle(VendorID vendorId)
{
return vendorId == kVendorID_GOOGLE;
}
bool IsVeriSilicon(VendorID vendorId) bool IsVeriSilicon(VendorID vendorId)
{ {
return vendorId == kVendorID_VeriSilicon; return vendorId == kVendorID_VeriSilicon;
......
...@@ -111,6 +111,7 @@ bool IsIntel(VendorID vendorId); ...@@ -111,6 +111,7 @@ bool IsIntel(VendorID vendorId);
bool IsKazan(VendorID vendorId); bool IsKazan(VendorID vendorId);
bool IsNVIDIA(VendorID vendorId); bool IsNVIDIA(VendorID vendorId);
bool IsQualcomm(VendorID vendorId); bool IsQualcomm(VendorID vendorId);
bool IsGoogle(VendorID vendorId);
bool IsSwiftshader(VendorID vendorId); bool IsSwiftshader(VendorID vendorId);
bool IsVeriSilicon(VendorID vendorId); bool IsVeriSilicon(VendorID vendorId);
bool IsVMWare(VendorID vendorId); bool IsVMWare(VendorID vendorId);
......
...@@ -32,10 +32,11 @@ enum VendorID : uint32_t ...@@ -32,10 +32,11 @@ enum VendorID : uint32_t
enum AndroidDeviceID : uint32_t enum AndroidDeviceID : uint32_t
{ {
ANDROID_DEVICE_ID_UNKNOWN = 0x0, ANDROID_DEVICE_ID_UNKNOWN = 0x0,
ANDROID_DEVICE_ID_NEXUS5X = 0x4010800, ANDROID_DEVICE_ID_NEXUS5X = 0x4010800,
ANDROID_DEVICE_ID_PIXEL1XL = 0x5040001, ANDROID_DEVICE_ID_PIXEL1XL = 0x5040001,
ANDROID_DEVICE_ID_PIXEL2 = 0x5030004, ANDROID_DEVICE_ID_PIXEL2 = 0x5030004,
ANDROID_DEVICE_ID_SWIFTSHADER = 0xC0DE,
}; };
inline bool IsAMD(uint32_t vendorId) inline bool IsAMD(uint32_t vendorId)
...@@ -88,6 +89,11 @@ inline bool IsPixel2(uint32_t vendorId, uint32_t deviceId) ...@@ -88,6 +89,11 @@ inline bool IsPixel2(uint32_t vendorId, uint32_t deviceId)
return IsQualcomm(vendorId) && deviceId == ANDROID_DEVICE_ID_PIXEL2; return IsQualcomm(vendorId) && deviceId == ANDROID_DEVICE_ID_PIXEL2;
} }
inline bool IsSwiftshader(uint32_t vendorId, uint32_t deviceId)
{
return IsGoogle(vendorId) && deviceId == ANDROID_DEVICE_ID_SWIFTSHADER;
}
const char *GetVendorString(uint32_t vendorId); const char *GetVendorString(uint32_t vendorId);
// Intel // Intel
......
...@@ -174,7 +174,7 @@ gl::Version DisplayVk::getMaxConformantESVersion() const ...@@ -174,7 +174,7 @@ gl::Version DisplayVk::getMaxConformantESVersion() const
void DisplayVk::generateExtensions(egl::DisplayExtensions *outExtensions) const void DisplayVk::generateExtensions(egl::DisplayExtensions *outExtensions) const
{ {
outExtensions->createContextRobustness = true; outExtensions->createContextRobustness = getRenderer()->getNativeExtensions().robustness;
outExtensions->surfaceOrientation = true; outExtensions->surfaceOrientation = true;
outExtensions->displayTextureShareGroup = true; outExtensions->displayTextureShareGroup = true;
outExtensions->robustResourceInitialization = true; outExtensions->robustResourceInitialization = true;
......
...@@ -40,7 +40,6 @@ namespace ...@@ -40,7 +40,6 @@ namespace
const uint32_t kMockVendorID = 0xba5eba11; const uint32_t kMockVendorID = 0xba5eba11;
const uint32_t kMockDeviceID = 0xf005ba11; const uint32_t kMockDeviceID = 0xf005ba11;
constexpr char kMockDeviceName[] = "Vulkan Mock Device"; constexpr char kMockDeviceName[] = "Vulkan Mock Device";
const uint32_t kSwiftShaderDeviceID = 0xC0DE;
constexpr char kSwiftShaderDeviceName[] = "SwiftShader Device"; constexpr char kSwiftShaderDeviceName[] = "SwiftShader Device";
constexpr VkFormatFeatureFlags kInvalidFormatFeatureFlags = static_cast<VkFormatFeatureFlags>(-1); constexpr VkFormatFeatureFlags kInvalidFormatFeatureFlags = static_cast<VkFormatFeatureFlags>(-1);
} // anonymous namespace } // anonymous namespace
...@@ -497,8 +496,7 @@ ICDFilterFunc GetFilterForICD(vk::ICD preferredICD) ...@@ -497,8 +496,7 @@ ICDFilterFunc GetFilterForICD(vk::ICD preferredICD)
}; };
case vk::ICD::SwiftShader: case vk::ICD::SwiftShader:
return [](const VkPhysicalDeviceProperties &deviceProperties) { return [](const VkPhysicalDeviceProperties &deviceProperties) {
return ((deviceProperties.vendorID == VENDOR_ID_GOOGLE) && return (IsSwiftshader(deviceProperties.vendorID, deviceProperties.deviceID) &&
(deviceProperties.deviceID == kSwiftShaderDeviceID) &&
(strncmp(deviceProperties.deviceName, kSwiftShaderDeviceName, (strncmp(deviceProperties.deviceName, kSwiftShaderDeviceName,
strlen(kSwiftShaderDeviceName)) == 0)); strlen(kSwiftShaderDeviceName)) == 0));
}; };
...@@ -1536,8 +1534,8 @@ void RendererVk::initFeatures(DisplayVk *displayVk, const ExtensionNameList &dev ...@@ -1536,8 +1534,8 @@ void RendererVk::initFeatures(DisplayVk *displayVk, const ExtensionNameList &dev
bool isIntel = IsIntel(mPhysicalDeviceProperties.vendorID); bool isIntel = IsIntel(mPhysicalDeviceProperties.vendorID);
bool isNvidia = IsNvidia(mPhysicalDeviceProperties.vendorID); bool isNvidia = IsNvidia(mPhysicalDeviceProperties.vendorID);
bool isQualcomm = IsQualcomm(mPhysicalDeviceProperties.vendorID); bool isQualcomm = IsQualcomm(mPhysicalDeviceProperties.vendorID);
bool isSwS = (IsGoogle(mPhysicalDeviceProperties.vendorID) && bool isSwS =
(mPhysicalDeviceProperties.deviceID == kSwiftShaderDeviceID)); IsSwiftshader(mPhysicalDeviceProperties.vendorID, mPhysicalDeviceProperties.deviceID);
if (mLineRasterizationFeatures.bresenhamLines == VK_TRUE) if (mLineRasterizationFeatures.bresenhamLines == VK_TRUE)
{ {
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "common/utilities.h" #include "common/utilities.h"
#include "libANGLE/Caps.h" #include "libANGLE/Caps.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/driver_utils.h"
#include "libANGLE/renderer/vulkan/DisplayVk.h" #include "libANGLE/renderer/vulkan/DisplayVk.h"
#include "libANGLE/renderer/vulkan/RendererVk.h" #include "libANGLE/renderer/vulkan/RendererVk.h"
#include "vk_format_utils.h" #include "vk_format_utils.h"
...@@ -70,7 +71,8 @@ void RendererVk::ensureCapsInitialized() const ...@@ -70,7 +71,8 @@ void RendererVk::ensureCapsInitialized() const
mNativeExtensions.copyTexture = true; mNativeExtensions.copyTexture = true;
mNativeExtensions.copyCompressedTexture = true; mNativeExtensions.copyCompressedTexture = true;
mNativeExtensions.debugMarker = true; mNativeExtensions.debugMarker = true;
mNativeExtensions.robustness = true; mNativeExtensions.robustness =
!IsSwiftshader(mPhysicalDeviceProperties.vendorID, mPhysicalDeviceProperties.deviceID);
mNativeExtensions.textureBorderClampOES = false; // not implemented yet mNativeExtensions.textureBorderClampOES = false; // not implemented yet
mNativeExtensions.translatedShaderSource = true; mNativeExtensions.translatedShaderSource = true;
mNativeExtensions.discardFramebuffer = true; mNativeExtensions.discardFramebuffer = true;
......
...@@ -129,19 +129,19 @@ TEST_P(ContextLostSkipValidationTest, LostNoErrorGetProgram) ...@@ -129,19 +129,19 @@ TEST_P(ContextLostSkipValidationTest, LostNoErrorGetProgram)
// Use this to select which configurations (e.g. which renderer, which GLES major version) these // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against. // tests should be run against.
ANGLE_INSTANTIATE_TEST(ContextLostTest, ANGLE_INSTANTIATE_TEST(ContextLostTest,
ES2_NULL(), WithRobustness(ES2_NULL()),
ES2_D3D9(), WithRobustness(ES2_D3D9()),
ES2_D3D11(), WithRobustness(ES2_D3D11()),
ES3_D3D11(), WithRobustness(ES3_D3D11()),
ES2_VULKAN(), WithRobustness(ES2_VULKAN()),
ES3_VULKAN()); WithRobustness(ES3_VULKAN()));
ANGLE_INSTANTIATE_TEST(ContextLostSkipValidationTest, ANGLE_INSTANTIATE_TEST(ContextLostSkipValidationTest,
ES2_NULL(), WithRobustness(ES2_NULL()),
ES2_D3D9(), WithRobustness(ES2_D3D9()),
ES2_D3D11(), WithRobustness(ES2_D3D11()),
ES3_D3D11(), WithRobustness(ES3_D3D11()),
ES2_VULKAN(), WithRobustness(ES2_VULKAN()),
ES3_VULKAN()); WithRobustness(ES3_VULKAN()));
} // namespace angle } // namespace angle
...@@ -476,7 +476,7 @@ class ANGLETestBase ...@@ -476,7 +476,7 @@ class ANGLETestBase
bool isVulkanSwiftshaderRenderer() const bool isVulkanSwiftshaderRenderer() const
{ {
return mCurrentParams->getRenderer() == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE && return mCurrentParams->getRenderer() == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE &&
mCurrentParams->getDeviceType() == EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE; mCurrentParams->isSwiftshader();
} }
bool platformSupportsMultithreading() const; bool platformSupportsMultithreading() const;
......
...@@ -44,6 +44,11 @@ EGLint PlatformParameters::getDeviceType() const ...@@ -44,6 +44,11 @@ EGLint PlatformParameters::getDeviceType() const
return eglParameters.deviceType; return eglParameters.deviceType;
} }
bool PlatformParameters::isSwiftshader() const
{
return eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE;
}
void PlatformParameters::initDefaultParameters() void PlatformParameters::initDefaultParameters()
{ {
// Default debug layers to enabled in tests. // Default debug layers to enabled in tests.
......
...@@ -44,6 +44,7 @@ struct PlatformParameters ...@@ -44,6 +44,7 @@ struct PlatformParameters
EGLint getRenderer() const; EGLint getRenderer() const;
EGLint getDeviceType() const; EGLint getDeviceType() const;
bool isSwiftshader() const;
void initDefaultParameters(); void initDefaultParameters();
...@@ -223,6 +224,13 @@ inline PlatformParameters WithAllocateNonZeroMemory(const PlatformParameters &pa ...@@ -223,6 +224,13 @@ inline PlatformParameters WithAllocateNonZeroMemory(const PlatformParameters &pa
allocateNonZero.eglParameters.allocateNonZeroMemoryFeature = EGL_TRUE; allocateNonZero.eglParameters.allocateNonZeroMemoryFeature = EGL_TRUE;
return allocateNonZero; return allocateNonZero;
} }
inline PlatformParameters WithRobustness(const PlatformParameters &params)
{
PlatformParameters withRobustness = params;
withRobustness.eglParameters.robustness = EGL_TRUE;
return withRobustness;
}
} // namespace angle } // namespace angle
#endif // ANGLE_TEST_CONFIGS_H_ #endif // ANGLE_TEST_CONFIGS_H_
...@@ -433,6 +433,21 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters ...@@ -433,6 +433,21 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters
} }
} }
// TODO: http://crbug.com/swiftshader/145
// Swiftshader does not currently have all the robustness features
// we need for ANGLE. In particular, it is unable to detect and recover
// from infinitely looping shaders. That bug is the tracker for fixing
// that and when resolved we can remove the following code.
// This test will disable tests marked with the config WithRobustness
// when run with the swiftshader Vulkan driver and on Android.
DeviceID deviceID =
systemInfo.gpus.empty() ? 0 : systemInfo.gpus[systemInfo.activeGPUIndex].deviceId;
if ((param.isSwiftshader() || (IsGoogle(vendorID) && deviceID == kDeviceID_Swiftshader)) &&
param.eglParameters.robustness)
{
return false;
}
// Currently we support the GLES and Vulkan back-ends on Android. // Currently we support the GLES and Vulkan back-ends on Android.
switch (param.getRenderer()) switch (param.getRenderer())
{ {
......
...@@ -49,7 +49,7 @@ struct EGLPlatformParameters ...@@ -49,7 +49,7 @@ struct EGLPlatformParameters
{ {
return std::tie(renderer, majorVersion, minorVersion, deviceType, presentPath, return std::tie(renderer, majorVersion, minorVersion, deviceType, presentPath,
debugLayersEnabled, contextVirtualization, transformFeedbackFeature, debugLayersEnabled, contextVirtualization, transformFeedbackFeature,
allocateNonZeroMemoryFeature, platformMethods); allocateNonZeroMemoryFeature, platformMethods, robustness);
} }
EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
...@@ -59,6 +59,7 @@ struct EGLPlatformParameters ...@@ -59,6 +59,7 @@ struct EGLPlatformParameters
EGLint presentPath = EGL_DONT_CARE; EGLint presentPath = EGL_DONT_CARE;
EGLint debugLayersEnabled = EGL_DONT_CARE; EGLint debugLayersEnabled = EGL_DONT_CARE;
EGLint contextVirtualization = EGL_DONT_CARE; EGLint contextVirtualization = EGL_DONT_CARE;
EGLint robustness = EGL_DONT_CARE;
EGLint transformFeedbackFeature = EGL_DONT_CARE; EGLint transformFeedbackFeature = EGL_DONT_CARE;
EGLint allocateNonZeroMemoryFeature = EGL_DONT_CARE; EGLint allocateNonZeroMemoryFeature = EGL_DONT_CARE;
angle::PlatformMethods *platformMethods = nullptr; angle::PlatformMethods *platformMethods = nullptr;
......
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