From bab732ae4e4d881131d3fa3177ac762055c09fe7 Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 24 Sep 2020 12:47:23 -0700 Subject: Removed implementation of Metal backend --- Graphics/GraphicsEngineMetal/CMakeLists.txt | 149 ------ .../GraphicsEngineMetal/include/BufferMtlImpl.h | 75 --- .../include/BufferViewMtlImpl.h | 56 --- .../include/CommandListMtlImpl.h | 52 -- .../include/DeviceContextMtlImpl.h | 193 ------- .../GraphicsEngineMetal/include/FenceMtlImpl.h | 61 --- .../include/FramebufferMtlImpl.h | 54 -- .../include/MtlTypeConversions.h | 34 -- .../include/PipelineStateMtlImpl.h | 84 ---- .../GraphicsEngineMetal/include/QueryMtlImpl.h | 58 --- .../include/RenderDeviceMtlImpl.h | 81 --- .../include/RenderPassMtlImpl.h | 54 -- .../GraphicsEngineMetal/include/SamplerMtlImpl.h | 54 -- .../GraphicsEngineMetal/include/ShaderMtlImpl.h | 66 --- .../include/ShaderResourceBindingMtlImpl.h | 64 --- .../GraphicsEngineMetal/include/SwapChainMtlImpl.h | 63 --- .../GraphicsEngineMetal/include/TextureMtlImpl.h | 66 --- .../include/TextureViewMtlImpl.h | 58 --- Graphics/GraphicsEngineMetal/src/BufferMtlImpl.mm | 87 ---- .../GraphicsEngineMetal/src/BufferViewMtlImpl.mm | 42 -- .../GraphicsEngineMetal/src/CommandListMtlImpl.mm | 41 -- .../src/DeviceContextMtlImpl.mm | 557 --------------------- .../GraphicsEngineMetal/src/EngineFactoryMtl.mm | 221 -------- Graphics/GraphicsEngineMetal/src/FenceMtlImpl.mm | 52 -- .../GraphicsEngineMetal/src/FramebufferMtlImpl.mm | 41 -- .../GraphicsEngineMetal/src/MtlTypeConversions.mm | 29 -- .../src/PipelineStateMtlImpl.mm | 79 --- Graphics/GraphicsEngineMetal/src/QueryMtlImpl.mm | 46 -- .../GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm | 222 -------- .../GraphicsEngineMetal/src/RenderPassMtlImpl.mm | 41 -- Graphics/GraphicsEngineMetal/src/SamplerMtlImpl.mm | 46 -- Graphics/GraphicsEngineMetal/src/ShaderMtlImpl.mm | 45 -- .../src/ShaderResourceBindingMtlImpl.mm | 76 --- .../GraphicsEngineMetal/src/SwapChainMtlImpl.mm | 83 --- Graphics/GraphicsEngineMetal/src/TextureMtlImpl.mm | 73 --- .../GraphicsEngineMetal/src/TextureViewMtlImpl.mm | 43 -- 36 files changed, 3146 deletions(-) delete mode 100644 Graphics/GraphicsEngineMetal/CMakeLists.txt delete mode 100644 Graphics/GraphicsEngineMetal/include/BufferMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/BufferViewMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/CommandListMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/FenceMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/MtlTypeConversions.h delete mode 100644 Graphics/GraphicsEngineMetal/include/PipelineStateMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/QueryMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/RenderPassMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/SamplerMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/ShaderMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/ShaderResourceBindingMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/TextureMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/include/TextureViewMtlImpl.h delete mode 100644 Graphics/GraphicsEngineMetal/src/BufferMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/BufferViewMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/CommandListMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/FenceMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/MtlTypeConversions.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/PipelineStateMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/QueryMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/RenderPassMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/SamplerMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/ShaderMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/ShaderResourceBindingMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/TextureMtlImpl.mm delete mode 100644 Graphics/GraphicsEngineMetal/src/TextureViewMtlImpl.mm (limited to 'Graphics/GraphicsEngineMetal') diff --git a/Graphics/GraphicsEngineMetal/CMakeLists.txt b/Graphics/GraphicsEngineMetal/CMakeLists.txt deleted file mode 100644 index 20c5db50..00000000 --- a/Graphics/GraphicsEngineMetal/CMakeLists.txt +++ /dev/null @@ -1,149 +0,0 @@ -cmake_minimum_required (VERSION 3.10) - -project(Diligent-GraphicsEngineMetal CXX) - - -set(INCLUDE - include/BufferMtlImpl.h - include/BufferViewMtlImpl.h - include/CommandListMtlImpl.h - include/MtlTypeConversions.h - include/DeviceContextMtlImpl.h - include/FenceMtlImpl.h - include/FramebufferMtlImpl.h - include/PipelineStateMtlImpl.h - include/QueryMtlImpl.h - include/RenderDeviceMtlImpl.h - include/RenderPassMtlImpl.h - include/SamplerMtlImpl.h - include/ShaderMtlImpl.h - include/ShaderResourceBindingMtlImpl.h - include/SwapChainMtlImpl.h - include/TextureMtlImpl.h - include/TextureViewMtlImpl.h -) - -set(INTERFACE - interface/BufferMtl.h - interface/BufferViewMtl.h - interface/DeviceContextMtl.h - interface/EngineFactoryMtl.h - interface/FenceMtl.h - interface/PipelineStateMtl.h - interface/QueryMtl.h - interface/RenderDeviceMtl.h - interface/SamplerMtl.h - interface/ShaderMtl.h - interface/ShaderResourceBindingMtl.h - interface/SwapChainMtl.h - interface/TextureMtl.h - interface/TextureViewMtl.h -) - - -set(SRC - src/BufferMtlImpl.mm - src/BufferViewMtlImpl.mm - src/CommandListMtlImpl.mm - src/MtlTypeConversions.mm - src/DeviceContextMtlImpl.mm - src/EngineFactoryMtl.mm - src/FenceMtlImpl.mm - src/FramebufferMtlImpl.mm - src/PipelineStateMtlImpl.mm - src/QueryMtlImpl.mm - src/RenderDeviceMtlImpl.mm - src/RenderPassMtlImpl.mm - src/SamplerMtlImpl.mm - src/ShaderMtlImpl.mm - src/ShaderResourceBindingMtlImpl.mm - src/SwapChainMtlImpl.mm - src/TextureMtlImpl.mm - src/TextureViewMtlImpl.mm -) - -add_library(Diligent-GraphicsEngineMetalInterface INTERFACE) -target_include_directories(Diligent-GraphicsEngineMetalInterface -INTERFACE - interface -) -target_link_libraries(Diligent-GraphicsEngineMetalInterface -INTERFACE - Diligent-GraphicsEngineInterface -) - - -add_library(Diligent-GraphicsEngineMetal-static STATIC - ${SRC} ${INTERFACE} ${INCLUDE} - readme.md -) - -add_library(Diligent-GraphicsEngineMetal-shared SHARED - readme.md -) - -set_target_properties(Diligent-GraphicsEngineMetal-shared PROPERTIES - OUTPUT_NAME GraphicsEngineMetal -) - -set_common_target_properties(Diligent-GraphicsEngineMetal-shared) -set_common_target_properties(Diligent-GraphicsEngineMetal-static) - -target_include_directories(Diligent-GraphicsEngineMetal-static -PRIVATE - include -) - -find_library(METAL_FRAMEWORK Metal) -if (NOT METAL_FRAMEWORK) - message(FATAL_ERROR "Metal framework is not found") -endif() - -target_link_libraries(Diligent-GraphicsEngineMetal-static -PRIVATE - Diligent-BuildSettings - Diligent-TargetPlatform - Diligent-Common - Diligent-GraphicsEngine - ${METAL_FRAMEWORK} -PUBLIC - Diligent-GraphicsEngineMetalInterface -) - -target_link_libraries(Diligent-GraphicsEngineMetal-shared PUBLIC Diligent-GraphicsEngineMetal-static) -target_compile_definitions(Diligent-GraphicsEngineMetal-shared PUBLIC ENGINE_DLL=1) - - -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR - CMAKE_CXX_COMPILER_ID MATCHES "GNU") - set_target_properties(Diligent-GraphicsEngineMetal-shared PROPERTIES CXX_VISIBILITY_PRESET hidden) # -fvisibility=hidden -endif() - -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # Disable the following clang warning - # '' hides overloaded virtual function - # as hiding is intended - target_compile_options(Diligent-GraphicsEngineMetal-static PRIVATE -Wno-overloaded-virtual) - target_compile_options(Diligent-GraphicsEngineMetal-shared PRIVATE -Wno-overloaded-virtual) -endif() - - -source_group("src" FILES ${SRC} ) -source_group("include" FILES ${INCLUDE}) -source_group("interface" FILES ${INTERFACE}) - -set_target_properties(Diligent-GraphicsEngineMetal-static PROPERTIES - FOLDER DiligentCore/Graphics -) -set_target_properties(Diligent-GraphicsEngineMetal-shared PROPERTIES - FOLDER DiligentCore/Graphics -) - -set_source_files_properties( - readme.md PROPERTIES HEADER_FILE_ONLY TRUE -) - -if(DILIGENT_INSTALL_CORE) - install_core_lib(Diligent-GraphicsEngineMetal-shared) - install_core_lib(Diligent-GraphicsEngineMetal-static) -endif() diff --git a/Graphics/GraphicsEngineMetal/include/BufferMtlImpl.h b/Graphics/GraphicsEngineMetal/include/BufferMtlImpl.h deleted file mode 100644 index c3d49edf..00000000 --- a/Graphics/GraphicsEngineMetal/include/BufferMtlImpl.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2015-2019 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::BufferMtlImpl class - -#include "BufferMtl.h" -#include "RenderDeviceMtl.h" -#include "BufferBase.hpp" -#include "BufferViewMtlImpl.h" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Implementation of the Diligent::IBufferMtl interface -class BufferMtlImpl final : public BufferBase -{ -public: - using TBufferBase = BufferBase; - - BufferMtlImpl(IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& BuffViewObjMemAllocator, - class RenderDeviceMtlImpl* pDeviceMtl, - const BufferDesc& BuffDesc, - const BufferData* pBuffData = nullptr); - - BufferMtlImpl(IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& BuffViewObjMemAllocator, - class RenderDeviceMtlImpl* pDeviceMtl, - const BufferDesc& BuffDesc, - RESOURCE_STATE InitialState, - void* pMetalBuffer); - - ~BufferMtlImpl(); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual void* GetNativeHandle() override final - { - LOG_ERROR_MESSAGE("BufferMtlImpl::GetNativeHandle() is not implemented"); - return nullptr; - } - -private: - friend class DeviceContextMtlImpl; - - virtual void CreateViewInternal(const struct BufferViewDesc& ViewDesc, IBufferView** ppView, bool bIsDefaultView) override; -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/BufferViewMtlImpl.h b/Graphics/GraphicsEngineMetal/include/BufferViewMtlImpl.h deleted file mode 100644 index e68fcc3f..00000000 --- a/Graphics/GraphicsEngineMetal/include/BufferViewMtlImpl.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2015-2019 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::BufferViewMtlImpl class - -#include "BufferViewMtl.h" -#include "RenderDeviceMtl.h" -#include "BufferViewBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; -/// Implementation of the Diligent::IBufferViewMtl interface -class BufferViewMtlImpl final : public BufferViewBase -{ -public: - using TBufferViewBase = BufferViewBase; - - BufferViewMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const BufferViewDesc& ViewDesc, - IBuffer* pBuffer, - void* pMtlView, - bool bIsDefaultView); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) final; - -protected: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/CommandListMtlImpl.h b/Graphics/GraphicsEngineMetal/include/CommandListMtlImpl.h deleted file mode 100644 index ec740917..00000000 --- a/Graphics/GraphicsEngineMetal/include/CommandListMtlImpl.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2015-2019 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::CommandListMtlImpl class - -#include "RenderDeviceMtl.h" -#include "CommandListBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Implementation of the Diligent::ICommandListMtl interface -class CommandListMtlImpl final : public CommandListBase -{ -public: - using TCommandListBase = CommandListBase; - - CommandListMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - void* pMtlCommandList); - ~CommandListMtlImpl(); - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h b/Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h deleted file mode 100644 index eaeaa0f0..00000000 --- a/Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h +++ /dev/null @@ -1,193 +0,0 @@ -/* Copyright 2015-2019 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::DeviceContextMtlImpl class - -#include "DeviceContextMtl.h" -#include "DeviceContextBase.hpp" -#include "ShaderMtlImpl.h" -#include "BufferMtlImpl.h" -#include "TextureMtlImpl.h" -#include "PipelineStateMtlImpl.h" -#include "QueryMtlImpl.h" -#include "FramebufferMtlImpl.h" -#include "RenderPassMtlImpl.h" - -namespace Diligent -{ - -class RenderDeviceMtlImpl; - -struct DeviceContextMtlImplTraits -{ - using BufferType = BufferMtlImpl; - using TextureType = TextureMtlImpl; - using PipelineStateType = PipelineStateMtlImpl; - using DeviceType = RenderDeviceMtlImpl; - using QueryType = QueryMtlImpl; - using FramebufferType = FramebufferMtlImpl; - using RenderPassType = RenderPassMtlImpl; -}; - -/// Implementation of the Diligent::IDeviceContextMtl interface -class DeviceContextMtlImpl final : public DeviceContextBase -{ -public: - using TDeviceContextBase = DeviceContextBase; - - DeviceContextMtlImpl(IReferenceCounters* pRefCounters, - IMemoryAllocator& Allocator, - RenderDeviceMtlImpl* pDevice, - const struct EngineMtlCreateInfo& EngineAttribs, - bool bIsDeferred); - - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual void SetPipelineState(IPipelineState* pPipelineState) override final; - - virtual void TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) override final; - - virtual void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; - - virtual void SetStencilRef(Uint32 StencilRef) override final; - - virtual void SetBlendFactors(const float* pBlendFactors = nullptr) override final; - - virtual void SetVertexBuffers(Uint32 StartSlot, - Uint32 NumBuffersSet, - IBuffer** ppBuffers, - Uint32* pOffsets, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, - SET_VERTEX_BUFFERS_FLAGS Flags) override final; - - virtual void InvalidateState() override final; - - virtual void SetIndexBuffer(IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; - - virtual void SetViewports(Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight) override final; - - virtual void SetScissorRects(Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight) override final; - - virtual void SetRenderTargets(Uint32 NumRenderTargets, - ITextureView* ppRenderTargets[], - ITextureView* pDepthStencil, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; - - virtual void BeginRenderPass(const BeginRenderPassAttribs& Attribs) override final; - - virtual void NextSubpass() override final; - - virtual void EndRenderPass() override final; - - virtual void Draw(const DrawAttribs& Attribs) override final; - virtual void DrawIndexed(const DrawIndexedAttribs& Attribs) override final; - virtual void DrawIndirect(const DrawIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final; - virtual void DrawIndexedIndirect(const DrawIndexedIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final; - virtual void DrawMesh(const DrawMeshAttribs& Attribs) override final; - virtual void DrawMeshIndirect(const DrawMeshIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final; - - virtual void DispatchCompute(const DispatchComputeAttribs& Attribs) override final; - virtual void DispatchComputeIndirect(const DispatchComputeIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final; - - virtual void ClearDepthStencil(ITextureView* pView, - CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, - float fDepth, - Uint8 Stencil, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; - - virtual void ClearRenderTarget(ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; - - virtual void UpdateBuffer(IBuffer* pBuffer, - Uint32 Offset, - Uint32 Size, - const void* pData, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; - - virtual void CopyBuffer(IBuffer* pSrcBuffer, - Uint32 SrcOffset, - RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, - IBuffer* pDstBuffer, - Uint32 DstOffset, - Uint32 Size, - RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode) override final; - - virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) override final; - - virtual void UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) override final; - - virtual void UpdateTexture(ITexture* pTexture, - Uint32 MipLevel, - Uint32 Slice, - const Box& DstBox, - const TextureSubResData& SubresData, - RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; - - virtual void CopyTexture(const CopyTextureAttribs& CopyAttribs) override final; - - virtual void MapTextureSubresource(ITexture* pTexture, - Uint32 MipLevel, - Uint32 ArraySlice, - MAP_TYPE MapType, - MAP_FLAGS MapFlags, - const Box* pMapRegion, - MappedTextureSubresource& MappedData) override final; - - - virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) override final; - - virtual void GenerateMips(ITextureView* pTextureView) override final; - - virtual void FinishFrame() override final; - - virtual void TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) override final; - - virtual void ResolveTextureSubresource(ITexture* pSrcTexture, - ITexture* pDstTexture, - const ResolveTextureSubresourceAttribs& ResolveAttribs) override final; - - void FinishCommandList(class ICommandList** ppCommandList) override final; - - virtual void ExecuteCommandList(class ICommandList* pCommandList) override final; - - virtual void SignalFence(IFence* pFence, Uint64 Value) override final; - - virtual void WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext) override final; - - virtual void WaitForIdle() override final; - - /// Implementation of IDeviceContext::BeginQuery() in Metal backend. - virtual void BeginQuery(IQuery* pQuery) override final; - - /// Implementation of IDeviceContext::EndQuery() in Metal backend. - virtual void EndQuery(IQuery* pQuery) override final; - - virtual void Flush() override final; - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/FenceMtlImpl.h b/Graphics/GraphicsEngineMetal/include/FenceMtlImpl.h deleted file mode 100644 index f6ee76aa..00000000 --- a/Graphics/GraphicsEngineMetal/include/FenceMtlImpl.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2015-2019 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::FenceMtlImpl class - -#include -#include "FenceMtl.h" -#include "RenderDeviceMtl.h" -#include "FenceBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Implementation of the Diligent::IFenceMtl interface -class FenceMtlImpl final : public FenceBase -{ -public: - using TFenceBase = FenceBase; - - FenceMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const FenceDesc& Desc); - ~FenceMtlImpl(); - - IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_FenceMtl, TFenceBase); - - virtual Uint64 GetCompletedValue() override final; - - /// Resets the fence to the specified value. - virtual void Reset(Uint64 Value) override final; - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h b/Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h deleted file mode 100644 index 33c03a41..00000000 --- a/Graphics/GraphicsEngineMetal/include/FramebufferMtlImpl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 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 - * - * 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. - * - * 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::FramebufferMtlImpl class - -#include "RenderDeviceMtl.h" -#include "FramebufferBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Render pass implementation in Direct3D11 backend. -class FramebufferMtlImpl final : public FramebufferBase -{ -public: - using TFramebufferBase = FramebufferBase; - - FramebufferMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const FramebufferDesc& Desc); - ~FramebufferMtlImpl(); -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/MtlTypeConversions.h b/Graphics/GraphicsEngineMetal/include/MtlTypeConversions.h deleted file mode 100644 index 8ac5e325..00000000 --- a/Graphics/GraphicsEngineMetal/include/MtlTypeConversions.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright 2015-2019 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 -/// Type conversion routines - -#include "GraphicsTypes.h" - -namespace Diligent -{ - -} diff --git a/Graphics/GraphicsEngineMetal/include/PipelineStateMtlImpl.h b/Graphics/GraphicsEngineMetal/include/PipelineStateMtlImpl.h deleted file mode 100644 index d6623102..00000000 --- a/Graphics/GraphicsEngineMetal/include/PipelineStateMtlImpl.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2015-2019 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::PipelineStateMtlImpl class - -#include "PipelineStateMtl.h" -#include "RenderDeviceMtl.h" -#include "PipelineStateBase.hpp" -#include "ShaderMtlImpl.h" -#include "SRBMemoryAllocator.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; -/// Implementation of the Diligent::IPipelineStateMtl interface -class PipelineStateMtlImpl final : public PipelineStateBase -{ -public: - using TPipelineStateBase = PipelineStateBase; - - PipelineStateMtlImpl(IReferenceCounters* pRefCounters, - class RenderDeviceMtlImpl* pDeviceMtl, - const PipelineStateCreateInfo& CreateInfo); - ~PipelineStateMtlImpl(); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual void CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources) override final; - - virtual bool IsCompatibleWith(const IPipelineState* pPSO) const override final; - - virtual void BindStaticResources(Uint32 ShaderFlags, IResourceMapping* pResourceMapping, Uint32 Flags) override final - { - LOG_ERROR_MESSAGE("PipelineStateMtlImpl::BindStaticResources() is not implemented"); - } - - virtual Uint32 GetStaticVariableCount(SHADER_TYPE ShaderType) const override final - { - LOG_ERROR_MESSAGE("PipelineStateMtlImpl::GetStaticVariableCount() is not implemented"); - return 0; - } - - virtual IShaderResourceVariable* GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name) override final - { - LOG_ERROR_MESSAGE("PipelineStateMtlImpl::GetStaticShaderVariable() is not implemented"); - return nullptr; - } - - virtual IShaderResourceVariable* GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) override final - { - LOG_ERROR_MESSAGE("PipelineStateMtlImpl::GetStaticShaderVariable() is not implemented"); - return nullptr; - } - - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/QueryMtlImpl.h b/Graphics/GraphicsEngineMetal/include/QueryMtlImpl.h deleted file mode 100644 index b2d03c5a..00000000 --- a/Graphics/GraphicsEngineMetal/include/QueryMtlImpl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2015-2019 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::QueryMtlImpl class - -#include -#include "QueryMtl.h" -#include "RenderDeviceMtl.h" -#include "QueryBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Implementation of the Diligent::IQueryMtl interface -class QueryMtlImpl final : public QueryBase -{ -public: - using TQueryBase = QueryBase; - - QueryMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const QueryDesc& Desc); - ~QueryMtlImpl(); - - IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_QueryMtl, TQueryBase); - - virtual bool GetData(void* pData, Uint32 DataSize, bool AutoInvalidate) override final; - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h b/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h deleted file mode 100644 index 5080ea59..00000000 --- a/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2015-2019 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::RenderDeviceMtlImpl class - -#include "RenderDeviceMtl.h" -#include "RenderDeviceBase.hpp" -#include "DeviceContextMtl.h" - -namespace Diligent -{ - -/// Implementation of the Diligent::IRenderDeviceMtl interface -class RenderDeviceMtlImpl final : public RenderDeviceBase -{ -public: - using TRenderDeviceBase = RenderDeviceBase; - - RenderDeviceMtlImpl(IReferenceCounters* pRefCounters, - IMemoryAllocator& RawMemAllocator, - IEngineFactory* pEngineFactory, - const EngineMtlCreateInfo& EngineAttribs, - void* pMtlDevice); - - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual void CreateBuffer(const BufferDesc& BuffDesc, const BufferData* pBuffData, IBuffer** ppBuffer) override final; - - virtual void CreateShader(const ShaderCreateInfo& ShaderCI, IShader** ppShader) override final; - - virtual void CreateTexture(const TextureDesc& TexDesc, const TextureData* pData, ITexture** ppTexture) override final; - - virtual void CreateSampler(const SamplerDesc& SamplerDesc, ISampler** ppSampler) override final; - - virtual void CreatePipelineState(const PipelineStateCreateInfo& PSOCreateInfo, IPipelineState** ppPipelineState) override final; - - virtual void CreateFence(const FenceDesc& Desc, IFence** ppFence) override final; - - virtual void CreateQuery(const QueryDesc& Desc, IQuery** ppQuery) override final; - - virtual void CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) override final; - - virtual void CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer) override final; - - virtual void ReleaseStaleResources(bool ForceRelease = false) override final {} - - virtual void IdleGPU() override final; - - size_t GetCommandQueueCount() const { return 1; } - Uint64 GetCommandQueueMask() const { return Uint64{1}; } - -private: - virtual void TestTextureFormat(TEXTURE_FORMAT TexFormat) override final; - - EngineMtlCreateInfo m_EngineAttribs; -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/RenderPassMtlImpl.h b/Graphics/GraphicsEngineMetal/include/RenderPassMtlImpl.h deleted file mode 100644 index eeffde9e..00000000 --- a/Graphics/GraphicsEngineMetal/include/RenderPassMtlImpl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 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 - * - * 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. - * - * 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::RenderPassMtlImpl class - -#include "RenderDeviceMtl.h" -#include "RenderPassBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Render pass implementation in Direct3D11 backend. -class RenderPassMtlImpl final : public RenderPassBase -{ -public: - using TRenderPassBase = RenderPassBase; - - RenderPassMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const RenderPassDesc& Desc); - ~RenderPassMtlImpl(); -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/SamplerMtlImpl.h b/Graphics/GraphicsEngineMetal/include/SamplerMtlImpl.h deleted file mode 100644 index 8a714112..00000000 --- a/Graphics/GraphicsEngineMetal/include/SamplerMtlImpl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2015-2019 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::SamplerMtlImpl class - -#include "SamplerMtl.h" -#include "RenderDeviceMtl.h" -#include "SamplerBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; -/// Implementation of the Diligent::ISamplerMtl interface -class SamplerMtlImpl final : public SamplerBase -{ -public: - using TSamplerBase = SamplerBase; - - SamplerMtlImpl(IReferenceCounters* pRefCounters, - class RenderDeviceMtlImpl* pRenderDeviceMtl, - const SamplerDesc& SamplerDesc); - ~SamplerMtlImpl(); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) final; - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/ShaderMtlImpl.h b/Graphics/GraphicsEngineMetal/include/ShaderMtlImpl.h deleted file mode 100644 index 3623d6cc..00000000 --- a/Graphics/GraphicsEngineMetal/include/ShaderMtlImpl.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2015-2019 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::ShaderMtlImpl class - -#include "ShaderMtl.h" -#include "RenderDeviceMtl.h" -#include "ShaderBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - - -/// Implementation of the Diligent::IShaderMtl interface -class ShaderMtlImpl final : public ShaderBase -{ -public: - using TShaderBase = ShaderBase; - - ShaderMtlImpl(IReferenceCounters* pRefCounters, - class RenderDeviceMtlImpl* pRenderDeviceMtl, - const ShaderCreateInfo& ShaderCI); - ~ShaderMtlImpl(); - - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual Uint32 GetResourceCount() const override final - { - LOG_ERROR_MESSAGE("ShaderMtlImpl::GetResourceCount() is not implemented"); - return 0; - } - - virtual void GetResourceDesc(Uint32 Index, ShaderResourceDesc& ResourceDesc) const override final - { - LOG_ERROR_MESSAGE("ShaderMtlImpl::GetResource() is not implemented"); - ResourceDesc = ShaderResourceDesc{}; - } - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/ShaderResourceBindingMtlImpl.h b/Graphics/GraphicsEngineMetal/include/ShaderResourceBindingMtlImpl.h deleted file mode 100644 index 70b2cfde..00000000 --- a/Graphics/GraphicsEngineMetal/include/ShaderResourceBindingMtlImpl.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2015-2019 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::ShaderResourceBindingMtlImpl class - -#include "ShaderResourceBindingMtl.h" -#include "RenderDeviceMtl.h" -#include "ShaderResourceBindingBase.hpp" -#include "STDAllocator.hpp" - -namespace Diligent -{ - -class PipelineStateMtlImpl; -/// Implementation of the Diligent::IShaderResourceBindingMtl interface -class ShaderResourceBindingMtlImpl final : public ShaderResourceBindingBase -{ -public: - using TBase = ShaderResourceBindingBase; - - ShaderResourceBindingMtlImpl(IReferenceCounters* pRefCounters, - PipelineStateMtlImpl* pPSO, - bool IsInternal); - ~ShaderResourceBindingMtlImpl(); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual void BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags) override final; - - virtual IShaderResourceVariable* GetVariableByName(SHADER_TYPE ShaderType, const char* Name) override final; - - virtual Uint32 GetVariableCount(SHADER_TYPE ShaderType) const override final; - - virtual IShaderResourceVariable* GetVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) override final; - - virtual void InitializeStaticResources(const IPipelineState* pPipelineState) override final; - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h b/Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h deleted file mode 100644 index 0cadd44b..00000000 --- a/Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2015-2019 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::SwapChainMtlImpl class - -#include "SwapChainMtl.h" -#include "SwapChainBase.hpp" - -namespace Diligent -{ - -/// Implementation of the Diligent::ISwapChainMtl interface -class SwapChainMtlImpl final : public SwapChainBase -{ -public: - using TSwapChainBase = SwapChainBase; - - SwapChainMtlImpl(IReferenceCounters* pRefCounters, - const SwapChainDesc& SCDesc, - class RenderDeviceMtlImpl* pRenderDeviceMtl, - class DeviceContextMtlImpl* pDeviceContextMtl, - const NativeWindow& Window); - ~SwapChainMtlImpl(); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual void Present(Uint32 SyncInterval) override final; - virtual void Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform) override final; - - virtual void SetFullscreenMode(const DisplayModeAttribs& DisplayMode) override final; - - virtual void SetWindowedMode() override final; - - virtual ITextureView* GetCurrentBackBufferRTV() override final; - virtual ITextureView* GetDepthBufferDSV() override final; - -private: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/TextureMtlImpl.h b/Graphics/GraphicsEngineMetal/include/TextureMtlImpl.h deleted file mode 100644 index 292be2af..00000000 --- a/Graphics/GraphicsEngineMetal/include/TextureMtlImpl.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2015-2019 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::TextureMtlImpl class - -#include "TextureMtl.h" -#include "RenderDeviceMtl.h" -#include "TextureBase.hpp" -#include "TextureViewMtlImpl.h" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Base implementation of the Diligent::ITextureMtl interface -class TextureMtlImpl : public TextureBase -{ -public: - using TTextureBase = TextureBase; - using ViewImplType = TextureViewMtlImpl; - - TextureMtlImpl(IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& TexViewObjAllocator, - class RenderDeviceMtlImpl* pDeviceMtl, - const TextureDesc& TexDesc, - const TextureData* pInitData = nullptr); - ~TextureMtlImpl(); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) override final; - - virtual void* GetNativeHandle() override final - { - LOG_ERROR_MESSAGE("TextureMtlImpl::GetNativeHandle() is not implemented"); - return nullptr; - } - -protected: - void CreateViewInternal(const struct TextureViewDesc& ViewDesc, ITextureView** ppView, bool bIsDefaultView) override final; -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/include/TextureViewMtlImpl.h b/Graphics/GraphicsEngineMetal/include/TextureViewMtlImpl.h deleted file mode 100644 index bdb04af6..00000000 --- a/Graphics/GraphicsEngineMetal/include/TextureViewMtlImpl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2015-2019 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::TextureViewMtlImpl class - -#include "TextureViewMtl.h" -#include "RenderDeviceMtl.h" -#include "TextureViewBase.hpp" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - -class FixedBlockMemoryAllocator; - -/// Implementation of the Diligent::ITextureViewMtl interface -class TextureViewMtlImpl final : public TextureViewBase -{ -public: - using TTextureViewBase = TextureViewBase; - - TextureViewMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const TextureViewDesc& ViewDesc, - ITexture* pTexture, - void* pMtlView, - bool bIsDefaultView); - - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) override final; - - -protected: -}; - -} // namespace Diligent diff --git a/Graphics/GraphicsEngineMetal/src/BufferMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/BufferMtlImpl.mm deleted file mode 100644 index 0ef8c817..00000000 --- a/Graphics/GraphicsEngineMetal/src/BufferMtlImpl.mm +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "BufferMtlImpl.h" -#include "RenderDeviceMtlImpl.h" -#include "DeviceContextMtlImpl.h" -#include "MtlTypeConversions.h" -#include "BufferViewMtlImpl.h" -#include "GraphicsAccessories.hpp" -#include "EngineMemory.h" - -namespace Diligent -{ - -BufferMtlImpl :: BufferMtlImpl(IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& BuffViewObjMemAllocator, - RenderDeviceMtlImpl* pRenderDeviceMtl, - const BufferDesc& BuffDesc, - const BufferData* pBuffData /*= nullptr*/) : - TBufferBase(pRefCounters, BuffViewObjMemAllocator, pRenderDeviceMtl, BuffDesc, false) -{ - LOG_ERROR_AND_THROW("Buffers are not implemented in Metal backend"); -} - -BufferDesc BuffDescFromMtlBuffer(void* pMtlBuffer, const BufferDesc& Desc) -{ - UNSUPPORTED("Not implemented"); - return BufferDesc{}; -} - -BufferMtlImpl :: BufferMtlImpl(IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& BuffViewObjMemAllocator, - class RenderDeviceMtlImpl* pDeviceMtl, - const BufferDesc& BuffDesc, - RESOURCE_STATE InitialState, - void* pMtlBuffer) : - TBufferBase(pRefCounters, BuffViewObjMemAllocator, pDeviceMtl, BuffDescFromMtlBuffer(pMtlBuffer, BuffDesc), false) -{ - SetState(InitialState); -} - -BufferMtlImpl :: ~BufferMtlImpl() -{ -} - -IMPLEMENT_QUERY_INTERFACE( BufferMtlImpl, IID_BufferMtl, TBufferBase ) - -void BufferMtlImpl::CreateViewInternal( const BufferViewDesc& OrigViewDesc, IBufferView** ppView, bool bIsDefaultView ) -{ - VERIFY( ppView != nullptr, "Null pointer provided" ); - if( !ppView )return; - VERIFY( *ppView == nullptr, "Overwriting reference to existing object may cause memory leaks" ); - - *ppView = nullptr; - - try - { - LOG_ERROR_MESSAGE("BufferD3D11Impl::CreateViewInternal() is not implemented"); - } - catch( const std::runtime_error & ) - { - const auto *ViewTypeName = GetBufferViewTypeLiteralName(OrigViewDesc.ViewType); - LOG_ERROR("Failed to create view '", OrigViewDesc.Name ? OrigViewDesc.Name : "", "' (", ViewTypeName, ") for buffer '", m_Desc.Name, "'" ); - } -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/BufferViewMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/BufferViewMtlImpl.mm deleted file mode 100644 index baad95cf..00000000 --- a/Graphics/GraphicsEngineMetal/src/BufferViewMtlImpl.mm +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "BufferViewMtlImpl.h" - -namespace Diligent -{ - -BufferViewMtlImpl::BufferViewMtlImpl( IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const BufferViewDesc& ViewDesc, - IBuffer* pBuffer, - void* pMtlView, - bool bIsDefaultView ) : - TBufferViewBase( pRefCounters, pDevice, ViewDesc, pBuffer, bIsDefaultView ) -{ - LOG_ERROR_AND_THROW("Buffer views are not implemented in Metal backend"); -} - -IMPLEMENT_QUERY_INTERFACE( BufferViewMtlImpl, IID_BufferViewMtl, TBufferViewBase ) - -} diff --git a/Graphics/GraphicsEngineMetal/src/CommandListMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/CommandListMtlImpl.mm deleted file mode 100644 index 7ac56178..00000000 --- a/Graphics/GraphicsEngineMetal/src/CommandListMtlImpl.mm +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "CommandListMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -CommandListMtlImpl :: CommandListMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - void* pMtlCommandList) : - TCommandListBase(pRefCounters, pDevice) -{ -} - -CommandListMtlImpl :: ~CommandListMtlImpl() -{ -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm deleted file mode 100644 index b76fbb1f..00000000 --- a/Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm +++ /dev/null @@ -1,557 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "DeviceContextMtlImpl.h" -#include "BufferMtlImpl.h" -#include "ShaderMtlImpl.h" -#include "SamplerMtlImpl.h" -#include "MtlTypeConversions.h" -#include "TextureViewMtlImpl.h" -#include "PipelineStateMtlImpl.h" -#include "SwapChainMtl.h" -#include "ShaderResourceBindingMtlImpl.h" -#include "CommandListMtlImpl.h" -#include "RenderDeviceMtlImpl.h" -#include "FenceMtlImpl.h" - -namespace Diligent -{ - DeviceContextMtlImpl::DeviceContextMtlImpl( IReferenceCounters* pRefCounters, - IMemoryAllocator& Allocator, - RenderDeviceMtlImpl* pDevice, - const struct EngineMtlCreateInfo& EngineAttribs, - bool bIsDeferred ) : - TDeviceContextBase(pRefCounters, pDevice, bIsDeferred) - { - } - - IMPLEMENT_QUERY_INTERFACE( DeviceContextMtlImpl, IID_DeviceContextMtl, TDeviceContextBase ) - - void DeviceContextMtlImpl::SetPipelineState(IPipelineState* pPipelineState) - { - auto* pPipelineStateMtl = ValidatedCast(pPipelineState); - TDeviceContextBase::SetPipelineState( pPipelineStateMtl, 0 /*Dummy*/ ); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetPipelineState() is not implemented"); - - auto& Desc = pPipelineStateMtl->GetDesc(); - if (Desc.IsComputePipeline()) - { - - } - else - { - - } - } - - void DeviceContextMtlImpl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) - { - DEV_CHECK_ERR(pPipelineState != nullptr, "Pipeline state must not be null"); - DEV_CHECK_ERR(pShaderResourceBinding != nullptr, "Shader resource binding must not be null"); - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::TransitionShaderResources() is not implemented"); - } - - void DeviceContextMtlImpl::ResolveTextureSubresource(ITexture* pSrcTexture, - ITexture* pDstTexture, - const ResolveTextureSubresourceAttribs& ResolveAttribs) - { - TDeviceContextBase::ResolveTextureSubresource(pSrcTexture, pDstTexture, ResolveAttribs); - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::ResolveTextureSubresource() is not implemented"); - } - - void DeviceContextMtlImpl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) - { - if (!TDeviceContextBase::CommitShaderResources(pShaderResourceBinding, StateTransitionMode, 0 /*Dummy*/)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::CommitShaderResources() is not implemented"); - } - - void DeviceContextMtlImpl::SetStencilRef(Uint32 StencilRef) - { - if (TDeviceContextBase::SetStencilRef(StencilRef, 0)) - { - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetStencilRef() is not implemented"); - } - } - - - void DeviceContextMtlImpl::SetBlendFactors(const float* pBlendFactors) - { - if (TDeviceContextBase::SetBlendFactors(pBlendFactors, 0)) - { - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetBlendFactors() is not implemented"); - } - } - - void DeviceContextMtlImpl::Draw(const DrawAttribs& Attribs) - { - if (!DvpVerifyDrawArguments(Attribs)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::Draw() is not implemented"); - } - - void DeviceContextMtlImpl::DrawIndexed(const DrawIndexedAttribs& Attribs) - { - if (!DvpVerifyDrawIndexedArguments(Attribs)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::DrawIndexed() is not implemented"); - } - - void DeviceContextMtlImpl::DrawIndirect(const DrawIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) - { - if (!DvpVerifyDrawIndirectArguments(Attribs, pAttribsBuffer)) - return; - - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::DrawIndirect() is not implemented"); - } - - void DeviceContextMtlImpl::DrawIndexedIndirect(const DrawIndexedIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) - { - if (!DvpVerifyDrawIndexedIndirectArguments(Attribs, pAttribsBuffer)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::DrawIndexedIndirect() is not implemented"); - } - - void DeviceContextMtlImpl::DrawMesh(const DrawMeshAttribs& Attribs) - { - UNSUPPORTED("DrawMesh is not supported in Metal"); - } - - void DeviceContextMtlImpl::DrawMeshIndirect(const DrawMeshIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) - { - UNSUPPORTED("DrawMeshIndirect is not supported in Metal"); - } - - void DeviceContextMtlImpl::DispatchCompute(const DispatchComputeAttribs& Attribs) - { - if (!DvpVerifyDispatchArguments(Attribs)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::DispatchCompute() is not implemented"); - } - - void DeviceContextMtlImpl::DispatchComputeIndirect(const DispatchComputeIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) - { - if (!DvpVerifyDispatchIndirectArguments(Attribs, pAttribsBuffer)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::DispatchComputeIndirect() is not implemented"); - } - - void DeviceContextMtlImpl::ClearDepthStencil(ITextureView* pView, - CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, - float fDepth, - Uint8 Stencil, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) - { - if (!TDeviceContextBase::ClearDepthStencil(pView)) - return; - - VERIFY_EXPR(pView != nullptr); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::ClearDepthStencil() is not implemented"); - } - - void DeviceContextMtlImpl::ClearRenderTarget( ITextureView* pView, const float *RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode ) - { - if (!TDeviceContextBase::ClearRenderTarget(pView)) - return; - - VERIFY_EXPR(pView != nullptr); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::ClearRenderTarget() is not implemented"); - } - - void DeviceContextMtlImpl::Flush() - { - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::Flush() is not implemented"); - } - - void DeviceContextMtlImpl::UpdateBuffer(IBuffer* pBuffer, - Uint32 Offset, - Uint32 Size, - const void* pData, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) - { - TDeviceContextBase::UpdateBuffer(pBuffer, Offset, Size, pData, StateTransitionMode); - - auto* pBufferMtlImpl = ValidatedCast( pBuffer ); - - (void)pBufferMtlImpl; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::UpdateBuffer() is not implemented"); - } - - void DeviceContextMtlImpl::CopyBuffer(IBuffer* pSrcBuffer, - Uint32 SrcOffset, - RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, - IBuffer* pDstBuffer, - Uint32 DstOffset, - Uint32 Size, - RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode) - { - TDeviceContextBase::CopyBuffer(pSrcBuffer, SrcOffset, SrcBufferTransitionMode, pDstBuffer, DstOffset, Size, DstBufferTransitionMode); - - auto* pSrcBufferMtlImpl = ValidatedCast( pSrcBuffer ); - auto* pDstBufferMtlImpl = ValidatedCast( pDstBuffer ); - - (void)pSrcBufferMtlImpl; - (void)pDstBufferMtlImpl; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::CopyBuffer() is not implemented"); - } - - - void DeviceContextMtlImpl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) - { - TDeviceContextBase::MapBuffer(pBuffer, MapType, MapFlags, pMappedData); - - auto* pBufferMtl = ValidatedCast(pBuffer); - - (void)pBufferMtl; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::MapBuffer() is not implemented"); - } - - void DeviceContextMtlImpl::UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) - { - TDeviceContextBase::UnmapBuffer(pBuffer, MapType); - auto* pBufferMtl = ValidatedCast(pBuffer); - - (void)pBufferMtl; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::UnmapBuffer() is not implemented"); - } - - void DeviceContextMtlImpl::UpdateTexture(ITexture* pTexture, - Uint32 MipLevel, - Uint32 Slice, - const Box& DstBox, - const TextureSubResData& SubresData, - RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, - RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode) - { - TDeviceContextBase::UpdateTexture( pTexture, MipLevel, Slice, DstBox, SubresData, SrcBufferTransitionMode, DstTextureTransitionMode ); - - auto* pTexMtl = ValidatedCast(pTexture); - const auto& Desc = pTexMtl->GetDesc(); - - (void)Desc; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::UpdateTexture() is not implemented"); - } - - void DeviceContextMtlImpl::CopyTexture(const CopyTextureAttribs& CopyAttribs) - { - TDeviceContextBase::CopyTexture( CopyAttribs ); - - auto* pSrcTexMtl = ValidatedCast( CopyAttribs.pSrcTexture ); - auto* pDstTexMtl = ValidatedCast( CopyAttribs.pDstTexture ); - - (void)pSrcTexMtl; - (void)pDstTexMtl; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::CopyTexture() is not implemented"); - } - - - void DeviceContextMtlImpl::MapTextureSubresource( ITexture* pTexture, - Uint32 MipLevel, - Uint32 ArraySlice, - MAP_TYPE MapType, - MAP_FLAGS MapFlags, - const Box* pMapRegion, - MappedTextureSubresource& MappedData ) - { - TDeviceContextBase::MapTextureSubresource(pTexture, MipLevel, ArraySlice, MapType, MapFlags, pMapRegion, MappedData); - - auto* pTexMtl = ValidatedCast(pTexture); - const auto& TexDesc = pTexMtl->GetDesc(); - - (void)TexDesc; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::MapTextureSubresource() is not implemented"); - } - - void DeviceContextMtlImpl::UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) - { - TDeviceContextBase::UnmapTextureSubresource( pTexture, MipLevel, ArraySlice); - - auto* pTexMtl = ValidatedCast(pTexture); - const auto& TexDesc = pTexMtl->GetDesc(); - - (void)TexDesc; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::UnmapTextureSubresource() is not implemented"); - } - - void DeviceContextMtlImpl::GenerateMips(ITextureView* pTextureView) - { - TDeviceContextBase::GenerateMips(pTextureView); - auto& TexViewMtl = *ValidatedCast(pTextureView); - - (void)TexViewMtl; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::GenerateMips() is not implemented"); - } - - void DeviceContextMtlImpl::FinishFrame() - { - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::FinishFrame() is not implemented"); - } - - void DeviceContextMtlImpl::InvalidateState() - { - TDeviceContextBase::InvalidateState(); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::InvalidateState() is not implemented"); - } - - void DeviceContextMtlImpl::SetVertexBuffers( Uint32 StartSlot, - Uint32 NumBuffersSet, - IBuffer** ppBuffers, - Uint32* pOffsets, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, - SET_VERTEX_BUFFERS_FLAGS Flags ) - { - TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pOffsets, StateTransitionMode, Flags ); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetVertexBuffers() is not implemented"); - for (Uint32 Slot = 0; Slot < m_NumVertexStreams; ++Slot) - { - auto& CurrStream = m_VertexStreams[Slot]; - if (auto* pBuffMtlImpl = CurrStream.pBuffer.RawPtr()) - { - - } - } - } - - void DeviceContextMtlImpl::SetIndexBuffer( IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode ) - { - TDeviceContextBase::SetIndexBuffer( pIndexBuffer, ByteOffset, StateTransitionMode ); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetIndexBuffer() is not implemented"); - if (m_pIndexBuffer) - { - - } - - } - - void DeviceContextMtlImpl::SetViewports( Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight ) - { - TDeviceContextBase::SetViewports( NumViewports, pViewports, RTWidth, RTHeight ); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetViewports() is not implemented"); - } - - void DeviceContextMtlImpl::SetScissorRects( Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight ) - { - TDeviceContextBase::SetScissorRects(NumRects, pRects, RTWidth, RTHeight); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetScissorRects() is not implemented"); - } - - void DeviceContextMtlImpl::SetRenderTargets(Uint32 NumRenderTargets, - ITextureView* ppRenderTargets[], - ITextureView* pDepthStencil, - RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) - { - if( TDeviceContextBase::SetRenderTargets( NumRenderTargets, ppRenderTargets, pDepthStencil ) ) - { - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SetRenderTargets() is not implemented"); - } - } - - void DeviceContextMtlImpl::BeginRenderPass(const BeginRenderPassAttribs& Attribs) - { - TDeviceContextBase::BeginRenderPass(Attribs); - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::BeginRenderPass() is not implemented"); - } - - void DeviceContextMtlImpl::NextSubpass() - { - TDeviceContextBase::NextSubpass(); - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::NextSubpass() is not implemented"); - } - - void DeviceContextMtlImpl::EndRenderPass() - { - TDeviceContextBase::EndRenderPass(); - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::EndRenderPass() is not implemented"); - } - - void DeviceContextMtlImpl::FinishCommandList(ICommandList **ppCommandList) - { - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::FinishCommandList() is not implemented"); - } - - void DeviceContextMtlImpl::ExecuteCommandList(ICommandList* pCommandList) - { - if (m_bIsDeferred) - { - LOG_ERROR("Only immediate context can execute command list"); - return; - } - - CommandListMtlImpl* pCmdListMtl = ValidatedCast(pCommandList); - - (void)pCmdListMtl; - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::ExecuteCommandList() is not implemented"); - } - - void DeviceContextMtlImpl::SignalFence(IFence* pFence, Uint64 Value) - { - VERIFY(!m_bIsDeferred, "Fence can only be signalled from immediate context"); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::SignalFence() is not implemented"); - } - - void DeviceContextMtlImpl::WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext) - { - VERIFY(!m_bIsDeferred, "Fence can only be waited from immediate context"); - Flush(); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::Wait() is not implemented"); - } - - void DeviceContextMtlImpl::WaitForIdle() - { - VERIFY(!m_bIsDeferred, "Only immediate contexts can be idled"); - Flush(); - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::WaitForIdle() is not implemented"); - } - - /// Implementation of IDeviceContext::BeginQuery() in Metal backend. - void DeviceContextMtlImpl::BeginQuery(IQuery* pQuery) - { - if (!TDeviceContextBase::BeginQuery(pQuery, 0)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::BeginQuery() is not implemented"); - } - - /// Implementation of IDeviceContext::EndQuery() in Metal backend. - void DeviceContextMtlImpl::EndQuery(IQuery* pQuery) - { - if (!TDeviceContextBase::EndQuery(pQuery, 0)) - return; - - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::EndQuery() is not implemented"); - } - - - void DeviceContextMtlImpl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) - { - LOG_ERROR_MESSAGE("DeviceContextMtlImpl::TransitionResourceStates() is not implemented"); - - for (Uint32 i=0; i < BarrierCount; ++i) - { - const auto& Barrier = pResourceBarriers[i]; -#ifdef DEVELOPMENT - DvpVerifyStateTransitionDesc(Barrier); -#endif - DEV_CHECK_ERR((Barrier.pTexture != nullptr) ^ (Barrier.pBuffer != nullptr), "Exactly one of pTexture or pBuffer must not be null"); - DEV_CHECK_ERR(Barrier.NewState != RESOURCE_STATE_UNKNOWN, "New resource state can't be unknown"); - - if (Barrier.TransitionType == STATE_TRANSITION_TYPE_BEGIN) - { - // Skip begin-split barriers - VERIFY(!Barrier.UpdateResourceState, "Resource state can't be updated in begin-split barrier"); - continue; - } - VERIFY(Barrier.TransitionType == STATE_TRANSITION_TYPE_IMMEDIATE || Barrier.TransitionType == STATE_TRANSITION_TYPE_END, "Unexpected barrier type"); - - if (Barrier.pTexture) - { - auto* pTextureMtlImpl = ValidatedCast(Barrier.pTexture); - auto OldState = Barrier.OldState; - if (OldState == RESOURCE_STATE_UNKNOWN) - { - if (pTextureMtlImpl->IsInKnownState()) - { - OldState = pTextureMtlImpl->GetState(); - } - else - { - LOG_ERROR_MESSAGE("Failed to transition the state of texture '", pTextureMtlImpl->GetDesc().Name, "' because the buffer state is unknown and is not explicitly specified"); - continue; - } - } - else - { - if (pTextureMtlImpl->IsInKnownState() && pTextureMtlImpl->GetState() != OldState) - { - LOG_ERROR_MESSAGE("The state ", GetResourceStateString(pTextureMtlImpl->GetState()), " of texture '", - pTextureMtlImpl->GetDesc().Name, "' does not match the old state ", GetResourceStateString(OldState), - " specified by the barrier"); - } - } - - - // Actual barrier code goes here - - - if (Barrier.UpdateResourceState) - { - pTextureMtlImpl->SetState(Barrier.NewState); - } - } - else - { - VERIFY_EXPR(Barrier.pBuffer); - auto* pBufferMtlImpl = ValidatedCast(Barrier.pBuffer); - auto OldState = Barrier.OldState; - if (OldState == RESOURCE_STATE_UNKNOWN) - { - if (pBufferMtlImpl->IsInKnownState()) - { - OldState = pBufferMtlImpl->GetState(); - } - else - { - LOG_ERROR_MESSAGE("Failed to transition the state of buffer '", pBufferMtlImpl->GetDesc().Name, "' because the buffer state is unknown and is not explicitly specified"); - continue; - } - } - else - { - if (pBufferMtlImpl->IsInKnownState() && pBufferMtlImpl->GetState() != OldState) - { - LOG_ERROR_MESSAGE("The state ", GetResourceStateString(pBufferMtlImpl->GetState()), " of buffer '", - pBufferMtlImpl->GetDesc().Name, "' does not match the old state ", GetResourceStateString(OldState), - " specified by the barrier"); - } - } - - - // Actual barrier code goes here - - - if (Barrier.UpdateResourceState) - { - pBufferMtlImpl->SetState(Barrier.NewState); - } - } - } - } -} diff --git a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm b/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm deleted file mode 100644 index 3425c849..00000000 --- a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm +++ /dev/null @@ -1,221 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -/// \file -/// Routines that initialize Mtl-based engine implementation - -#include "EngineFactoryMtl.h" -#include "RenderDeviceMtlImpl.h" -#include "DeviceContextMtlImpl.h" -#include "SwapChainMtlImpl.h" -#include "MtlTypeConversions.h" -#include "EngineMemory.h" -#include "EngineFactoryBase.hpp" - -namespace Diligent -{ - -/// Engine factory for Mtl implementation -class EngineFactoryMtlImpl : public EngineFactoryBase -{ -public: - static EngineFactoryMtlImpl* GetInstance() - { - static EngineFactoryMtlImpl TheFactory; - return &TheFactory; - } - - using TBase = EngineFactoryBase; - EngineFactoryMtlImpl() : - TBase(IID_EngineFactoryMtl) - {} - - void CreateDeviceAndContextsMtl(const EngineMtlCreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts)override final; - - void CreateSwapChainMtl( IRenderDevice* pDevice, - IDeviceContext* pImmediateContext, - const SwapChainDesc& SCDesc, - const NativeWindow& Window, - ISwapChain** ppSwapChain )override final; - - void AttachToMtlDevice(void* pMtlNativeDevice, - const EngineMtlCreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts)override final; -}; - - -/// Creates render device and device contexts for Metal-based engine implementation - -/// \param [in] EngineCI - Engine creation attributes. -/// \param [out] ppDevice - Address of the memory location where pointer to -/// the created device will be written -/// \param [out] ppContexts - Address of the memory location where pointers to -/// the contexts will be written. Immediate context goes at -/// position 0. If EngineCI.NumDeferredContexts > 0, -/// pointers to the deferred contexts go afterwards. -void EngineFactoryMtlImpl::CreateDeviceAndContextsMtl(const EngineMtlCreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts) -{ - if (EngineCI.DebugMessageCallback != nullptr) - SetDebugMessageCallback(EngineCI.DebugMessageCallback); - - VERIFY( ppDevice && ppContexts, "Null pointer provided" ); - if( !ppDevice || !ppContexts ) - return; - - *ppDevice = nullptr; - memset(ppContexts, 0, sizeof(*ppContexts) * (1 + EngineCI.NumDeferredContexts)); - - void* pMtlDevice = nullptr; - AttachToMtlDevice(pMtlDevice, EngineCI, ppDevice, ppContexts); -} - - -/// Attaches to existing Mtl render device and immediate context - -/// \param [in] pMtlNativeDevice - pointer to native Mtl device -/// \param [in] pMtlImmediateContext - pointer to native Mtl immediate context -/// \param [in] EngineCI - Engine creation attributes. -/// \param [out] ppDevice - Address of the memory location where pointer to -/// the created device will be written -/// \param [out] ppContexts - Address of the memory location where pointers to -/// the contexts will be written. Immediate context goes at -/// position 0. If EngineCI.NumDeferredContexts > 0, -/// pointers to the deferred contexts go afterwards. -void EngineFactoryMtlImpl::AttachToMtlDevice(void* pMtlNativeDevice, - const EngineMtlCreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts) -{ - if (EngineCI.DebugMessageCallback != nullptr) - SetDebugMessageCallback(EngineCI.DebugMessageCallback); - - VERIFY( ppDevice && ppContexts, "Null pointer provided" ); - if( !ppDevice || !ppContexts ) - return; - - try - { - SetRawAllocator(EngineCI.pRawMemAllocator); - auto& RawAlloctor = GetRawAllocator(); - RenderDeviceMtlImpl* pRenderDeviceMtl(NEW_RC_OBJ(RawAlloctor, "RenderDeviceMtlImpl instance", RenderDeviceMtlImpl) - (RawAlloctor, this, EngineCI, pMtlNativeDevice)); - pRenderDeviceMtl->QueryInterface(IID_RenderDevice, reinterpret_cast(ppDevice)); - - RefCntAutoPtr pDeviceContextMtl(NEW_RC_OBJ(RawAlloctor, "DeviceContextMtlImpl instance", DeviceContextMtlImpl) - (RawAlloctor, pRenderDeviceMtl, EngineCI, false)); - - // We must call AddRef() (implicitly through QueryInterface()) because pRenderDeviceMtl will - // keep a weak reference to the context - pDeviceContextMtl->QueryInterface(IID_DeviceContext, reinterpret_cast(ppContexts)); - pRenderDeviceMtl->SetImmediateContext(pDeviceContextMtl); - - for (Uint32 DeferredCtx = 0; DeferredCtx < EngineCI.NumDeferredContexts; ++DeferredCtx) - { - RefCntAutoPtr pDeferredCtxMtl( - NEW_RC_OBJ(RawAlloctor, "DeviceContextMtlImpl instance", DeviceContextMtlImpl) - (RawAlloctor, pRenderDeviceMtl, EngineCI, true)); - // We must call AddRef() (implicitly through QueryInterface()) because pRenderDeviceD3D12 will - // keep a weak reference to the context - pDeferredCtxMtl->QueryInterface(IID_DeviceContext, reinterpret_cast(ppContexts + 1 + DeferredCtx)); - pRenderDeviceMtl->SetDeferredContext(DeferredCtx, pDeferredCtxMtl); - } - } - catch( const std::runtime_error & ) - { - if( *ppDevice ) - { - (*ppDevice)->Release(); - *ppDevice = nullptr; - } - for(Uint32 ctx=0; ctx < 1 + EngineCI.NumDeferredContexts; ++ctx) - { - if( ppContexts[ctx] != nullptr ) - { - ppContexts[ctx]->Release(); - ppContexts[ctx] = nullptr; - } - } - - LOG_ERROR( "Failed to initialize Mtl device and contexts" ); - } -} - -/// Creates a swap chain for Direct3D11-based engine implementation - -/// \param [in] pDevice - Pointer to the render device -/// \param [in] pImmediateContext - Pointer to the immediate device context -/// \param [in] SCDesc - Swap chain description -/// \param [in] FSDesc - Fullscreen mode description -/// \param [in] pNativeWndHandle - Platform-specific native handle of the window -/// the swap chain will be associated with: -/// * On Win32 platform, this should be window handle (HWND) -/// * On Universal Windows Platform, this should be reference to the -/// core window (Windows::UI::Core::CoreWindow) -/// -/// \param [out] ppSwapChain - Address of the memory location where pointer to the new -/// swap chain will be written -void EngineFactoryMtlImpl::CreateSwapChainMtl(IRenderDevice* pDevice, - IDeviceContext* pImmediateContext, - const SwapChainDesc& SCDesc, - const NativeWindow& Window, - ISwapChain** ppSwapChain ) -{ - VERIFY( ppSwapChain, "Null pointer provided" ); - if( !ppSwapChain ) - return; - - *ppSwapChain = nullptr; - - try - { - auto *pDeviceMtl = ValidatedCast( pDevice ); - auto *pDeviceContextMtl = ValidatedCast(pImmediateContext); - auto &RawMemAllocator = GetRawAllocator(); - - auto *pSwapChainMtl = NEW_RC_OBJ(RawMemAllocator, "SwapChainMtlImpl instance", SwapChainMtlImpl) - (SCDesc, pDeviceMtl, pDeviceContextMtl, Window); - pSwapChainMtl->QueryInterface( IID_SwapChain, reinterpret_cast(ppSwapChain) ); - } - catch( const std::runtime_error & ) - { - if( *ppSwapChain ) - { - (*ppSwapChain)->Release(); - *ppSwapChain = nullptr; - } - - LOG_ERROR( "Failed to create the swap chain" ); - } -} - -IEngineFactoryMtl* GetEngineFactoryMtl() -{ - return EngineFactoryMtlImpl::GetInstance(); -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/FenceMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/FenceMtlImpl.mm deleted file mode 100644 index 4e9a4d39..00000000 --- a/Graphics/GraphicsEngineMetal/src/FenceMtlImpl.mm +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "FenceMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -FenceMtlImpl :: FenceMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const FenceDesc& Desc) : - TFenceBase(pRefCounters, pDevice, Desc) -{ -} - -FenceMtlImpl :: ~FenceMtlImpl() -{ -} - -Uint64 FenceMtlImpl :: GetCompletedValue() -{ - LOG_ERROR_MESSAGE("FenceMtlImpl::GetCompletedValue() is not implemented"); - return 0; -} - -void FenceMtlImpl :: Reset(Uint64 Value) -{ - LOG_ERROR_MESSAGE("FenceMtlImpl::Reset() is not implemented"); -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.mm deleted file mode 100644 index 5c30ca17..00000000 --- a/Graphics/GraphicsEngineMetal/src/FramebufferMtlImpl.mm +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "FramebufferMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -FramebufferMtlImpl :: FramebufferMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const FramebufferDesc& Desc) : - TFramebufferBase(pRefCounters, pDevice, Desc) -{ -} - -FramebufferMtlImpl :: ~FramebufferMtlImpl() -{ -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/MtlTypeConversions.mm b/Graphics/GraphicsEngineMetal/src/MtlTypeConversions.mm deleted file mode 100644 index b4ad1bbe..00000000 --- a/Graphics/GraphicsEngineMetal/src/MtlTypeConversions.mm +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "MtlTypeConversions.h" - -namespace Diligent -{ - -} diff --git a/Graphics/GraphicsEngineMetal/src/PipelineStateMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/PipelineStateMtlImpl.mm deleted file mode 100644 index ba399671..00000000 --- a/Graphics/GraphicsEngineMetal/src/PipelineStateMtlImpl.mm +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "PipelineStateMtlImpl.h" -#include "RenderDeviceMtlImpl.h" -#include "ShaderResourceBindingMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -PipelineStateMtlImpl::PipelineStateMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pRenderDeviceMtl, - const PipelineStateCreateInfo& CreateInfo) : - TPipelineStateBase(pRefCounters, pRenderDeviceMtl, CreateInfo.PSODesc) -{ - LOG_ERROR_AND_THROW("Pipeline states are not implemented in Metal backend"); - if (CreateInfo.PSODesc.IsComputePipeline()) - { - - } - else - { - - } -} - - -PipelineStateMtlImpl::~PipelineStateMtlImpl() -{ -} - -IMPLEMENT_QUERY_INTERFACE( PipelineStateMtlImpl, IID_PipelineStateMtl, TPipelineStateBase ) - - -void PipelineStateMtlImpl::CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources) -{ - auto* pRenderDeviceMtl = ValidatedCast( GetDevice() ); - - (void)pRenderDeviceMtl; - LOG_ERROR_MESSAGE("PipelineStateMtlImpl::CreateShaderResourceBinding() is not implemented"); -} - -bool PipelineStateMtlImpl::IsCompatibleWith(const IPipelineState* pPSO)const -{ - VERIFY_EXPR(pPSO != nullptr); - - if (pPSO == this) - return true; - - const PipelineStateMtlImpl* pPSOMtl = ValidatedCast(pPSO); - - (void)pPSOMtl; - LOG_ERROR_MESSAGE("PipelineStateMtlImpl::IsCompatibleWith() is not implemented"); - - return false; -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/QueryMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/QueryMtlImpl.mm deleted file mode 100644 index 3b9e5f59..00000000 --- a/Graphics/GraphicsEngineMetal/src/QueryMtlImpl.mm +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "QueryMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -QueryMtlImpl :: QueryMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const QueryDesc& Desc) : - TQueryBase(pRefCounters, pDevice, Desc) -{ -} - -QueryMtlImpl :: ~QueryMtlImpl() -{ -} - -bool QueryMtlImpl :: GetData(void* pData, Uint32 DataSize, bool AutoInvalidate) -{ - return false; -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm deleted file mode 100644 index 62e3753e..00000000 --- a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm +++ /dev/null @@ -1,222 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "RenderDeviceMtlImpl.h" -#include "DeviceContextMtlImpl.h" -#include "BufferMtlImpl.h" -#include "ShaderMtlImpl.h" -#include "TextureMtlImpl.h" -#include "SamplerMtlImpl.h" -#include "MtlTypeConversions.h" -#include "TextureViewMtlImpl.h" -#include "PipelineStateMtlImpl.h" -#include "ShaderResourceBindingMtlImpl.h" -#include "FenceMtlImpl.h" -#include "RenderPassMtlImpl.h" -#include "FramebufferMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -RenderDeviceMtlImpl :: RenderDeviceMtlImpl(IReferenceCounters* pRefCounters, - IMemoryAllocator& RawMemAllocator, - IEngineFactory* pEngineFactory, - const EngineMtlCreateInfo& EngineAttribs, - void* pMtlDevice) : - TRenderDeviceBase - { - pRefCounters, - RawMemAllocator, - pEngineFactory, - EngineAttribs.NumDeferredContexts, - DeviceObjectSizes - { - sizeof(TextureMtlImpl), - sizeof(TextureViewMtlImpl), - sizeof(BufferMtlImpl), - sizeof(BufferViewMtlImpl), - sizeof(ShaderMtlImpl), - sizeof(SamplerMtlImpl), - sizeof(PipelineStateMtlImpl), - sizeof(ShaderResourceBindingMtlImpl), - sizeof(FenceMtlImpl), - sizeof(RenderPassMtlImpl), - sizeof(FramebufferMtlImpl) - } - }, - m_EngineAttribs(EngineAttribs) -{ - m_DeviceCaps.DevType = RENDER_DEVICE_TYPE_METAL; - m_DeviceCaps.MajorVersion = 1; - m_DeviceCaps.MinorVersion = 0; - m_DeviceCaps.Features.SeparablePrograms = DEVICE_FEATURE_STATE_ENABLED; - m_DeviceCaps.Features.MultithreadedResourceCreation = DEVICE_FEATURE_STATE_ENABLED; - m_DeviceCaps.Features.GeometryShaders = DEVICE_FEATURE_STATE_DISABLED; - m_DeviceCaps.Features.Tessellation = DEVICE_FEATURE_STATE_DISABLED; -} - -void RenderDeviceMtlImpl::TestTextureFormat( TEXTURE_FORMAT TexFormat ) -{ - auto &TexFormatInfo = m_TextureFormatsInfo[TexFormat]; - VERIFY( TexFormatInfo.Supported, "Texture format is not supported" ); - - LOG_ERROR_MESSAGE("RenderDeviceMtlImpl::TestTextureFormat() is not implemented"); -} - -IMPLEMENT_QUERY_INTERFACE( RenderDeviceMtlImpl, IID_RenderDeviceMtl, TRenderDeviceBase ) - -void RenderDeviceMtlImpl :: CreateBuffer(const BufferDesc& BuffDesc, const BufferData* pBuffData, IBuffer** ppBuffer) -{ - CreateDeviceObject("buffer", BuffDesc, ppBuffer, - [&]() - { - BufferMtlImpl* pBufferMtl( NEW_RC_OBJ(m_BufObjAllocator, "BufferMtlImpl instance", BufferMtlImpl) - (m_BuffViewObjAllocator, this, BuffDesc, pBuffData ) ); - pBufferMtl->QueryInterface( IID_Buffer, reinterpret_cast(ppBuffer) ); - pBufferMtl->CreateDefaultViews(); - OnCreateDeviceObject( pBufferMtl ); - } - ); -} - -void RenderDeviceMtlImpl :: CreateShader(const ShaderCreateInfo& ShaderCI, IShader** ppShader) -{ - CreateDeviceObject( "shader", ShaderCI.Desc, ppShader, - [&]() - { - ShaderMtlImpl* pShaderMtl( NEW_RC_OBJ(m_ShaderObjAllocator, "ShaderMtlImpl instance", ShaderMtlImpl) - (this, ShaderCI ) ); - pShaderMtl->QueryInterface( IID_Shader, reinterpret_cast(ppShader) ); - - OnCreateDeviceObject( pShaderMtl ); - } - ); -} - - - -void RenderDeviceMtlImpl :: CreateTexture(const TextureDesc& TexDesc, const TextureData* pData, ITexture** ppTexture) -{ - CreateDeviceObject( "texture", TexDesc, ppTexture, - [&]() - { - TextureMtlImpl *pTextureMtl = NEW_RC_OBJ(m_TexObjAllocator, "TextureMtlImpl instance", TextureMtlImpl)(m_TexViewObjAllocator, this, TexDesc, pData ); - - pTextureMtl->QueryInterface( IID_Texture, reinterpret_cast(ppTexture) ); - pTextureMtl->CreateDefaultViews(); - OnCreateDeviceObject( pTextureMtl ); - } - ); -} - -void RenderDeviceMtlImpl :: CreateSampler(const SamplerDesc& SamplerDesc, ISampler** ppSampler) -{ - CreateDeviceObject( "sampler", SamplerDesc, ppSampler, - [&]() - { - m_SamplersRegistry.Find( SamplerDesc, reinterpret_cast(ppSampler) ); - if(* ppSampler == nullptr ) - { - SamplerMtlImpl* pSamplerMtl( NEW_RC_OBJ(m_SamplerObjAllocator, "SamplerMtlImpl instance", SamplerMtlImpl) - (this, SamplerDesc ) ); - pSamplerMtl->QueryInterface( IID_Sampler, reinterpret_cast(ppSampler) ); - OnCreateDeviceObject( pSamplerMtl ); - m_SamplersRegistry.Add( SamplerDesc,* ppSampler ); - } - } - ); -} - - -void RenderDeviceMtlImpl::CreatePipelineState(const PipelineStateCreateInfo& PSOCreateInfo, IPipelineState** ppPipelineState) -{ - CreateDeviceObject( "Pipeline state", PSOCreateInfo.PSODesc, ppPipelineState, - [&]() - { - PipelineStateMtlImpl* pPipelineStateMtl( NEW_RC_OBJ(m_PSOAllocator, "PipelineStateMtlImpl instance", PipelineStateMtlImpl) - (this, PSOCreateInfo) ); - pPipelineStateMtl->QueryInterface( IID_PipelineState, reinterpret_cast(ppPipelineState) ); - OnCreateDeviceObject( pPipelineStateMtl ); - } - ); -} - -void RenderDeviceMtlImpl::CreateFence(const FenceDesc& Desc, IFence** ppFence) -{ - CreateDeviceObject( "Fence", Desc, ppFence, - [&]() - { - FenceMtlImpl* pFenceMtl( NEW_RC_OBJ(m_FenceAllocator, "FenceMtlImpl instance", FenceMtlImpl) - (this, Desc) ); - pFenceMtl->QueryInterface( IID_Fence, reinterpret_cast(ppFence) ); - OnCreateDeviceObject( pFenceMtl ); - } - ); -} - -void RenderDeviceMtlImpl::CreateQuery(const QueryDesc& Desc, IQuery** ppQuery) -{ - CreateDeviceObject( "Query", Desc, ppQuery, - [&]() - { - QueryMtlImpl* pQueryMtl( NEW_RC_OBJ(m_QueryAllocator, "QueryMtlImpl instance", QueryMtlImpl) - (this, Desc) ); - pQueryMtl->QueryInterface( IID_Query, reinterpret_cast(ppQuery) ); - OnCreateDeviceObject( pQueryMtl ); - } - ); -} - -void RenderDeviceMtlImpl::CreateRenderPass(const RenderPassDesc& Desc, IRenderPass** ppRenderPass) -{ - CreateDeviceObject( "RenderPass", Desc, ppRenderPass, - [&]() - { - RenderPassMtlImpl* pRenderPassMtl( NEW_RC_OBJ(m_RenderPassAllocator, "RenderPassMtlImpl instance", RenderPassMtlImpl) - (this, Desc) ); - pRenderPassMtl->QueryInterface( IID_RenderPass, reinterpret_cast(ppRenderPass) ); - OnCreateDeviceObject( pRenderPassMtl ); - } - ); -} - -void RenderDeviceMtlImpl::CreateFramebuffer(const FramebufferDesc& Desc, IFramebuffer** ppFramebuffer) -{ - CreateDeviceObject( "Framebuffer", Desc, ppFramebuffer, - [&]() - { - FramebufferMtlImpl* pFramebufferMtl( NEW_RC_OBJ(m_FramebufferAllocator, "FramebufferMtlImpl instance", FramebufferMtlImpl) - (this, Desc) ); - pFramebufferMtl->QueryInterface( IID_Framebuffer, reinterpret_cast(ppFramebuffer) ); - OnCreateDeviceObject( pFramebufferMtl ); - } - ); -} - -void RenderDeviceMtlImpl::IdleGPU() -{ - LOG_ERROR_MESSAGE("RenderDeviceMtlImpl::IdleGPU() is not implemented"); -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/RenderPassMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/RenderPassMtlImpl.mm deleted file mode 100644 index 175c8897..00000000 --- a/Graphics/GraphicsEngineMetal/src/RenderPassMtlImpl.mm +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "RenderPassMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -RenderPassMtlImpl :: RenderPassMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const RenderPassDesc& Desc) : - TRenderPassBase(pRefCounters, pDevice, Desc) -{ -} - -RenderPassMtlImpl :: ~RenderPassMtlImpl() -{ -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/SamplerMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/SamplerMtlImpl.mm deleted file mode 100644 index 39450815..00000000 --- a/Graphics/GraphicsEngineMetal/src/SamplerMtlImpl.mm +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "SamplerMtlImpl.h" -#include "RenderDeviceMtlImpl.h" -#include "MtlTypeConversions.h" - -namespace Diligent -{ - -SamplerMtlImpl::SamplerMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pRenderDeviceMtl, - const SamplerDesc& SamplerDesc) : - TSamplerBase(pRefCounters, pRenderDeviceMtl, SamplerDesc) -{ - LOG_ERROR_AND_THROW("Samplers are not implemented in Metal backend"); -} - -SamplerMtlImpl::~SamplerMtlImpl() -{ - -} - -IMPLEMENT_QUERY_INTERFACE( SamplerMtlImpl, IID_SamplerMtl, TSamplerBase ) - -} diff --git a/Graphics/GraphicsEngineMetal/src/ShaderMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/ShaderMtlImpl.mm deleted file mode 100644 index 7f9f04f6..00000000 --- a/Graphics/GraphicsEngineMetal/src/ShaderMtlImpl.mm +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "ShaderMtlImpl.h" -#include "RenderDeviceMtlImpl.h" -#include "ResourceMapping.h" - -namespace Diligent -{ - -ShaderMtlImpl::ShaderMtlImpl(IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pRenderDeviceMtl, - const ShaderCreateInfo& ShaderCI) : - TShaderBase(pRefCounters, pRenderDeviceMtl, ShaderCI.Desc) -{ - LOG_ERROR_AND_THROW("Shaders are not implemented in Metal backend"); -} - -ShaderMtlImpl::~ShaderMtlImpl() -{ -} - -IMPLEMENT_QUERY_INTERFACE( ShaderMtlImpl, IID_ShaderMtl, TShaderBase ) - -} diff --git a/Graphics/GraphicsEngineMetal/src/ShaderResourceBindingMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/ShaderResourceBindingMtlImpl.mm deleted file mode 100644 index 2f193a7e..00000000 --- a/Graphics/GraphicsEngineMetal/src/ShaderResourceBindingMtlImpl.mm +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "ShaderResourceBindingMtlImpl.h" -#include "PipelineStateMtlImpl.h" -#include "DeviceContextMtlImpl.h" -#include "RenderDeviceMtlImpl.h" - -namespace Diligent -{ - - -ShaderResourceBindingMtlImpl::ShaderResourceBindingMtlImpl( IReferenceCounters* pRefCounters, - PipelineStateMtlImpl* pPSO, - bool IsInternal) : - TBase( pRefCounters, pPSO, IsInternal ) -{ - LOG_ERROR_AND_THROW("Shader resource binding is not implemented in Metal backend"); -} - -ShaderResourceBindingMtlImpl::~ShaderResourceBindingMtlImpl() -{ - -} - -IMPLEMENT_QUERY_INTERFACE( ShaderResourceBindingMtlImpl, IID_ShaderResourceBindingMtl, TBase ) - -void ShaderResourceBindingMtlImpl::BindResources(Uint32 ShaderFlags, IResourceMapping *pResMapping, Uint32 Flags) -{ - LOG_ERROR_MESSAGE("ShaderResourceBindingMtlImpl::BindResources() is not implemented"); -} - -void ShaderResourceBindingMtlImpl::InitializeStaticResources(const IPipelineState* pPipelineState) -{ - LOG_ERROR_MESSAGE("ShaderResourceBindingMtlImpl::InitializeStaticResources() is not implemented"); -} - -IShaderResourceVariable* ShaderResourceBindingMtlImpl::GetVariableByName(SHADER_TYPE ShaderType, const char* Name) -{ - LOG_ERROR_MESSAGE("ShaderResourceBindingMtlImpl::GetVariable() is not implemented"); - return nullptr; -} - -Uint32 ShaderResourceBindingMtlImpl::GetVariableCount(SHADER_TYPE ShaderType) const -{ - LOG_ERROR_MESSAGE("ShaderResourceBindingMtlImpl::GetVariableCount() is not implemented"); - return 0; -} - -IShaderResourceVariable* ShaderResourceBindingMtlImpl::GetVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) -{ - LOG_ERROR_MESSAGE("ShaderResourceBindingMtlImpl::GetVariable() is not implemented"); - return nullptr; -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm deleted file mode 100644 index 7532f5cd..00000000 --- a/Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "SwapChainMtlImpl.h" -#include "RenderDeviceMtlImpl.h" -#include "DeviceContextMtlImpl.h" - -namespace Diligent -{ - -SwapChainMtlImpl::SwapChainMtlImpl(IReferenceCounters* pRefCounters, - const SwapChainDesc& SCDesc, - RenderDeviceMtlImpl* pRenderDeviceMtl, - DeviceContextMtlImpl* pDeviceContextMtl, - const NativeWindow& Window) : - TSwapChainBase(pRefCounters, pRenderDeviceMtl, pDeviceContextMtl, SCDesc) -{ - LOG_ERROR_AND_THROW("Swap chain is not implemented in Metal backend"); -} - -SwapChainMtlImpl::~SwapChainMtlImpl() -{ -} - -IMPLEMENT_QUERY_INTERFACE( SwapChainMtlImpl, IID_SwapChainMtl, TSwapChainBase ) - -void SwapChainMtlImpl::Present(Uint32 SyncInterval) -{ - LOG_ERROR_MESSAGE("SwapChainMtlImpl::Present() is not implemented"); -} - - -void SwapChainMtlImpl::Resize( Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform ) -{ - if( TSwapChainBase::Resize(NewWidth, NewHeight, NewPreTransform) ) - { - LOG_ERROR_MESSAGE("SwapChainMtlImpl::Resize() is not implemented"); - } -} - -void SwapChainMtlImpl::SetFullscreenMode(const DisplayModeAttribs &DisplayMode) -{ - LOG_ERROR_MESSAGE("SwapChainMtlImpl::SetFullscreenMode() is not implemented"); -} - -void SwapChainMtlImpl::SetWindowedMode() -{ - LOG_ERROR_MESSAGE("SwapChainMtlImpl::SetWindowedMode() is not implemented"); -} - -ITextureView* SwapChainMtlImpl::GetCurrentBackBufferRTV() -{ - LOG_ERROR_MESSAGE("SwapChainMtlImpl::GetCurrentBackBufferRTV() is not implemented"); - return nullptr; -} - -ITextureView* SwapChainMtlImpl::GetDepthBufferDSV() -{ - LOG_ERROR_MESSAGE("SwapChainMtlImpl::GetDepthBufferDSV() is not implemented"); - return nullptr; -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/TextureMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/TextureMtlImpl.mm deleted file mode 100644 index b89b0c35..00000000 --- a/Graphics/GraphicsEngineMetal/src/TextureMtlImpl.mm +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "TextureMtlImpl.h" -#include "RenderDeviceMtlImpl.h" -#include "DeviceContextMtlImpl.h" -#include "MtlTypeConversions.h" -#include "TextureViewMtlImpl.h" -#include "EngineMemory.h" - -namespace Diligent -{ - -TextureMtlImpl :: TextureMtlImpl(IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& TexViewObjAllocator, - RenderDeviceMtlImpl* pRenderDeviceMtl, - const TextureDesc& TexDesc, - const TextureData* pInitData /*= nullptr*/) : - TTextureBase(pRefCounters, TexViewObjAllocator, pRenderDeviceMtl, TexDesc) -{ - LOG_ERROR_AND_THROW("Textures are not implemented in Metal backend"); - - if( (TexDesc.Usage == USAGE_STATIC && pInitData == nullptr) || pInitData->pSubResources == nullptr ) - LOG_ERROR_AND_THROW("Static Texture must be initialized with data at creation time"); - SetState(RESOURCE_STATE_UNDEFINED); -} - -IMPLEMENT_QUERY_INTERFACE( TextureMtlImpl, IID_TextureMtl, TTextureBase ) - -TextureMtlImpl :: ~TextureMtlImpl() -{ -} - -void TextureMtlImpl::CreateViewInternal( const TextureViewDesc &ViewDesc, ITextureView **ppView, bool bIsDefaultView ) -{ - VERIFY( ppView != nullptr, "View pointer address is null" ); - if( !ppView )return; - VERIFY( *ppView == nullptr, "Overwriting reference to existing object may cause memory leaks" ); - - *ppView = nullptr; - - try - { - LOG_ERROR_MESSAGE("TextureMtlImpl::CreateViewInternal() is not implemented"); - } - catch( const std::runtime_error & ) - { - const auto *ViewTypeName = GetTexViewTypeLiteralName(ViewDesc.ViewType); - LOG_ERROR("Failed to create view \"", ViewDesc.Name ? ViewDesc.Name : "", "\" (", ViewTypeName, ") for texture \"", m_Desc.Name ? m_Desc.Name : "", "\"" ); - } -} - -} diff --git a/Graphics/GraphicsEngineMetal/src/TextureViewMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/TextureViewMtlImpl.mm deleted file mode 100644 index 754b2a64..00000000 --- a/Graphics/GraphicsEngineMetal/src/TextureViewMtlImpl.mm +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2015-2019 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. - */ - -#include "TextureViewMtlImpl.h" -#include "DeviceContextMtlImpl.h" - -namespace Diligent -{ - -TextureViewMtlImpl::TextureViewMtlImpl( IReferenceCounters* pRefCounters, - RenderDeviceMtlImpl* pDevice, - const TextureViewDesc& ViewDesc, - ITexture* pTexture, - void* pMtlView, - bool bIsDefaultView ) : - TTextureViewBase( pRefCounters, pDevice, ViewDesc, pTexture, bIsDefaultView ) -{ - LOG_ERROR_AND_THROW("Texture views are not implemented in Metal backend"); -} - -IMPLEMENT_QUERY_INTERFACE( TextureViewMtlImpl, IID_TextureViewMtl, TTextureViewBase ) - -} -- cgit v1.2.3