Support force enabling multiple toggles in Dawn end2end tests
This patch adds the support of enabling multiple toggles in Dawn end2end tests so that we can run MultisampledRenderingTests with all MSAA related toggles enabled. BUG=dawn:56 TEST=dawn_end2end_tests Change-Id: Ia1a16a25261a2eddbb0e54326eebf1188dab9c10 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7484 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
8b5fc36191
commit
93373abb2f
|
@ -67,12 +67,6 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
dawn_native::DeviceDescriptor InitWorkaround(const char* forceEnabledWorkaround) {
|
||||
dawn_native::DeviceDescriptor deviceDescriptor;
|
||||
deviceDescriptor.forceEnabledToggles.push_back(forceEnabledWorkaround);
|
||||
return deviceDescriptor;
|
||||
}
|
||||
|
||||
struct MapReadUserdata {
|
||||
DawnTest* test;
|
||||
size_t slot;
|
||||
|
@ -82,9 +76,15 @@ namespace {
|
|||
|
||||
} // namespace
|
||||
|
||||
DawnTestParam ForceWorkaround(const DawnTestParam& originParam, const char* workaround) {
|
||||
const DawnTestParam D3D12Backend(dawn_native::BackendType::D3D12);
|
||||
const DawnTestParam MetalBackend(dawn_native::BackendType::Metal);
|
||||
const DawnTestParam OpenGLBackend(dawn_native::BackendType::OpenGL);
|
||||
const DawnTestParam VulkanBackend(dawn_native::BackendType::Vulkan);
|
||||
|
||||
DawnTestParam ForceWorkarounds(const DawnTestParam& originParam,
|
||||
std::initializer_list<const char*> forceEnabledWorkarounds) {
|
||||
DawnTestParam newTestParam = originParam;
|
||||
newTestParam.forceEnabledWorkaround = workaround;
|
||||
newTestParam.forceEnabledWorkarounds = forceEnabledWorkarounds;
|
||||
return newTestParam;
|
||||
}
|
||||
|
||||
|
@ -307,14 +307,13 @@ void DawnTest::SetUp() {
|
|||
|
||||
mPCIInfo = backendAdapter.GetPCIInfo();
|
||||
|
||||
const char* forceEnabledWorkaround = GetParam().forceEnabledWorkaround;
|
||||
if (forceEnabledWorkaround != nullptr) {
|
||||
DawnDevice backendDevice;
|
||||
for (const char* forceEnabledWorkaround : GetParam().forceEnabledWorkarounds) {
|
||||
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(forceEnabledWorkaround) != nullptr);
|
||||
dawn_native::DeviceDescriptor deviceDescriptor = InitWorkaround(forceEnabledWorkaround);
|
||||
backendDevice = backendAdapter.CreateDevice(&deviceDescriptor);
|
||||
} else {
|
||||
backendDevice = backendAdapter.CreateDevice(nullptr);
|
||||
}
|
||||
dawn_native::DeviceDescriptor deviceDescriptor;
|
||||
deviceDescriptor.forceEnabledToggles = GetParam().forceEnabledWorkarounds;
|
||||
backendDevice = backendAdapter.CreateDevice(&deviceDescriptor);
|
||||
|
||||
backendProcs = dawn_native::GetProcs();
|
||||
|
||||
|
@ -639,8 +638,8 @@ namespace detail {
|
|||
std::ostringstream ostream;
|
||||
ostream << ParamName(info.param.backendType);
|
||||
|
||||
if (info.param.forceEnabledWorkaround != nullptr) {
|
||||
ostream << "_" << info.param.forceEnabledWorkaround;
|
||||
for (const char* forceEnabledWorkaround : info.param.forceEnabledWorkarounds) {
|
||||
ostream << "_" << forceEnabledWorkaround;
|
||||
}
|
||||
|
||||
return ostream.str();
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
// Getting data back from Dawn is done in an async manners so all expectations are "deferred"
|
||||
// until the end of the test. Also expectations use a copy to a MapRead buffer to get the data
|
||||
|
@ -63,34 +64,33 @@ struct RGBA8 {
|
|||
std::ostream& operator<<(std::ostream& stream, const RGBA8& color);
|
||||
|
||||
struct DawnTestParam {
|
||||
constexpr explicit DawnTestParam(dawn_native::BackendType backendType)
|
||||
: backendType(backendType) {
|
||||
explicit DawnTestParam(dawn_native::BackendType backendType) : backendType(backendType) {
|
||||
}
|
||||
|
||||
dawn_native::BackendType backendType;
|
||||
|
||||
// TODO(jiawei.shao@intel.com): support enabling and disabling multiple workarounds.
|
||||
const char* forceEnabledWorkaround = nullptr;
|
||||
std::vector<const char*> forceEnabledWorkarounds;
|
||||
};
|
||||
|
||||
// Shorthands for backend types used in the DAWN_INSTANTIATE_TEST
|
||||
static constexpr DawnTestParam D3D12Backend(dawn_native::BackendType::D3D12);
|
||||
static constexpr DawnTestParam MetalBackend(dawn_native::BackendType::Metal);
|
||||
static constexpr DawnTestParam OpenGLBackend(dawn_native::BackendType::OpenGL);
|
||||
static constexpr DawnTestParam VulkanBackend(dawn_native::BackendType::Vulkan);
|
||||
extern const DawnTestParam D3D12Backend;
|
||||
extern const DawnTestParam MetalBackend;
|
||||
extern const DawnTestParam OpenGLBackend;
|
||||
extern const DawnTestParam VulkanBackend;
|
||||
|
||||
DawnTestParam ForceWorkaround(const DawnTestParam& originParam, const char* workaround);
|
||||
DawnTestParam ForceWorkarounds(const DawnTestParam& originParam,
|
||||
std::initializer_list<const char*> forceEnabledWorkarounds);
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
namespace utils {
|
||||
class BackendBinding;
|
||||
class TerribleCommandBuffer;
|
||||
}
|
||||
} // namespace utils
|
||||
|
||||
namespace detail {
|
||||
class Expectation;
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
namespace dawn_wire {
|
||||
class WireClient;
|
||||
|
|
|
@ -511,5 +511,8 @@ DAWN_INSTANTIATE_TEST(MultisampledRenderingTest,
|
|||
MetalBackend,
|
||||
OpenGLBackend,
|
||||
VulkanBackend,
|
||||
ForceWorkaround(MetalBackend, "emulate_store_and_msaa_resolve"),
|
||||
ForceWorkaround(MetalBackend, "always_resolve_into_zero_level_and_layer"));
|
||||
ForceWorkarounds(MetalBackend, {"emulate_store_and_msaa_resolve"}),
|
||||
ForceWorkarounds(MetalBackend, {"always_resolve_into_zero_level_and_layer"}),
|
||||
ForceWorkarounds(MetalBackend,
|
||||
{"always_resolve_into_zero_level_and_layer",
|
||||
"emulate_store_and_msaa_resolve"}));
|
||||
|
|
|
@ -94,8 +94,10 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
|
|||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, 0, 0, kSize, kSize, 0, 2);
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(
|
||||
NonzeroTextureCreationTests,
|
||||
ForceWorkaround(D3D12Backend, "nonzero_clear_resources_on_creation_for_testing"),
|
||||
ForceWorkaround(OpenGLBackend, "nonzero_clear_resources_on_creation_for_testing"),
|
||||
ForceWorkaround(VulkanBackend, "nonzero_clear_resources_on_creation_for_testing"));
|
||||
DAWN_INSTANTIATE_TEST(NonzeroTextureCreationTests,
|
||||
ForceWorkarounds(D3D12Backend,
|
||||
{"nonzero_clear_resources_on_creation_for_testing"}),
|
||||
ForceWorkarounds(OpenGLBackend,
|
||||
{"nonzero_clear_resources_on_creation_for_testing"}),
|
||||
ForceWorkarounds(VulkanBackend,
|
||||
{"nonzero_clear_resources_on_creation_for_testing"}));
|
||||
|
|
Loading…
Reference in New Issue