Vulkan: Split off QueueVk

This commit is contained in:
Corentin Wallez 2018-06-18 15:45:06 -04:00 committed by Corentin Wallez
parent b703def640
commit a4cb35cdbc
7 changed files with 85 additions and 29 deletions

View File

@ -293,6 +293,8 @@ if (NXT_ENABLE_VULKAN)
${VULKAN_DIR}/NativeSwapChainImplVk.h
${VULKAN_DIR}/PipelineLayoutVk.cpp
${VULKAN_DIR}/PipelineLayoutVk.h
${VULKAN_DIR}/QueueVk.cpp
${VULKAN_DIR}/QueueVk.h
${VULKAN_DIR}/RenderPassCache.cpp
${VULKAN_DIR}/RenderPassCache.h
${VULKAN_DIR}/RenderPassDescriptorVk.cpp

View File

@ -51,6 +51,8 @@ namespace backend { namespace vulkan {
DeviceMemoryAllocation mMemoryAllocation;
};
using BufferView = BufferViewBase;
class MapRequestTracker {
public:
MapRequestTracker(Device* device);

View File

@ -21,6 +21,7 @@
#include "backend/vulkan/DepthStencilStateVk.h"
#include "backend/vulkan/InputStateVk.h"
#include "backend/vulkan/PipelineLayoutVk.h"
#include "backend/vulkan/QueueVk.h"
#include "backend/vulkan/RenderPassDescriptorVk.h"
#include "backend/vulkan/RenderPipelineVk.h"
#include "backend/vulkan/SamplerVk.h"

View File

@ -0,0 +1,39 @@
// 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.
#include "backend/vulkan/QueueVk.h"
#include "backend/vulkan/CommandBufferVk.h"
#include "backend/vulkan/VulkanBackend.h"
namespace backend { namespace vulkan {
Queue::Queue(Device* device) : QueueBase(device) {
}
Queue::~Queue() {
}
void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) {
Device* device = ToBackend(GetDevice());
VkCommandBuffer commandBuffer = device->GetPendingCommandBuffer();
for (uint32_t i = 0; i < numCommands; ++i) {
commands[i]->RecordCommands(commandBuffer);
}
device->SubmitPendingCommands();
}
}} // namespace backend::vulkan

View File

@ -0,0 +1,36 @@
// 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_QUEUEVK_H_
#define BACKEND_VULKAN_QUEUEVK_H_
#include "backend/Queue.h"
namespace backend { namespace vulkan {
class CommandBuffer;
class Device;
class Queue : public QueueBase {
public:
Queue(Device* device);
~Queue();
// NXT API
void Submit(uint32_t numCommands, CommandBuffer* const* commands);
};
}} // namespace backend::vulkan
#endif // BACKEND_VULKAN_QUEUEVK_H_

View File

@ -27,6 +27,7 @@
#include "backend/vulkan/InputStateVk.h"
#include "backend/vulkan/NativeSwapChainImplVk.h"
#include "backend/vulkan/PipelineLayoutVk.h"
#include "backend/vulkan/QueueVk.h"
#include "backend/vulkan/RenderPassCache.h"
#include "backend/vulkan/RenderPassDescriptorVk.h"
#include "backend/vulkan/RenderPipelineVk.h"
@ -675,23 +676,4 @@ namespace backend { namespace vulkan {
commands->commandBuffer = VK_NULL_HANDLE;
}
// Queue
Queue::Queue(Device* device) : QueueBase(device) {
}
Queue::~Queue() {
}
void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) {
Device* device = ToBackend(GetDevice());
VkCommandBuffer commandBuffer = device->GetPendingCommandBuffer();
for (uint32_t i = 0; i < numCommands; ++i) {
commands[i]->RecordCommands(commandBuffer);
}
device->SubmitPendingCommands();
}
}} // namespace backend::vulkan

View File

@ -18,7 +18,6 @@
#include "nxt/nxtcpp.h"
#include "backend/Device.h"
#include "backend/Queue.h"
#include "backend/ToBackend.h"
#include "backend/vulkan/VulkanFunctions.h"
#include "backend/vulkan/VulkanInfo.h"
@ -28,6 +27,10 @@
#include <queue>
namespace backend {
class BufferViewBase;
}
namespace backend { namespace vulkan {
class BindGroup;
@ -201,15 +204,6 @@ namespace backend { namespace vulkan {
std::vector<VkSemaphore> mWaitSemaphores;
};
class Queue : public QueueBase {
public:
Queue(Device* device);
~Queue();
// NXT API
void Submit(uint32_t numCommands, CommandBuffer* const* commands);
};
}} // namespace backend::vulkan
#endif // BACKEND_VULKAN_VULKANBACKEND_H_