Skip to content

Commit 40f9051

Browse files
Refactor super-resolution factory to use one subclass per device type
1 parent 4b9cddf commit 40f9051

File tree

5 files changed

+234
-244
lines changed

5 files changed

+234
-244
lines changed

Graphics/SuperResolution/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ project(Diligent-SuperResolution CXX)
66

77
set(INCLUDE
88
include/SuperResolutionBase.hpp
9-
include/SuperResolutionInternal.hpp
9+
include/SuperResolutionFactoryBase.hpp
1010
)
1111

1212
set(INTERFACE
@@ -16,11 +16,15 @@ set(INTERFACE
1616
)
1717

1818
set(SOURCE
19-
src/SuperResolutionFactory.cpp
19+
src/SuperResolutionFactoryBase.cpp
2020
)
2121

2222
if(D3D12_SUPPORTED)
23-
list(APPEND SOURCE src/SuperResolution_D3D12.cpp)
23+
list(APPEND
24+
SOURCE
25+
src/SuperResolution_D3D12.cpp
26+
src/SuperResolutionFactoryD3D12.cpp
27+
)
2428
endif()
2529

2630
set(DLL_SOURCE

Graphics/SuperResolution/include/SuperResolutionInternal.hpp renamed to Graphics/SuperResolution/include/SuperResolutionFactoryBase.hpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,34 @@
2727
#pragma once
2828

2929
#include "SuperResolutionFactory.h"
30+
#include "ObjectBase.hpp"
31+
#include "RefCntAutoPtr.hpp"
3032

31-
#include <array>
3233
#include <vector>
3334

3435
namespace Diligent
3536
{
3637

37-
enum SUPER_RESOLUTION_BACKEND : Uint8
38+
class SuperResolutionFactoryBase : public ObjectBase<ISuperResolutionFactory>
3839
{
39-
SUPER_RESOLUTION_BACKEND_D3D12_DSR,
40-
SUPER_RESOLUTION_BACKEND_METAL_FX,
41-
SUPER_RESOLUTION_BACKEND_SOFTWARE,
42-
SUPER_RESOLUTION_BACKEND_COUNT
43-
};
40+
public:
41+
using TBase = ObjectBase<ISuperResolutionFactory>;
42+
43+
SuperResolutionFactoryBase(IReferenceCounters* pRefCounters, IRenderDevice* pDevice);
44+
45+
IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_SuperResolutionFactory, TBase)
46+
47+
virtual void DILIGENT_CALL_TYPE EnumerateVariants(Uint32& NumVariants, SuperResolutionInfo* Variants) override final;
4448

45-
using SuperResolutionVariants = std::array<std::vector<SuperResolutionInfo>, SUPER_RESOLUTION_BACKEND_COUNT>;
49+
virtual void DILIGENT_CALL_TYPE SetMessageCallback(DebugMessageCallbackType MessageCallback) const override final;
50+
51+
virtual void DILIGENT_CALL_TYPE SetBreakOnError(bool BreakOnError) const override final;
52+
53+
virtual void DILIGENT_CALL_TYPE SetMemoryAllocator(IMemoryAllocator* pAllocator) const override final;
54+
55+
private:
56+
RefCntAutoPtr<IRenderDevice> m_pDevice;
57+
std::vector<SuperResolutionInfo> m_Variants{};
58+
};
4659

4760
} // namespace Diligent

Graphics/SuperResolution/src/SuperResolutionFactory.cpp

Lines changed: 0 additions & 233 deletions
This file was deleted.

0 commit comments

Comments
 (0)