Fix SwANGLE DeviceType and OpenGL ES DeviceType checking.

OpenGL ES drivers (like OpenGL drivers) have DeviceType::Unknown.
We want to allow testing of unknown native GLES drivers,
as we do for GL drivers, so add them to the conditional.

NOTE: this change will enable the OpenGLES backend to run tests on
the CQ and waterfall bots.

Mark SwANGLE as a "CPU" adapter type, rather than unknown, since we
don't want to test it by default.

Bug:dawn:580 dawn:447 dawn:661
Change-Id: I21577cb9d1fdec53704433a5db1fe2603bdbeb6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39920
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2021-02-03 13:02:09 +00:00 committed by Commit Bot service account
parent fd5fd05db0
commit 9bb02dbbc6
5 changed files with 46 additions and 1 deletions

View File

@ -183,6 +183,10 @@ namespace dawn_native { namespace opengl {
mDriverDescription = std::string("OpenGL version ") +
reinterpret_cast<const char*>(mFunctions.GetString(GL_VERSION));
if (mPCIInfo.name.find("SwiftShader") != std::string::npos) {
mAdapterType = wgpu::AdapterType::CPU;
}
InitializeSupportedExtensions();
return {};

View File

@ -439,7 +439,8 @@ void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::In
// If we ever have Swiftshader GL (unlikely), we could set the DeviceType properly.
(preferredDeviceType != dawn_native::DeviceType::CPU &&
adapter.GetDeviceType() == dawn_native::DeviceType::Unknown &&
properties.backendType == wgpu::BackendType::OpenGL) ||
(properties.backendType == wgpu::BackendType::OpenGL ||
properties.backendType == wgpu::BackendType::OpenGLES)) ||
// Always select the Null backend. There are few tests on this backend, and they run
// quickly. This is temporary as to not lose coverage. We can group it with
// Swiftshader as a CPU adapter when we have Swiftshader tests.

View File

@ -980,6 +980,9 @@ TEST_P(BufferZeroInitTest, Copy2DArrayTextureToBuffer) {
// Test that the buffer will be lazy initialized correctly when its first use is to be bound as a
// uniform buffer.
TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
// TODO(crbug.com/dawn/661): Diagnose and fix this backend validation failure on GLES.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
const char* computeShader = R"(
#version 450
layout(set = 0, binding = 0, std140) uniform UBO {
@ -1016,6 +1019,9 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
// Test that the buffer will be lazy initialized correctly when its first use is to be bound as a
// read-only storage buffer.
TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
// TODO(crbug.com/dawn/661): Diagnose and fix this backend validation failure on GLES.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
const char* computeShader = R"(
#version 450
layout(set = 0, binding = 0, std140) readonly buffer SSBO {
@ -1052,6 +1058,9 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
// Test that the buffer will be lazy initialized correctly when its first use is to be bound as a
// storage buffer.
TEST_P(BufferZeroInitTest, BoundAsStorageBuffer) {
// TODO(crbug.com/dawn/661): Diagnose and fix this backend validation failure on GLES.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
// TODO(crbug.com/tint/375): Enable once barriers are implemented
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
const char* computeShader = R"(
@ -1162,6 +1171,9 @@ TEST_P(BufferZeroInitTest, IndirectBufferForDrawIndexedIndirect) {
// Test the buffer will be lazily initialized correctly when its first use is an indirect buffer for
// DispatchIndirect.
TEST_P(BufferZeroInitTest, IndirectBufferForDispatchIndirect) {
// TODO(crbug.com/dawn/661): Diagnose and fix this backend validation failure on GLES.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
// Bind the whole buffer as an indirect buffer.
{
constexpr uint64_t kOffset = 0u;

View File

@ -230,6 +230,10 @@ TEST_P(GpuMemorySyncTests, ComputePassToRenderPass) {
// Use an image as both sampled and readonly storage in a compute pass. This is a regression test
// for the Vulkan backend choosing different layouts for Sampled and ReadOnlyStorage.
TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
// TODO(crbug.com/dawn/646): diagnose and fix this OpenGL ES backend validation failure.
// "GL_INVALID_OPERATION error generated. Image variable update is not allowed."
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
// Create a storage + sampled texture of one texel initialized to 1
wgpu::TextureDescriptor texDesc;
texDesc.format = wgpu::TextureFormat::R32Uint;

View File

@ -691,6 +691,9 @@ TEST_P(StorageTextureTests, BindGroupLayoutWithStorageTextureBindingType) {
// Test that read-only storage textures are supported in compute shader.
TEST_P(StorageTextureTests, ReadonlyStorageTextureInComputeShader) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
if (!utils::TextureFormatSupportsStorageTexture(format)) {
continue;
@ -729,6 +732,9 @@ TEST_P(StorageTextureTests, ReadonlyStorageTextureInComputeShader) {
// Test that read-only storage textures are supported in vertex shader.
TEST_P(StorageTextureTests, ReadonlyStorageTextureInVertexShader) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
if (!utils::TextureFormatSupportsStorageTexture(format)) {
continue;
@ -911,6 +917,9 @@ TEST_P(StorageTextureTests, WriteonlyStorageTextureInFragmentShader) {
// Verify 2D array read-only storage texture works correctly.
TEST_P(StorageTextureTests, Readonly2DArrayStorageTexture) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
constexpr uint32_t kArrayLayerCount = 3u;
constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
@ -944,6 +953,9 @@ TEST_P(StorageTextureTests, Readonly2DArrayStorageTexture) {
// Verify 2D array write-only storage texture works correctly.
TEST_P(StorageTextureTests, Writeonly2DArrayStorageTexture) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
constexpr uint32_t kArrayLayerCount = 3u;
constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
@ -1166,6 +1178,9 @@ fn doTest() -> bool {
// Verify that the texture is correctly cleared to 0 before its first usage as a read-only storage
// texture in a render pass.
TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPass) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
wgpu::Texture readonlyStorageTexture =
CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::Storage);
@ -1190,6 +1205,9 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPa
// Verify that the texture is correctly cleared to 0 before its first usage as a read-only storage
// texture in a compute pass.
TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputePass) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
wgpu::Texture readonlyStorageTexture =
CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::Storage);
@ -1217,6 +1235,9 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputeP
// Verify that the texture is correctly cleared to 0 before its first usage as a write-only storage
// storage texture in a render pass.
TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInRenderPass) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
// Prepare the write-only storage texture.
constexpr uint32_t kTexelSizeR32Uint = 4u;
wgpu::Texture writeonlyStorageTexture = CreateTexture(
@ -1230,6 +1251,9 @@ TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInRenderP
// Verify that the texture is correctly cleared to 0 before its first usage as a write-only storage
// texture in a compute pass.
TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInComputePass) {
// TODO(crbug.com/dawn/624): this test fails validation on GLES. Investigate why.
DAWN_SKIP_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
// Prepare the write-only storage texture.
constexpr uint32_t kTexelSizeR32Uint = 4u;
wgpu::Texture writeonlyStorageTexture = CreateTexture(