|
| 1 | +/* |
| 2 | + * Copyright 2026 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 | +/// Declaration of Diligent::SuperResolutionD3D12Impl class |
| 31 | + |
| 32 | +#include "EngineD3D12ImplTraits.hpp" |
| 33 | +#include "DeviceObjectBase.hpp" |
| 34 | +#include "SuperResolution.h" |
| 35 | + |
| 36 | +#include <vector> |
| 37 | + |
| 38 | + |
| 39 | +namespace Diligent |
| 40 | +{ |
| 41 | + |
| 42 | +class DeviceContextD3D12Impl; |
| 43 | + |
| 44 | +/// Implementation of the ISuperResolution interface for Direct3D12 backend using DirectSR. |
| 45 | +class SuperResolutionD3D12Impl final : public DeviceObjectBase<ISuperResolution, RenderDeviceD3D12Impl, SuperResolutionDesc> |
| 46 | +{ |
| 47 | +public: |
| 48 | + using TSRUpscalerBase = DeviceObjectBase<ISuperResolution, RenderDeviceD3D12Impl, SuperResolutionDesc>; |
| 49 | + |
| 50 | + SuperResolutionD3D12Impl(IReferenceCounters* pRefCounters, |
| 51 | + RenderDeviceD3D12Impl* pDevice, |
| 52 | + const SuperResolutionDesc& Desc); |
| 53 | + |
| 54 | + ~SuperResolutionD3D12Impl(); |
| 55 | + |
| 56 | + IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_SuperResolution, TSRUpscalerBase) |
| 57 | + |
| 58 | + /// Implementation of ISuperResolution::GetOptimalJitterPattern(). |
| 59 | + virtual void DILIGENT_CALL_TYPE GetOptimalJitterPattern(Uint32 Index, float* pJitterX, float* pJitterY) const override final; |
| 60 | + |
| 61 | + /// Encodes the upscaling operation. |
| 62 | + void Execute(DeviceContextD3D12Impl& Ctx, const ExecuteSuperResolutionAttribs& Attribs); |
| 63 | + |
| 64 | +private: |
| 65 | + CComPtr<IDSRSuperResEngine> m_pDSREngine; |
| 66 | + std::vector<CComPtr<IDSRSuperResUpscaler>> m_DSRUpscalers; |
| 67 | + std::vector<DSR_FLOAT2> m_JitterPattern; |
| 68 | +}; |
| 69 | + |
| 70 | +} // namespace Diligent |
0 commit comments