Vulkan: Split VulkanBackend in Forward.h and DeviceVk

This commit is contained in:
Corentin Wallez 2018-06-18 16:18:50 -04:00 committed by Corentin Wallez
parent a4cb35cdbc
commit 30f7ddbb6b
24 changed files with 104 additions and 79 deletions

View File

@ -281,10 +281,13 @@ if (NXT_ENABLE_VULKAN)
${VULKAN_DIR}/CommandBufferVk.h
${VULKAN_DIR}/ComputePipelineVk.cpp
${VULKAN_DIR}/ComputePipelineVk.h
${VULKAN_DIR}/DeviceVk.cpp
${VULKAN_DIR}/DeviceVk.h
${VULKAN_DIR}/DepthStencilStateVk.cpp
${VULKAN_DIR}/DepthStencilStateVk.h
${VULKAN_DIR}/FencedDeleter.cpp
${VULKAN_DIR}/FencedDeleter.h
${VULKAN_DIR}/Forward.h
${VULKAN_DIR}/InputStateVk.cpp
${VULKAN_DIR}/InputStateVk.h
${VULKAN_DIR}/MemoryAllocator.cpp
@ -309,8 +312,6 @@ if (NXT_ENABLE_VULKAN)
${VULKAN_DIR}/SwapChainVk.h
${VULKAN_DIR}/TextureVk.cpp
${VULKAN_DIR}/TextureVk.h
${VULKAN_DIR}/VulkanBackend.cpp
${VULKAN_DIR}/VulkanBackend.h
${VULKAN_DIR}/VulkanFunctions.cpp
${VULKAN_DIR}/VulkanFunctions.h
${VULKAN_DIR}/VulkanInfo.cpp

View File

