Add FromAPI / ToAPI helpers for dawn_native

Helps to avoid explicitly using reinterpret_cast

Change-Id: I4df0e7094c7d8460385c6f23dac529ace9df9bdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67605
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng
2021-10-27 19:07:37 +00:00
committed by Dawn LUCI CQ
parent 346b58cfba
commit 3faa478ed2
10 changed files with 77 additions and 18 deletions

View File

@@ -105,6 +105,7 @@ dawn_json_generator("dawn_native_utils_gen") {
"src/dawn_native/ChainUtils_autogen.h",
"src/dawn_native/ChainUtils_autogen.cpp",
"src/dawn_native/ProcTable.cpp",
"src/dawn_native/dawn_platform_autogen.h",
"src/dawn_native/wgpu_structs_autogen.h",
"src/dawn_native/wgpu_structs_autogen.cpp",
"src/dawn_native/ValidationUtils_autogen.h",

View File

@@ -103,9 +103,6 @@ namespace dawn_native {
uint64_t mDebugGroupStackSize = 0;
};
// For the benefit of template generation.
using CommandEncoderBase = CommandEncoder;
} // namespace dawn_native
#endif // DAWNNATIVE_COMMANDENCODER_H_

View File

@@ -69,9 +69,6 @@ namespace dawn_native {
Ref<CommandEncoder> mCommandEncoder;
};
// For the benefit of template generation.
using ComputePassEncoderBase = ComputePassEncoder;
} // namespace dawn_native
#endif // DAWNNATIVE_COMPUTEPASSENCODER_H_

View File

@@ -59,6 +59,13 @@ namespace dawn_native {
struct Format;
// Aliases for frontend-only types.
using CommandEncoderBase = CommandEncoder;
using ComputePassEncoderBase = ComputePassEncoder;
using RenderBundleEncoderBase = RenderBundleEncoder;
using RenderPassEncoderBase = RenderPassEncoder;
using SurfaceBase = Surface;
} // namespace dawn_native
#endif // DAWNNATIVE_FORWARD_H_

View File

@@ -49,9 +49,6 @@ namespace dawn_native {
EncodingContext mBundleEncodingContext;
};
// For the benefit of template generation.
using RenderBundleEncoderBase = RenderBundleEncoder;
} // namespace dawn_native
#endif // DAWNNATIVE_RENDERBUNDLEENCODER_H_

View File

@@ -82,9 +82,6 @@ namespace dawn_native {
bool mOcclusionQueryActive = false;
};
// For the benefit of template generation.
using RenderPassEncoderBase = RenderPassEncoder;
} // namespace dawn_native
#endif // DAWNNATIVE_RENDERPASSENCODER_H_

View File

@@ -105,9 +105,6 @@ namespace dawn_native {
const absl::FormatConversionSpec& spec,
absl::FormatSink* s);
// For the benefit of template generation.
using SurfaceBase = Surface;
} // namespace dawn_native
#endif // DAWNNATIVE_SURFACE_H_

View File

@@ -18,9 +18,7 @@
// Use webgpu_cpp to have the enum and bitfield definitions
#include <dawn/webgpu_cpp.h>
// Use our autogenerated version of the wgpu structures that point to dawn_native object types
// (wgpu::Buffer is dawn_native::BufferBase*)
#include <dawn_native/wgpu_structs_autogen.h>
#include <dawn_native/dawn_platform_autogen.h>
namespace dawn_native {
// Extra buffer usages