diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-07-20 05:41:05 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-07-20 05:41:05 +0000 |
| commit | 908672f5b447e1e96e0dcbb3ec1eaabbd1d503f4 (patch) | |
| tree | d0ae2d5956d803b7f4ce11195bebed8deecb124a /Graphics/GraphicsEngineVulkan | |
| parent | Added comment about shader reflection data (diff) | |
| download | DiligentCore-908672f5b447e1e96e0dcbb3ec1eaabbd1d503f4.tar.gz DiligentCore-908672f5b447e1e96e0dcbb3ec1eaabbd1d503f4.zip | |
Added fence object stubs + code formatting
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
6 files changed, 181 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt index fc4d36c5..45bc9595 100644 --- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt +++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt @@ -10,6 +10,7 @@ set(INCLUDE include/CommandQueueVkImpl.h include/DescriptorPoolManager.h include/DeviceContextVkImpl.h + include/FenceVkImpl.h include/VulkanDynamicHeap.h include/FramebufferCache.h include/GenerateMipsVkHelper.h @@ -51,6 +52,7 @@ set(INTERFACE interface/BufferViewVk.h interface/CommandQueueVk.h interface/DeviceContextVk.h + interface/FenceVk.h interface/PipelineStateVk.h interface/RenderDeviceVk.h interface/RenderDeviceFactoryVk.h @@ -70,6 +72,7 @@ set(SRC src/CommandQueueVkImpl.cpp src/DescriptorPoolManager.cpp src/DeviceContextVkImpl.cpp + src/FenceVkImpl.cpp src/VulkanDynamicHeap.cpp src/FramebufferCache.cpp src/GenerateMipsVkHelper.cpp diff --git a/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h new file mode 100644 index 00000000..6d1a9267 --- /dev/null +++ b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h @@ -0,0 +1,58 @@ +/* Copyright 2015-2018 Egor Yusov + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +/// \file +/// Declaration of Diligent::FenceVkImpl class + +#include "FenceVk.h" +#include "RenderDeviceVk.h" +#include "FenceBase.h" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Implementation of the Diligent::IFenceVk interface +class FenceVkImpl : public FenceBase<IFenceVk> +{ +public: + using TFenceBase = FenceBase<IFenceVk>; + + FenceVkImpl(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + const FenceDesc& Desc); + ~FenceVkImpl(); + + virtual Uint64 GetCompletedValue()override final; + + /// Resets the fence to the specified value. + virtual void Reset(Uint64 Value)override final; + +private: + +}; + +} diff --git a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h index 1f40ed6a..e2edd52b 100644 --- a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h @@ -80,6 +80,8 @@ public: virtual void CreateSampler(const SamplerDesc& SamplerDesc, ISampler** ppSampler)override final; + virtual void CreateFence(const FenceDesc& Desc, IFence** ppFence)override final; + virtual VkDevice GetVkDevice()override final{ return m_LogicalVkDevice->GetVkDevice();} virtual void CreateTextureFromVulkanImage(VkImage vkImage, const TextureDesc& TexDesc, ITexture** ppTexture)override final; diff --git a/Graphics/GraphicsEngineVulkan/interface/FenceVk.h b/Graphics/GraphicsEngineVulkan/interface/FenceVk.h new file mode 100644 index 00000000..4fa22e51 --- /dev/null +++ b/Graphics/GraphicsEngineVulkan/interface/FenceVk.h @@ -0,0 +1,47 @@ +/* Copyright 2015-2018 Egor Yusov + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +/// \file +/// Definition of the Diligent::IFenceVk interface + +#include "../../GraphicsEngine/interface/Fence.h" + +namespace Diligent +{ + +// {7610B4CD-EDEA-4951-82CF-52F97FAFED2D} +static constexpr INTERFACE_ID IID_FenceVk = +{ 0x7610b4cd, 0xedea, 0x4951, { 0x82, 0xcf, 0x52, 0xf9, 0x7f, 0xaf, 0xed, 0x2d } }; + + +/// Interface to the fence object implemented in GL +class IFenceVk : public IFence +{ +public: + /// Returns OpenGL sync object + //virtual IGLFence* GetGLFence() = 0; +}; + +} diff --git a/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp new file mode 100644 index 00000000..451f70c5 --- /dev/null +++ b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp @@ -0,0 +1,55 @@ +/* Copyright 2015-2018 Egor Yusov + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including neVkigence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly neVkigent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" +#include <atlbase.h> + +#include "FenceVkImpl.h" +#include "EngineMemory.h" + +namespace Diligent +{ + +FenceVkImpl :: FenceVkImpl(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + const FenceDesc& Desc) : + TFenceBase(pRefCounters, pDevice, Desc) +{ +} + +FenceVkImpl :: ~FenceVkImpl() +{ +} + +Uint64 FenceVkImpl :: GetCompletedValue() +{ + UNSUPPORTED("Not yet implemented"); + return 0; +} + +void FenceVkImpl :: Reset(Uint64 Value) +{ + UNSUPPORTED("Not yet implemented"); +} + +} diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 0c278c25..762acebd 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -32,6 +32,7 @@ #include "BufferVkImpl.h" #include "ShaderResourceBindingVkImpl.h" #include "DeviceContextVkImpl.h" +#include "FenceVkImpl.h" #include "EngineMemory.h" namespace Diligent @@ -57,7 +58,8 @@ RenderDeviceVkImpl :: RenderDeviceVkImpl(IReferenceCounters* sizeof(ShaderVkImpl), sizeof(SamplerVkImpl), sizeof(PipelineStateVkImpl), - sizeof(ShaderResourceBindingVkImpl) + sizeof(ShaderResourceBindingVkImpl), + sizeof(FenceVkImpl) }, m_VulkanInstance(Instance), m_PhysicalDevice(std::move(PhysicalDevice)), @@ -551,4 +553,17 @@ void RenderDeviceVkImpl :: CreateSampler(const SamplerDesc& SamplerDesc, ISample ); } +void RenderDeviceVkImpl::CreateFence(const FenceDesc& Desc, IFence** ppFence) +{ + CreateDeviceObject( "Fence", Desc, ppFence, + [&]() + { + FenceVkImpl* pFenceVk( NEW_RC_OBJ(m_FenceAllocator, "FenceVkImpl instance", FenceVkImpl) + (this, Desc) ); + pFenceVk->QueryInterface( IID_Fence, reinterpret_cast<IObject**>(ppFence) ); + OnCreateDeviceObject( pFenceVk ); + } + ); +} + } |
