Collect GPU device information for end2end tests - Part I

This patch is the first one to support inspecting GPU information for
dawn_end2end_tests.

In this patch, we support collecting the device name, device id and
vendor id on D3D12 and Vulkan. We also support collecting the device
name on OpenGL. The collection on Metal will be supported in the next
patch. Using this information we implement a series of APIs to inspect
the information of both OS and GPU vendor.

We also skip two failed tests on Windows Intel Vulkan backends.

BUG=dawn:10

Change-Id: If52a960c0bae3922a0b5650500218eff1400d77a
Reviewed-on: https://dawn-review.googlesource.com/1460
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Jiawei Shao
2018-09-19 00:32:52 +00:00
committed by Commit Bot service account
parent cd5e5756fd
commit 58809d413b
17 changed files with 177 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
#include "common/Assert.h"
#include "common/Constants.h"
#include "common/Math.h"
#include "common/Platform.h"
#include "dawn_native/DawnNative.h"
#include "dawn_wire/Wire.h"
#include "utils/BackendBinding.h"
@@ -125,6 +126,54 @@ bool DawnTest::IsVulkan() const {
return GetParam() == VulkanBackend;
}
bool DawnTest::IsAMD() const {
return mPCIInfo.vendorId == kVendorID_AMD;
}
bool DawnTest::IsARM() const {
return mPCIInfo.vendorId == kVendorID_ARM;
}
bool DawnTest::IsImgTec() const {
return mPCIInfo.vendorId == kVendorID_ImgTec;
}
bool DawnTest::IsIntel() const {
return mPCIInfo.vendorId == kVendorID_Intel;
}
bool DawnTest::IsNvidia() const {
return mPCIInfo.vendorId == kVendorID_Nvidia;
}
bool DawnTest::IsQualcomm() const {
return mPCIInfo.vendorId == kVendorID_Qualcomm;
}
bool DawnTest::IsWindows() const {
#ifdef DAWN_PLATFORM_WINDOWS
return true;
#else
return false;
#endif
}
bool DawnTest::IsLinux() const {
#ifdef DAWN_PLATFORM_LINUX
return true;
#else
return false;
#endif
}
bool DawnTest::IsMacOS() const {
#ifdef DAWN_PLATFORM_APPLE
return true;
#else
return false;
#endif
}
bool gTestUsesWire = false;
void DawnTest::SetUp() {
@@ -180,6 +229,8 @@ void DawnTest::SetUp() {
// The end2end tests should never cause validation errors. These should be tested in unittests.
device.SetErrorCallback(DeviceErrorCauseTestFailure, 0);
mPCIInfo = dawn_native::GetPCIInfo(backendDevice);
}
void DawnTest::TearDown() {

View File

@@ -13,6 +13,7 @@
// limitations under the License.
#include "dawn/dawncpp.h"
#include "dawn_native/DawnNative.h"
#include <gtest/gtest.h>
#include <memory>
@@ -64,6 +65,13 @@ enum BackendType {
};
std::ostream& operator<<(std::ostream& stream, BackendType backend);
constexpr uint32_t kVendorID_AMD = 0x1002;
constexpr uint32_t kVendorID_ARM = 0x13B5;
constexpr uint32_t kVendorID_ImgTec = 0x1010;
constexpr uint32_t kVendorID_Intel = 0x8086;
constexpr uint32_t kVendorID_Nvidia = 0x10DE;
constexpr uint32_t kVendorID_Qualcomm = 0x5143;
namespace utils {
class BackendBinding;
class TerribleCommandBuffer;
@@ -90,6 +98,17 @@ class DawnTest : public ::testing::TestWithParam<BackendType> {
bool IsOpenGL() const;
bool IsVulkan() const;
bool IsAMD() const;
bool IsARM() const;
bool IsImgTec() const;
bool IsIntel() const;
bool IsNvidia() const;
bool IsQualcomm() const;
bool IsWindows() const;
bool IsLinux() const;
bool IsMacOS() const;
protected:
dawn::Device device;
dawn::Queue queue;
@@ -167,6 +186,8 @@ class DawnTest : public ::testing::TestWithParam<BackendType> {
void ResolveExpectations();
std::unique_ptr<utils::BackendBinding> mBinding;
dawn_native::PCIInfo mPCIInfo;
};
// Instantiate the test once for each backend provided after the first argument. Use it like this:

View File

@@ -686,6 +686,7 @@ TEST_P(BlendStateTest, ColorWriteMaskBlendingDisabled) {
// Test that independent blend states on render targets works
TEST_P(BlendStateTest, IndependentBlendState) {
DAWN_SKIP_TEST_IF(IsWindows() && IsVulkan() && IsIntel());
std::array<dawn::Texture, 4> renderTargets;
std::array<dawn::TextureView, 4> renderTargetViews;

View File

@@ -90,6 +90,7 @@ TEST_P(ScissorTest, LargerThanAttachment) {
// Test setting an empty scissor rect
TEST_P(ScissorTest, EmptyRect) {
DAWN_SKIP_TEST_IF(IsMetal());
DAWN_SKIP_TEST_IF(IsWindows() && IsVulkan() && IsIntel());
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 2, 2);
dawn::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat);