|
| 1 | +/* |
| 2 | + * Copyright 2024 Diligent Graphics LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + * |
| 16 | + * In no event and under no legal theory, whether in tort (including negligence), |
| 17 | + * contract, or otherwise, unless required by applicable law (such as deliberate |
| 18 | + * and grossly negligent acts) or agreed to in writing, shall any Contributor be |
| 19 | + * liable for any damages, including any direct, indirect, special, incidental, |
| 20 | + * or consequential damages of any character arising as a result of this License or |
| 21 | + * out of the use or inability to use the software (including but not limited to damages |
| 22 | + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and |
| 23 | + * all other commercial damages or losses), even if such Contributor has been advised |
| 24 | + * of the possibility of such damages. |
| 25 | + */ |
| 26 | + |
| 27 | +#pragma once |
| 28 | + |
| 29 | +/// \file |
| 30 | +/// Definition of the Diligent::ProxyPipelineState class |
| 31 | + |
| 32 | +#include "PipelineState.h" |
| 33 | +#include "RefCntAutoPtr.hpp" |
| 34 | + |
| 35 | +namespace Diligent |
| 36 | +{ |
| 37 | + |
| 38 | +/// Proxy pipeline state delegates all calls to the internal pipeline object. |
| 39 | + |
| 40 | +template <typename Base> |
| 41 | +class ProxyPipelineState : public Base |
| 42 | +{ |
| 43 | +public: |
| 44 | + template <typename... Args> |
| 45 | + ProxyPipelineState(Args&&... args) : |
| 46 | + Base{std::forward<Args>(args)...} |
| 47 | + {} |
| 48 | + |
| 49 | + virtual const PipelineStateDesc& DILIGENT_CALL_TYPE GetDesc() const override |
| 50 | + { |
| 51 | + return m_pPipeline->GetDesc(); |
| 52 | + } |
| 53 | + |
| 54 | + virtual Int32 DILIGENT_CALL_TYPE GetUniqueID() const override |
| 55 | + { |
| 56 | + return m_pPipeline->GetUniqueID(); |
| 57 | + } |
| 58 | + |
| 59 | + virtual void DILIGENT_CALL_TYPE SetUserData(IObject* pUserData) override |
| 60 | + { |
| 61 | + m_pPipeline->SetUserData(pUserData); |
| 62 | + } |
| 63 | + |
| 64 | + virtual IObject* DILIGENT_CALL_TYPE GetUserData() const override |
| 65 | + { |
| 66 | + return m_pPipeline->GetUserData(); |
| 67 | + } |
| 68 | + |
| 69 | + virtual const GraphicsPipelineDesc& DILIGENT_CALL_TYPE GetGraphicsPipelineDesc() const override |
| 70 | + { |
| 71 | + return m_pPipeline->GetGraphicsPipelineDesc(); |
| 72 | + } |
| 73 | + |
| 74 | + virtual const RayTracingPipelineDesc& DILIGENT_CALL_TYPE GetRayTracingPipelineDesc() const override |
| 75 | + { |
| 76 | + return m_pPipeline->GetRayTracingPipelineDesc(); |
| 77 | + } |
| 78 | + |
| 79 | + virtual const TilePipelineDesc& DILIGENT_CALL_TYPE GetTilePipelineDesc() const override |
| 80 | + { |
| 81 | + return m_pPipeline->GetTilePipelineDesc(); |
| 82 | + } |
| 83 | + |
| 84 | + virtual void DILIGENT_CALL_TYPE BindStaticResources(SHADER_TYPE ShaderStages, IResourceMapping* pResourceMapping, BIND_SHADER_RESOURCES_FLAGS Flags) override |
| 85 | + { |
| 86 | + m_pPipeline->BindStaticResources(ShaderStages, pResourceMapping, Flags); |
| 87 | + } |
| 88 | + |
| 89 | + virtual Uint32 DILIGENT_CALL_TYPE GetStaticVariableCount(SHADER_TYPE ShaderType) const override |
| 90 | + { |
| 91 | + return m_pPipeline->GetStaticVariableCount(ShaderType); |
| 92 | + } |
| 93 | + |
| 94 | + virtual IShaderResourceVariable* DILIGENT_CALL_TYPE GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name) override |
| 95 | + { |
| 96 | + return m_pPipeline->GetStaticVariableByName(ShaderType, Name); |
| 97 | + } |
| 98 | + |
| 99 | + virtual IShaderResourceVariable* DILIGENT_CALL_TYPE GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) override |
| 100 | + { |
| 101 | + return m_pPipeline->GetStaticVariableByIndex(ShaderType, Index); |
| 102 | + } |
| 103 | + |
| 104 | + virtual void DILIGENT_CALL_TYPE CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources) override |
| 105 | + { |
| 106 | + m_pPipeline->CreateShaderResourceBinding(ppShaderResourceBinding, InitStaticResources); |
| 107 | + } |
| 108 | + |
| 109 | + virtual void DILIGENT_CALL_TYPE InitializeStaticSRBResources(IShaderResourceBinding* pShaderResourceBinding) const override |
| 110 | + { |
| 111 | + m_pPipeline->InitializeStaticSRBResources(pShaderResourceBinding); |
| 112 | + } |
| 113 | + |
| 114 | + virtual void DILIGENT_CALL_TYPE CopyStaticResources(IPipelineState* pPSO) const override |
| 115 | + { |
| 116 | + m_pPipeline->CopyStaticResources(pPSO); |
| 117 | + } |
| 118 | + |
| 119 | + virtual bool DILIGENT_CALL_TYPE IsCompatibleWith(const IPipelineState* pPSO) const override |
| 120 | + { |
| 121 | + return m_pPipeline->IsCompatibleWith(pPSO); |
| 122 | + } |
| 123 | + |
| 124 | + virtual Uint32 DILIGENT_CALL_TYPE GetResourceSignatureCount() const override |
| 125 | + { |
| 126 | + return m_pPipeline->GetResourceSignatureCount(); |
| 127 | + } |
| 128 | + |
| 129 | + virtual IPipelineResourceSignature* DILIGENT_CALL_TYPE GetResourceSignature(Uint32 Index) const override |
| 130 | + { |
| 131 | + return m_pPipeline->GetResourceSignature(Index); |
| 132 | + } |
| 133 | + |
| 134 | + virtual PIPELINE_STATE_STATUS DILIGENT_CALL_TYPE GetStatus(bool WaitForCompletion) override |
| 135 | + { |
| 136 | + return m_pPipeline->GetStatus(WaitForCompletion); |
| 137 | + } |
| 138 | + |
| 139 | +protected: |
| 140 | + RefCntAutoPtr<IPipelineState> m_pPipeline; |
| 141 | +}; |
| 142 | + |
| 143 | +} // namespace Diligent |
0 commit comments