Remove the dependency on Dawn's SwapChainUtils.
This is not part of the public API of Dawn and will be unnecessary once Dawn move to "surface based swapchains". DawnD3D12WindowContext didn't need the include so all that's needed is copying the helper in DawnMTLWindowContext. Change-Id: I8d0682b6b0801dc311ad4c7d73d4c07e575ecf4e Bug: chromium:1064305 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/282496 Reviewed-by: Zhenyao Mo <zmo@google.com> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
207d24bef9
commit
e2c5bcf868
@ -7,7 +7,6 @@
|
||||
|
||||
#include "tools/sk_app/DawnWindowContext.h"
|
||||
#include "tools/sk_app/mac/WindowContextFactory_mac.h"
|
||||
#include "common/SwapChainUtils.h"
|
||||
#include "dawn/webgpu_cpp.h"
|
||||
#include "dawn/dawn_wsi.h"
|
||||
#include "dawn_native/DawnNative.h"
|
||||
@ -21,6 +20,26 @@ namespace sk_app {
|
||||
|
||||
using sk_app::window_context_factory::MacWindowInfo;
|
||||
|
||||
template <typename T>
|
||||
DawnSwapChainImplementation CreateSwapChainImplementation(T* swapChain) {
|
||||
DawnSwapChainImplementation impl = {};
|
||||
impl.userData = swapChain;
|
||||
impl.Init = [](void* userData, void* wsiContext) {
|
||||
auto* ctx = static_cast<typename T::WSIContext*>(wsiContext);
|
||||
reinterpret_cast<T*>(userData)->Init(ctx);
|
||||
};
|
||||
impl.Destroy = [](void* userData) { delete reinterpret_cast<T*>(userData); };
|
||||
impl.Configure = [](void* userData, WGPUTextureFormat format, WGPUTextureUsage allowedUsage,
|
||||
uint32_t width, uint32_t height) {
|
||||
return static_cast<T*>(userData)->Configure(format, allowedUsage, width, height);
|
||||
};
|
||||
impl.GetNextTexture = [](void* userData, DawnSwapChainNextTexture* nextTexture) {
|
||||
return static_cast<T*>(userData)->GetNextTexture(nextTexture);
|
||||
};
|
||||
impl.Present = [](void* userData) { return static_cast<T*>(userData)->Present(); };
|
||||
return impl;
|
||||
}
|
||||
|
||||
class DawnMTLWindowContext : public DawnWindowContext {
|
||||
public:
|
||||
DawnMTLWindowContext(const MacWindowInfo& info, const DisplayParams& params);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "dawn/dawn_wsi.h"
|
||||
#include "dawn_native/DawnNative.h"
|
||||
#include "dawn_native/D3D12Backend.h"
|
||||
#include "common/SwapChainUtils.h"
|
||||
|
||||
namespace sk_app {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user