mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
Make SwapChainImpl a function and move it to common/
For the Vulkan backend it will make sense to have the SwapChain be implemented inside the backend as it will need to interact with a lot of things there. It will need SwapChainImpl and cannot see utils/ so SwapChainImpl has to be moved in common/ Also makes SwapChainImpl a function called CreateSwapChainImplementation as the inheritance was only used to share a static method.
This commit is contained in:
committed by
Corentin Wallez
parent
395bf15599
commit
cc407ae787
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "utils/BackendBinding.h"
|
||||
|
||||
#include "common/SwapChainUtils.h"
|
||||
#include "nxt/nxt_wsi.h"
|
||||
#include "utils/SwapChainImpl.h"
|
||||
|
||||
namespace backend { namespace vulkan {
|
||||
void Init(nxtProcTable* procs, nxtDevice* device);
|
||||
@@ -23,24 +23,16 @@ namespace backend { namespace vulkan {
|
||||
|
||||
namespace utils {
|
||||
|
||||
class SwapChainImplVulkan : SwapChainImpl {
|
||||
class SwapChainImplVulkan {
|
||||
public:
|
||||
static nxtSwapChainImplementation Create(GLFWwindow* window) {
|
||||
auto impl = GenerateSwapChainImplementation<SwapChainImplVulkan, nxtWSIContextVulkan>();
|
||||
impl.userData = new SwapChainImplVulkan(window);
|
||||
return impl;
|
||||
}
|
||||
using WSIContext = nxtWSIContextVulkan;
|
||||
|
||||
private:
|
||||
SwapChainImplVulkan(GLFWwindow* /*window*/) {
|
||||
}
|
||||
|
||||
~SwapChainImplVulkan() {
|
||||
}
|
||||
|
||||
// For GenerateSwapChainImplementation
|
||||
friend class SwapChainImpl;
|
||||
|
||||
void Init(nxtWSIContextVulkan*) {
|
||||
}
|
||||
|
||||
@@ -66,7 +58,7 @@ namespace utils {
|
||||
}
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
if (mSwapchainImpl.userData == nullptr) {
|
||||
mSwapchainImpl = SwapChainImplVulkan::Create(mWindow);
|
||||
mSwapchainImpl = CreateSwapChainImplementation(new SwapChainImplVulkan(mWindow));
|
||||
}
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user