@ -14,7 +14,7 @@
#include "backend/vulkan/BindGroupLayoutVk.h"
#include "backend/vulkan/VulkanBackend.h"
#include "backend/vulkan/DeviceVk.h"
#include "common/BitSetIterator.h"
namespace backend { namespace vulkan {

View File

@ -16,10 +16,10 @@
#include "backend/vulkan/BindGroupLayoutVk.h"
#include "backend/vulkan/BufferVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/SamplerVk.h"
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/VulkanBackend.h"
#include "common/BitSetIterator.h"

View File

@ -14,9 +14,9 @@
#include "backend/vulkan/BufferUploader.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/MemoryAllocator.h"
#include "backend/vulkan/VulkanBackend.h"
#include <cstring>

View File

@ -15,8 +15,8 @@
#include "backend/vulkan/BufferVk.h"
#include "backend/vulkan/BufferUploader.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/VulkanBackend.h"
#include <cstring>

View File

@ -18,11 +18,11 @@
#include "backend/vulkan/BindGroupVk.h"
#include "backend/vulkan/BufferVk.h"
#include "backend/vulkan/ComputePipelineVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/PipelineLayoutVk.h"
#include "backend/vulkan/RenderPassDescriptorVk.h"
#include "backend/vulkan/RenderPipelineVk.h"
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {

View File

@ -14,10 +14,10 @@
#include "backend/vulkan/ComputePipelineVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/PipelineLayoutVk.h"
#include "backend/vulkan/ShaderModuleVk.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "backend/vulkan/VulkanBackend.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/Commands.h"
#include "backend/vulkan/BindGroupLayoutVk.h"

View File

@ -1,4 +1,4 @@
// Copyright 2017 The NXT Authors
// Copyright 2018 The NXT Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BACKEND_VULKAN_VULKANBACKEND_H_
#define BACKEND_VULKAN_VULKANBACKEND_H_
#ifndef BACKEND_VULKAN_DEVICEVK_H_
#define BACKEND_VULKAN_DEVICEVK_H_
#include "nxt/nxtcpp.h"
#include "backend/Device.h"
#include "backend/ToBackend.h"
#include "backend/vulkan/Forward.h"
#include "backend/vulkan/VulkanFunctions.h"
#include "backend/vulkan/VulkanInfo.h"
#include "common/DynamicLib.h"
@ -27,65 +27,14 @@
#include <queue>
namespace backend {
class BufferViewBase;
}
namespace backend { namespace vulkan {
class BindGroup;
class BindGroupLayout;
class BlendState;
class Buffer;
using BufferView = BufferViewBase;
class CommandBuffer;
class ComputePipeline;
class DepthStencilState;
class Device;
class InputState;
class PipelineLayout;
class Queue;
class RenderPassDescriptor;
class RenderPipeline;
class Sampler;
class ShaderModule;
class SwapChain;
class Texture;
class TextureView;
class BufferUploader;
class FencedDeleter;
class MapRequestTracker;
class MemoryAllocator;
class RenderPassCache;
struct VulkanBackendTraits {
using BindGroupType = BindGroup;
using BindGroupLayoutType = BindGroupLayout;
using BlendStateType = BlendState;
using BufferType = Buffer;
using BufferViewType = BufferView;
using CommandBufferType = CommandBuffer;
using ComputePipelineType = ComputePipeline;
using DepthStencilStateType = DepthStencilState;
using DeviceType = Device;
using InputStateType = InputState;
using PipelineLayoutType = PipelineLayout;
using QueueType = Queue;
using RenderPassDescriptorType = RenderPassDescriptor;
using RenderPipelineType = RenderPipeline;
using SamplerType = Sampler;
using ShaderModuleType = ShaderModule;
using SwapChainType = SwapChain;
using TextureType = Texture;
using TextureViewType = TextureView;
};
template <typename T>
auto ToBackend(T&& common) -> decltype(ToBackendBase<VulkanBackendTraits>(common)) {
return ToBackendBase<VulkanBackendTraits>(common);
}
class Device : public DeviceBase {
public:
Device(const std::vector<const char*>& requiredInstanceExtensions);
@ -206,4 +155,4 @@ namespace backend { namespace vulkan {
}} // namespace backend::vulkan
#endif // BACKEND_VULKAN_VULKANBACKEND_H_
#endif // BACKEND_VULKAN_DEVICEVK_H_

View File

@ -14,7 +14,7 @@
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/VulkanBackend.h"
#include "backend/vulkan/DeviceVk.h"
namespace backend { namespace vulkan {

View File

@ -0,0 +1,75 @@
// Copyright 2018 The NXT Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BACKEND_VULKAN_FORWARD_H_
#define BACKEND_VULKAN_FORWARD_H_
#include "backend/ToBackend.h"
namespace backend {
class BufferViewBase;
}
namespace backend { namespace vulkan {
class BindGroup;
class BindGroupLayout;
class BlendState;
class Buffer;
using BufferView = BufferViewBase;
class CommandBuffer;
class ComputePipeline;
class DepthStencilState;
class Device;
class InputState;
class PipelineLayout;
class Queue;
class RenderPassDescriptor;
class RenderPipeline;
class Sampler;
class ShaderModule;
class SwapChain;
class Texture;
class TextureView;
struct VulkanBackendTraits {
using BindGroupType = BindGroup;
using BindGroupLayoutType = BindGroupLayout;
using BlendStateType = BlendState;
using BufferType = Buffer;
using BufferViewType = BufferView;
using CommandBufferType = CommandBuffer;
using ComputePipelineType = ComputePipeline;
using DepthStencilStateType = DepthStencilState;
using DeviceType = Device;
using InputStateType = InputState;
using PipelineLayoutType = PipelineLayout;
using QueueType = Queue;
using RenderPassDescriptorType = RenderPassDescriptor;
using RenderPipelineType = RenderPipeline;
using SamplerType = Sampler;
using ShaderModuleType = ShaderModule;
using SwapChainType = SwapChain;
using TextureType = Texture;
using TextureViewType = TextureView;
};
template <typename T>
auto ToBackend(T&& common) -> decltype(ToBackendBase<VulkanBackendTraits>(common)) {
return ToBackendBase<VulkanBackendTraits>(common);
}
}} // namespace backend::vulkan
#endif // BACKEND_VULKAN_FORWARD_H_

View File

@ -19,6 +19,7 @@
#include "backend/vulkan/CommandBufferVk.h"
#include "backend/vulkan/ComputePipelineVk.h"
#include "backend/vulkan/DepthStencilStateVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/InputStateVk.h"
#include "backend/vulkan/PipelineLayoutVk.h"
#include "backend/vulkan/QueueVk.h"
@ -28,4 +29,3 @@
#include "backend/vulkan/ShaderModuleVk.h"
#include "backend/vulkan/SwapChainVk.h"
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/VulkanBackend.h"

View File

@ -14,8 +14,8 @@
#include "backend/vulkan/MemoryAllocator.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {

View File

@ -14,9 +14,9 @@
#include "backend/vulkan/NativeSwapChainImplVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/VulkanBackend.h"
#include <limits>

View File

@ -15,8 +15,8 @@
#include "backend/vulkan/PipelineLayoutVk.h"
#include "backend/vulkan/BindGroupLayoutVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/VulkanBackend.h"
#include "common/BitSetIterator.h"

View File

@ -15,7 +15,7 @@
#include "backend/vulkan/QueueVk.h"
#include "backend/vulkan/CommandBufferVk.h"
#include "backend/vulkan/VulkanBackend.h"
#include "backend/vulkan/DeviceVk.h"
namespace backend { namespace vulkan {

View File

@ -14,8 +14,8 @@
#include "backend/vulkan/RenderPassCache.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/VulkanBackend.h"
#include "common/BitSetIterator.h"
#include "common/HashUtils.h"

View File

@ -14,10 +14,10 @@
#include "backend/vulkan/RenderPassDescriptorVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/RenderPassCache.h"
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/VulkanBackend.h"
#include "common/BitSetIterator.h"
namespace backend { namespace vulkan {

View File

@ -16,13 +16,13 @@
#include "backend/vulkan/BlendStateVk.h"
#include "backend/vulkan/DepthStencilStateVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/InputStateVk.h"
#include "backend/vulkan/PipelineLayoutVk.h"
#include "backend/vulkan/RenderPassCache.h"
#include "backend/vulkan/RenderPassDescriptorVk.h"
#include "backend/vulkan/ShaderModuleVk.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {

View File

@ -14,8 +14,8 @@
#include "backend/vulkan/SamplerVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {

View File

@ -14,8 +14,8 @@
#include "backend/vulkan/ShaderModuleVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/VulkanBackend.h"
#include <spirv-cross/spirv_cross.hpp>

View File

@ -14,8 +14,8 @@
#include "backend/vulkan/SwapChainVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {

View File

@ -14,8 +14,8 @@
#include "backend/vulkan/TextureVk.h"
#include "backend/vulkan/DeviceVk.h"
#include "backend/vulkan/FencedDeleter.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {

View File

@ -14,7 +14,7 @@
#include "backend/vulkan/VulkanInfo.h"
#include "backend/vulkan/VulkanBackend.h"
#include "backend/vulkan/DeviceVk.h"
#include <cstring>