mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 08:06:19 +00:00
Change the API prefix in generators from nxt to dawn
This commit is contained in:
committed by
Corentin Wallez
parent
ae79c03d45
commit
b1669e3fa4
@@ -19,7 +19,7 @@
|
||||
|
||||
struct GLFWwindow;
|
||||
typedef struct nxtProcTable_s nxtProcTable;
|
||||
typedef struct nxtDeviceImpl* nxtDevice;
|
||||
typedef struct dawnDeviceImpl* dawnDevice;
|
||||
|
||||
namespace utils {
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace utils {
|
||||
virtual ~BackendBinding() = default;
|
||||
|
||||
virtual void SetupGLFWWindowHints() = 0;
|
||||
virtual void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) = 0;
|
||||
virtual void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) = 0;
|
||||
virtual uint64_t GetSwapChainImplementation() = 0;
|
||||
virtual nxtTextureFormat GetPreferredSwapChainTextureFormat() = 0;
|
||||
virtual dawnTextureFormat GetPreferredSwapChainTextureFormat() = 0;
|
||||
|
||||
void SetWindow(GLFWwindow* window);
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
#include "GLFW/glfw3native.h"
|
||||
|
||||
namespace backend { namespace d3d12 {
|
||||
void Init(nxtProcTable* procs, nxtDevice* device);
|
||||
void Init(nxtProcTable* procs, dawnDevice* device);
|
||||
|
||||
dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, HWND window);
|
||||
nxtTextureFormat GetNativeSwapChainPreferredFormat(
|
||||
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, HWND window);
|
||||
dawnTextureFormat GetNativeSwapChainPreferredFormat(
|
||||
const dawnSwapChainImplementation* swapChain);
|
||||
}} // namespace backend::d3d12
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace utils {
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
}
|
||||
|
||||
void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override {
|
||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
||||
backend::d3d12::Init(procs, device);
|
||||
mBackendDevice = *device;
|
||||
}
|
||||
@@ -51,13 +51,13 @@ namespace utils {
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
nxtTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
ASSERT(mSwapchainImpl.userData != nullptr);
|
||||
return backend::d3d12::GetNativeSwapChainPreferredFormat(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
private:
|
||||
nxtDevice mBackendDevice = nullptr;
|
||||
dawnDevice mBackendDevice = nullptr;
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
|
||||
namespace backend { namespace metal {
|
||||
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, nxtDevice* device);
|
||||
void SetNextDrawable(nxtDevice device, id<CAMetalDrawable> drawable);
|
||||
void Present(nxtDevice device);
|
||||
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, dawnDevice* device);
|
||||
void SetNextDrawable(dawnDevice device, id<CAMetalDrawable> drawable);
|
||||
void Present(dawnDevice device);
|
||||
}}
|
||||
|
||||
namespace utils {
|
||||
@@ -49,11 +49,11 @@ namespace utils {
|
||||
mCommandQueue = [mMtlDevice newCommandQueue];
|
||||
}
|
||||
|
||||
dawnSwapChainError Configure(nxtTextureFormat format,
|
||||
nxtTextureUsageBit,
|
||||
dawnSwapChainError Configure(dawnTextureFormat format,
|
||||
dawnTextureUsageBit,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (format != NXT_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM) {
|
||||
if (format != DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM) {
|
||||
return "unsupported format";
|
||||
}
|
||||
ASSERT(width > 0);
|
||||
@@ -114,7 +114,7 @@ namespace utils {
|
||||
void SetupGLFWWindowHints() override {
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
}
|
||||
void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override {
|
||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
||||
mMetalDevice = MTLCreateSystemDefaultDevice();
|
||||
|
||||
backend::metal::Init(mMetalDevice, procs, device);
|
||||
@@ -129,13 +129,13 @@ namespace utils {
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
nxtTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return NXT_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM;
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM;
|
||||
}
|
||||
|
||||
private:
|
||||
id<MTLDevice> mMetalDevice = nil;
|
||||
nxtDevice mBackendDevice = nullptr;
|
||||
dawnDevice mBackendDevice = nullptr;
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "utils/BackendBinding.h"
|
||||
|
||||
namespace backend { namespace null {
|
||||
void Init(nxtProcTable* procs, nxtDevice* device);
|
||||
void Init(nxtProcTable* procs, dawnDevice* device);
|
||||
}} // namespace backend::null
|
||||
|
||||
namespace utils {
|
||||
@@ -24,14 +24,14 @@ namespace utils {
|
||||
public:
|
||||
void SetupGLFWWindowHints() override {
|
||||
}
|
||||
void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override {
|
||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
||||
backend::null::Init(procs, device);
|
||||
}
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
return 0;
|
||||
}
|
||||
nxtTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return NXT_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "GLFW/glfw3.h"
|
||||
|
||||
namespace backend { namespace opengl {
|
||||
void Init(void* (*getProc)(const char*), nxtProcTable* procs, nxtDevice* device);
|
||||
void Init(void* (*getProc)(const char*), nxtProcTable* procs, dawnDevice* device);
|
||||
}} // namespace backend::opengl
|
||||
|
||||
namespace utils {
|
||||
@@ -53,11 +53,11 @@ namespace utils {
|
||||
mBackTexture, 0);
|
||||
}
|
||||
|
||||
dawnSwapChainError Configure(nxtTextureFormat format,
|
||||
nxtTextureUsageBit,
|
||||
dawnSwapChainError Configure(dawnTextureFormat format,
|
||||
dawnTextureUsageBit,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (format != NXT_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) {
|
||||
if (format != DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) {
|
||||
return "unsupported format";
|
||||
}
|
||||
ASSERT(width > 0);
|
||||
@@ -111,7 +111,7 @@ namespace utils {
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
#endif
|
||||
}
|
||||
void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override {
|
||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
||||
glfwMakeContextCurrent(mWindow);
|
||||
backend::opengl::Init(reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress),
|
||||
procs, device);
|
||||
@@ -126,12 +126,12 @@ namespace utils {
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
nxtTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return NXT_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
}
|
||||
|
||||
private:
|
||||
nxtDevice mBackendDevice = nullptr;
|
||||
dawnDevice mBackendDevice = nullptr;
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
|
||||
namespace backend { namespace vulkan {
|
||||
void Init(nxtProcTable* procs,
|
||||
nxtDevice* device,
|
||||
dawnDevice* device,
|
||||
const std::vector<const char*>& requiredInstanceExtensions);
|
||||
|
||||
VkInstance GetInstance(nxtDevice device);
|
||||
VkInstance GetInstance(dawnDevice device);
|
||||
|
||||
dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, VkSurfaceKHR surface);
|
||||
nxtTextureFormat GetNativeSwapChainPreferredFormat(
|
||||
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, VkSurfaceKHR surface);
|
||||
dawnTextureFormat GetNativeSwapChainPreferredFormat(
|
||||
const dawnSwapChainImplementation* swapChain);
|
||||
}} // namespace backend::vulkan
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace utils {
|
||||
void Init(dawnWSIContextVulkan*) {
|
||||
}
|
||||
|
||||
dawnSwapChainError Configure(nxtTextureFormat, nxtTextureUsageBit, uint32_t, uint32_t) {
|
||||
dawnSwapChainError Configure(dawnTextureFormat, dawnTextureUsageBit, uint32_t, uint32_t) {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace utils {
|
||||
void SetupGLFWWindowHints() override {
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
}
|
||||
void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override {
|
||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
||||
uint32_t extensionCount = 0;
|
||||
const char** glfwInstanceExtensions =
|
||||
glfwGetRequiredInstanceExtensions(&extensionCount);
|
||||
@@ -89,13 +89,13 @@ namespace utils {
|
||||
}
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
nxtTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
ASSERT(mSwapchainImpl.userData != nullptr);
|
||||
return backend::vulkan::GetNativeSwapChainPreferredFormat(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
private:
|
||||
nxtDevice mDevice;
|
||||
dawnDevice mDevice;
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user