Make libdawn_native a shared library.

The interface exposed by libdawn_native is declared in the new headers
living in src/include/dawn_native so that they both the users and the
libraries use the DAWN_NATIVE_EXPORT macros.
This commit is contained in:
Corentin Wallez
2018-07-25 13:37:28 +02:00
committed by Corentin Wallez
parent 36afbb6a0d
commit 196ade667f
21 changed files with 252 additions and 72 deletions

View File

@@ -54,8 +54,7 @@ if (DAWN_ENABLE_VULKAN)
endif()
add_library(utils STATIC ${UTILS_SOURCES})
target_link_libraries(utils libdawn_native shaderc_shared libdawn)
target_include_directories(utils PUBLIC ${SRC_DIR})
target_link_libraries(utils libdawn_native shaderc_shared libdawn glfw)
DawnInternalTarget("" utils)
if(NOT MSVC)
# allow C-style casts -- for shaderc

View File

@@ -15,20 +15,12 @@
#include "utils/BackendBinding.h"
#include "common/Assert.h"
#include "dawn/dawn_wsi.h"
#include "dawn_native/D3D12Backend.h"
#include "GLFW/glfw3.h"
#define GLFW_EXPOSE_NATIVE_WIN32
#include "GLFW/glfw3native.h"
namespace dawn_native { namespace d3d12 {
void Init(dawnProcTable* procs, dawnDevice* device);
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, HWND window);
dawnTextureFormat GetNativeSwapChainPreferredFormat(
const dawnSwapChainImplementation* swapChain);
}} // namespace dawn_native::d3d12
namespace utils {
class D3D12Binding : public BackendBinding {

View File

@@ -16,21 +16,12 @@
#include "common/Assert.h"
#include "common/SwapChainUtils.h"
#include "dawn/dawn_wsi.h"
#include "dawn_native/MetalBackend.h"
#define GLFW_EXPOSE_NATIVE_COCOA
#include "GLFW/glfw3.h"
#include "GLFW/glfw3native.h"
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
namespace dawn_native { namespace metal {
void Init(id<MTLDevice> metalDevice, dawnProcTable* procs, dawnDevice* device);
void SetNextDrawable(dawnDevice device, id<CAMetalDrawable> drawable);
void Present(dawnDevice device);
}}
namespace utils {
class SwapChainImplMTL {
public:

View File

@@ -14,9 +14,7 @@
#include "utils/BackendBinding.h"
namespace dawn_native { namespace null {
void Init(dawnProcTable* procs, dawnDevice* device);
}} // namespace dawn_native::null
#include "dawn_native/NullBackend.h"
namespace utils {

View File

@@ -18,6 +18,7 @@
#include "common/Platform.h"
#include "common/SwapChainUtils.h"
#include "dawn/dawn_wsi.h"
#include "dawn_native/OpenGLBackend.h"
// Glad needs to be included before GLFW otherwise it complain that GL.h was already included
#include "glad/glad.h"
@@ -25,10 +26,6 @@
#include <cstdio>
#include "GLFW/glfw3.h"
namespace dawn_native { namespace opengl {
void Init(void* (*getProc)(const char*), dawnProcTable* procs, dawnDevice* device);
}} // namespace dawn_native::opengl
namespace utils {
class SwapChainImplGL {
public:

View File

@@ -15,27 +15,11 @@
#include "utils/BackendBinding.h"
#include "common/Assert.h"
#include "dawn/dawn_wsi.h"
#include "dawn_native/VulkanBackend.h"
#include <vulkan/vulkan.h>
// Include GLFW after Vulkan so that it declares the Vulkan-specific functions
// Include GLFW after VulkanBackend so that it declares the Vulkan-specific functions
#include "GLFW/glfw3.h"
#include <vector>
namespace dawn_native { namespace vulkan {
void Init(dawnProcTable* procs,
dawnDevice* device,
const std::vector<const char*>& requiredInstanceExtensions);
VkInstance GetInstance(dawnDevice device);
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, VkSurfaceKHR surface);
dawnTextureFormat GetNativeSwapChainPreferredFormat(
const dawnSwapChainImplementation* swapChain);
}} // namespace dawn_native::vulkan
namespace utils {
class SwapChainImplVulkan {