mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Capitalize C types dawn -> Dawn
This is to match Chromium style. Change-Id: Ic97cc03e2291c653ade9662ba3d5e629872b10ad Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5482 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
97ffc1a8aa
commit
45f9730855
@@ -25,22 +25,22 @@
|
||||
namespace utils {
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||
BackendBinding* CreateD3D12Binding(GLFWwindow* window, dawnDevice device);
|
||||
BackendBinding* CreateD3D12Binding(GLFWwindow* window, DawnDevice device);
|
||||
#endif
|
||||
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
BackendBinding* CreateMetalBinding(GLFWwindow* window, dawnDevice device);
|
||||
BackendBinding* CreateMetalBinding(GLFWwindow* window, DawnDevice device);
|
||||
#endif
|
||||
#if defined(DAWN_ENABLE_BACKEND_NULL)
|
||||
BackendBinding* CreateNullBinding(GLFWwindow* window, dawnDevice device);
|
||||
BackendBinding* CreateNullBinding(GLFWwindow* window, DawnDevice device);
|
||||
#endif
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
BackendBinding* CreateOpenGLBinding(GLFWwindow* window, dawnDevice device);
|
||||
BackendBinding* CreateOpenGLBinding(GLFWwindow* window, DawnDevice device);
|
||||
#endif
|
||||
#if defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||
BackendBinding* CreateVulkanBinding(GLFWwindow* window, dawnDevice device);
|
||||
BackendBinding* CreateVulkanBinding(GLFWwindow* window, DawnDevice device);
|
||||
#endif
|
||||
|
||||
BackendBinding::BackendBinding(GLFWwindow* window, dawnDevice device)
|
||||
BackendBinding::BackendBinding(GLFWwindow* window, DawnDevice device)
|
||||
: mWindow(window), mDevice(device) {
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace utils {
|
||||
|
||||
BackendBinding* CreateBinding(dawn_native::BackendType type,
|
||||
GLFWwindow* window,
|
||||
dawnDevice device) {
|
||||
DawnDevice device) {
|
||||
switch (type) {
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||
case dawn_native::BackendType::D3D12:
|
||||
|
||||
@@ -27,13 +27,13 @@ namespace utils {
|
||||
virtual ~BackendBinding() = default;
|
||||
|
||||
virtual uint64_t GetSwapChainImplementation() = 0;
|
||||
virtual dawnTextureFormat GetPreferredSwapChainTextureFormat() = 0;
|
||||
virtual DawnTextureFormat GetPreferredSwapChainTextureFormat() = 0;
|
||||
|
||||
protected:
|
||||
BackendBinding(GLFWwindow* window, dawnDevice device);
|
||||
BackendBinding(GLFWwindow* window, DawnDevice device);
|
||||
|
||||
GLFWwindow* mWindow = nullptr;
|
||||
dawnDevice mDevice = nullptr;
|
||||
DawnDevice mDevice = nullptr;
|
||||
};
|
||||
|
||||
void SetupGLFWWindowHintsForBackend(dawn_native::BackendType type);
|
||||
@@ -42,7 +42,7 @@ namespace utils {
|
||||
dawn_native::BackendType type);
|
||||
BackendBinding* CreateBinding(dawn_native::BackendType type,
|
||||
GLFWwindow* window,
|
||||
dawnDevice device);
|
||||
DawnDevice device);
|
||||
|
||||
} // namespace utils
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace utils {
|
||||
|
||||
class D3D12Binding : public BackendBinding {
|
||||
public:
|
||||
D3D12Binding(GLFWwindow* window, dawnDevice device) : BackendBinding(window, device) {
|
||||
D3D12Binding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) {
|
||||
}
|
||||
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
@@ -39,16 +39,16 @@ namespace utils {
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
ASSERT(mSwapchainImpl.userData != nullptr);
|
||||
return dawn_native::d3d12::GetNativeSwapChainPreferredFormat(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
private:
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
DawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateD3D12Binding(GLFWwindow* window, dawnDevice device) {
|
||||
BackendBinding* CreateD3D12Binding(GLFWwindow* window, DawnDevice device) {
|
||||
return new D3D12Binding(window, device);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
namespace utils {
|
||||
class SwapChainImplMTL {
|
||||
public:
|
||||
using WSIContext = dawnWSIContextMetal;
|
||||
using WSIContext = DawnWSIContextMetal;
|
||||
|
||||
SwapChainImplMTL(id nsWindow) : mNsWindow(nsWindow) {
|
||||
}
|
||||
@@ -37,13 +37,13 @@ namespace utils {
|
||||
[mCurrentDrawable release];
|
||||
}
|
||||
|
||||
void Init(dawnWSIContextMetal* ctx) {
|
||||
void Init(DawnWSIContextMetal* ctx) {
|
||||
mMtlDevice = ctx->device;
|
||||
mCommandQueue = [mMtlDevice newCommandQueue];
|
||||
}
|
||||
|
||||
dawnSwapChainError Configure(dawnTextureFormat format,
|
||||
dawnTextureUsageBit usage,
|
||||
DawnSwapChainError Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit usage,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (format != DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM) {
|
||||
@@ -76,7 +76,7 @@ namespace utils {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
dawnSwapChainError GetNextTexture(dawnSwapChainNextTexture* nextTexture) {
|
||||
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture) {
|
||||
[mCurrentDrawable release];
|
||||
mCurrentDrawable = [mLayer nextDrawable];
|
||||
[mCurrentDrawable retain];
|
||||
@@ -90,7 +90,7 @@ namespace utils {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
dawnSwapChainError Present() {
|
||||
DawnSwapChainError Present() {
|
||||
id<MTLCommandBuffer> commandBuffer = [mCommandQueue commandBuffer];
|
||||
[commandBuffer presentDrawable:mCurrentDrawable];
|
||||
[commandBuffer commit];
|
||||
@@ -110,7 +110,7 @@ namespace utils {
|
||||
|
||||
class MetalBinding : public BackendBinding {
|
||||
public:
|
||||
MetalBinding(GLFWwindow* window, dawnDevice device) : BackendBinding(window, device) {
|
||||
MetalBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) {
|
||||
}
|
||||
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
@@ -121,15 +121,15 @@ namespace utils {
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM;
|
||||
}
|
||||
|
||||
private:
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
DawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateMetalBinding(GLFWwindow* window, dawnDevice device) {
|
||||
BackendBinding* CreateMetalBinding(GLFWwindow* window, DawnDevice device) {
|
||||
return new MetalBinding(window, device);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace utils {
|
||||
|
||||
class NullBinding : public BackendBinding {
|
||||
public:
|
||||
NullBinding(GLFWwindow* window, dawnDevice device) : BackendBinding(window, device) {
|
||||
NullBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) {
|
||||
}
|
||||
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
@@ -32,15 +32,15 @@ namespace utils {
|
||||
}
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
}
|
||||
|
||||
private:
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
DawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateNullBinding(GLFWwindow* window, dawnDevice device) {
|
||||
BackendBinding* CreateNullBinding(GLFWwindow* window, DawnDevice device) {
|
||||
return new NullBinding(window, device);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
namespace utils {
|
||||
class SwapChainImplGL {
|
||||
public:
|
||||
using WSIContext = dawnWSIContextGL;
|
||||
using WSIContext = DawnWSIContextGL;
|
||||
|
||||
SwapChainImplGL(GLFWwindow* window) : mWindow(window) {
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace utils {
|
||||
glDeleteFramebuffers(1, &mBackFBO);
|
||||
}
|
||||
|
||||
void Init(dawnWSIContextGL*) {
|
||||
void Init(DawnWSIContextGL*) {
|
||||
glGenTextures(1, &mBackTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, mBackTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
@@ -50,8 +50,8 @@ namespace utils {
|
||||
mBackTexture, 0);
|
||||
}
|
||||
|
||||
dawnSwapChainError Configure(dawnTextureFormat format,
|
||||
dawnTextureUsageBit,
|
||||
DawnSwapChainError Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (format != DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) {
|
||||
@@ -70,12 +70,12 @@ namespace utils {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
dawnSwapChainError GetNextTexture(dawnSwapChainNextTexture* nextTexture) {
|
||||
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture) {
|
||||
nextTexture->texture.u32 = mBackTexture;
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
dawnSwapChainError Present() {
|
||||
DawnSwapChainError Present() {
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, mBackFBO);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glBlitFramebuffer(0, 0, mWidth, mHeight, 0, mHeight, mWidth, 0, GL_COLOR_BUFFER_BIT,
|
||||
@@ -95,7 +95,7 @@ namespace utils {
|
||||
|
||||
class OpenGLBinding : public BackendBinding {
|
||||
public:
|
||||
OpenGLBinding(GLFWwindow* window, dawnDevice device) : BackendBinding(window, device) {
|
||||
OpenGLBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) {
|
||||
// Load the GL entry points in our copy of the glad static library
|
||||
gladLoadGLLoader(reinterpret_cast<GLADloadproc>(glfwGetProcAddress));
|
||||
}
|
||||
@@ -107,15 +107,15 @@ namespace utils {
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
return DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
}
|
||||
|
||||
private:
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
DawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateOpenGLBinding(GLFWwindow* window, dawnDevice device) {
|
||||
BackendBinding* CreateOpenGLBinding(GLFWwindow* window, DawnDevice device) {
|
||||
return new OpenGLBinding(window, device);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace utils {
|
||||
|
||||
class VulkanBinding : public BackendBinding {
|
||||
public:
|
||||
VulkanBinding(GLFWwindow* window, dawnDevice device) : BackendBinding(window, device) {
|
||||
VulkanBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) {
|
||||
}
|
||||
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
@@ -41,16 +41,16 @@ namespace utils {
|
||||
}
|
||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||
}
|
||||
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||
ASSERT(mSwapchainImpl.userData != nullptr);
|
||||
return dawn_native::vulkan::GetNativeSwapChainPreferredFormat(&mSwapchainImpl);
|
||||
}
|
||||
|
||||
private:
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
DawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateVulkanBinding(GLFWwindow* window, dawnDevice device) {
|
||||
BackendBinding* CreateVulkanBinding(GLFWwindow* window, DawnDevice device) {
|
||||
return new VulkanBinding(window, device);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user