Replace reinterpret_cast with FromAPI/ToAPI where possible

This brings more type safety to the code and is marginally more
readable.

Bug: None
Change-Id: I0330a8a8e95cd9b8b531af266acd8fdc50c50460
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71606
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2021-12-03 16:47:18 +00:00
committed by Dawn LUCI CQ
parent 9dc3c0bc86
commit c6d3a840da
26 changed files with 124 additions and 155 deletions

View File

@@ -73,7 +73,7 @@ TEST_F(FeatureTests, GetEnabledFeatures) {
dawn_native::DawnDeviceDescriptor deviceDescriptor;
deviceDescriptor.requiredFeatures = {featureName};
dawn_native::DeviceBase* deviceBase =
reinterpret_cast<dawn_native::DeviceBase*>(adapter.CreateDevice(&deviceDescriptor));
dawn_native::FromAPI(adapter.CreateDevice(&deviceDescriptor));
std::vector<const char*> enabledFeatures = deviceBase->GetEnabledFeatures();
ASSERT_EQ(1u, enabledFeatures.size());
ASSERT_EQ(0, std::strcmp(featureName, enabledFeatures[0]));