mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
Rename nxt -> dawn for dawn_wsi.h declarations
Also does the initial complete formatting of files in src/include
This commit is contained in:
committed by
Corentin Wallez
parent
3e371b146d
commit
05c90ee4cb
@@ -24,8 +24,9 @@
|
||||
namespace backend { namespace d3d12 {
|
||||
void Init(nxtProcTable* procs, nxtDevice* device);
|
||||
|
||||
nxtSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, HWND window);
|
||||
nxtTextureFormat GetNativeSwapChainPreferredFormat(const nxtSwapChainImplementation* swapChain);
|
||||
dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, HWND window);
|
||||
nxtTextureFormat GetNativeSwapChainPreferredFormat(
|
||||
const dawnSwapChainImplementation* swapChain);
|
||||
}} // namespace backend::d3d12
|
||||
|
||||
namespace utils {
|
||||
@@ -57,7 +58,7 @@ namespace utils {
|
||||
|
||||
private:
|
||||
nxtDevice mBackendDevice = nullptr;
|
||||
nxtSwapChainImplementation mSwapchainImpl = {};
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateD3D12Binding() {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace backend { namespace metal {
|
||||
namespace utils {
|
||||
class SwapChainImplMTL {
|
||||
public:
|
||||
using WSIContext = nxtWSIContextMetal;
|
||||
using WSIContext = dawnWSIContextMetal;
|
||||
|
||||
SwapChainImplMTL(id nsWindow) : mNsWindow(nsWindow) {
|
||||
}
|
||||
@@ -44,15 +44,15 @@ namespace utils {
|
||||
[mCurrentDrawable release];
|
||||
}
|
||||
|
||||
void Init(nxtWSIContextMetal* ctx) {
|
||||
void Init(dawnWSIContextMetal* ctx) {
|
||||
mMtlDevice = ctx->device;
|
||||
mCommandQueue = [mMtlDevice newCommandQueue];
|
||||
}
|
||||
|
||||
nxtSwapChainError Configure(nxtTextureFormat format,
|
||||
nxtTextureUsageBit,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
dawnSwapChainError Configure(nxtTextureFormat format,
|
||||
nxtTextureUsageBit,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (format != NXT_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM) {
|
||||
return "unsupported format";
|
||||
}
|
||||
@@ -74,10 +74,10 @@ namespace utils {
|
||||
|
||||
[contentView setLayer:mLayer];
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
nxtSwapChainError GetNextTexture(nxtSwapChainNextTexture* nextTexture) {
|
||||
dawnSwapChainError GetNextTexture(dawnSwapChainNextTexture* nextTexture) {
|
||||
[mCurrentDrawable release];
|
||||
mCurrentDrawable = [mLayer nextDrawable];
|
||||
[mCurrentDrawable retain];
|
||||
@@ -88,15 +88,15 @@ namespace utils {
|
||||
|
||||
nextTexture->texture.ptr = reinterpret_cast<void*>(mCurrentTexture);
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
nxtSwapChainError Present() {
|
||||
dawnSwapChainError Present() {
|
||||
id<MTLCommandBuffer> commandBuffer = [mCommandQueue commandBuffer];
|
||||
[commandBuffer presentDrawable:mCurrentDrawable];
|
||||
[commandBuffer commit];
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -136,7 +136,7 @@ namespace utils {
|
||||
private:
|
||||
id<MTLDevice> mMetalDevice = nil;
|
||||
nxtDevice mBackendDevice = nullptr;
|
||||
nxtSwapChainImplementation mSwapchainImpl = {};
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateMetalBinding() {
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace backend { namespace opengl {
|
||||
namespace utils {
|
||||
class SwapChainImplGL {
|
||||
public:
|
||||
using WSIContext = nxtWSIContextGL;
|
||||
using WSIContext = dawnWSIContextGL;
|
||||
|
||||
SwapChainImplGL(GLFWwindow* window) : mWindow(window) {
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace utils {
|
||||
glDeleteFramebuffers(1, &mBackFBO);
|
||||
}
|
||||
|
||||
void Init(nxtWSIContextGL*) {
|
||||
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);
|
||||
@@ -53,10 +53,10 @@ namespace utils {
|
||||
mBackTexture, 0);
|
||||
}
|
||||
|
||||
nxtSwapChainError Configure(nxtTextureFormat format,
|
||||
nxtTextureUsageBit,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
dawnSwapChainError Configure(nxtTextureFormat format,
|
||||
nxtTextureUsageBit,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (format != NXT_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) {
|
||||
return "unsupported format";
|
||||
}
|
||||
@@ -70,22 +70,22 @@ namespace utils {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
nullptr);
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
nxtSwapChainError GetNextTexture(nxtSwapChainNextTexture* nextTexture) {
|
||||
dawnSwapChainError GetNextTexture(dawnSwapChainNextTexture* nextTexture) {
|
||||
nextTexture->texture.u32 = mBackTexture;
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
nxtSwapChainError 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,
|
||||
GL_NEAREST);
|
||||
glfwSwapBuffers(mWindow);
|
||||
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -132,7 +132,7 @@ namespace utils {
|
||||
|
||||
private:
|
||||
nxtDevice mBackendDevice = nullptr;
|
||||
nxtSwapChainImplementation mSwapchainImpl = {};
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateOpenGLBinding() {
|
||||
|
||||
@@ -29,15 +29,16 @@ namespace backend { namespace vulkan {
|
||||
|
||||
VkInstance GetInstance(nxtDevice device);
|
||||
|
||||
nxtSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, VkSurfaceKHR surface);
|
||||
nxtTextureFormat GetNativeSwapChainPreferredFormat(const nxtSwapChainImplementation* swapChain);
|
||||
dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, VkSurfaceKHR surface);
|
||||
nxtTextureFormat GetNativeSwapChainPreferredFormat(
|
||||
const dawnSwapChainImplementation* swapChain);
|
||||
}} // namespace backend::vulkan
|
||||
|
||||
namespace utils {
|
||||
|
||||
class SwapChainImplVulkan {
|
||||
public:
|
||||
using WSIContext = nxtWSIContextVulkan;
|
||||
using WSIContext = dawnWSIContextVulkan;
|
||||
|
||||
SwapChainImplVulkan(GLFWwindow* /*window*/) {
|
||||
}
|
||||
@@ -45,19 +46,19 @@ namespace utils {
|
||||
~SwapChainImplVulkan() {
|
||||
}
|
||||
|
||||
void Init(nxtWSIContextVulkan*) {
|
||||
void Init(dawnWSIContextVulkan*) {
|
||||
}
|
||||
|
||||
nxtSwapChainError Configure(nxtTextureFormat, nxtTextureUsageBit, uint32_t, uint32_t) {
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
dawnSwapChainError Configure(nxtTextureFormat, nxtTextureUsageBit, uint32_t, uint32_t) {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
nxtSwapChainError GetNextTexture(nxtSwapChainNextTexture*) {
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
dawnSwapChainError GetNextTexture(dawnSwapChainNextTexture*) {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
|
||||
nxtSwapChainError Present() {
|
||||
return NXT_SWAP_CHAIN_NO_ERROR;
|
||||
dawnSwapChainError Present() {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,7 +96,7 @@ namespace utils {
|
||||
|
||||
private:
|
||||
nxtDevice mDevice;
|
||||
nxtSwapChainImplementation mSwapchainImpl = {};
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateVulkanBinding() {
|
||||
|
||||
Reference in New Issue
Block a user