1
+ // Copyright (C) 2018-2024 - DevSH Graphics Programming Sp. z O.O.
2
+ // This file is part of the "Nabla Engine".
3
+ // For conditions of distribution and use, see copyright notice in nabla.h
4
+ #include " nbl/application_templates/MonoAssetManagerAndBuiltinResourceApplication.hpp"
5
+ #include " ../common/SimpleWindowedApplication.hpp"
6
+
7
+ #include " nbl/video/surface/CSurfaceVulkan.h"
8
+
9
+ using namespace nbl ;
10
+ using namespace core ;
11
+ using namespace hlsl ;
12
+ using namespace system ;
13
+ using namespace asset ;
14
+ using namespace ui ;
15
+ using namespace video ;
16
+
17
+ // #include "app_resources/push_constants.hlsl"
18
+
19
+ class AutoexposureApp final : public examples::SimpleWindowedApplication, public application_templates::MonoAssetManagerAndBuiltinResourceApplication
20
+ {
21
+ using device_base_t = examples::SimpleWindowedApplication;
22
+ using asset_base_t = application_templates::MonoAssetManagerAndBuiltinResourceApplication;
23
+ using clock_t = std::chrono::steady_clock;
24
+
25
+ public:
26
+ // Yay thanks to multiple inheritance we cannot forward ctors anymore
27
+ inline AutoexposureApp (const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD) :
28
+ IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {}
29
+
30
+ // Will get called mid-initialization, via `filterDevices` between when the API Connection is created and Physical Device is chosen
31
+ inline core::vector<video::SPhysicalDeviceFilter::SurfaceCompatibility> getSurfaces () const override
32
+ {
33
+ // So let's create our Window and Surface then!
34
+ if (!m_surface)
35
+ {
36
+ {
37
+ IWindow::SCreationParams params = {};
38
+ params.callback = core::make_smart_refctd_ptr<nbl::video::ISimpleManagedSurface::ICallback>();
39
+ params.width = 256 ;
40
+ params.height = 256 ;
41
+ params.x = 32 ;
42
+ params.y = 32 ;
43
+ // Don't want to have a window lingering about before we're ready so create it hidden.
44
+ // Only programmatic resize, not regular.
45
+ params.flags = ui::IWindow::ECF_HIDDEN | IWindow::ECF_BORDERLESS | IWindow::ECF_RESIZABLE;
46
+ params.windowCaption = " AutoexposureApp" ;
47
+ const_cast <std::remove_const_t <decltype (m_window)>&>(m_window) = m_winMgr->createWindow (std::move (params));
48
+ }
49
+ auto surface = CSurfaceVulkanWin32::create (smart_refctd_ptr (m_api), smart_refctd_ptr_static_cast<IWindowWin32>(m_window));
50
+ const_cast <std::remove_const_t <decltype (m_surface)>&>(m_surface) = nbl::video::CSimpleResizeSurface<nbl::video::CDefaultSwapchainFramebuffers>::create (std::move (surface));
51
+ }
52
+ if (m_surface)
53
+ return { {m_surface->getSurface ()/* ,EQF_NONE*/ } };
54
+ return {};
55
+ }
56
+
57
+ inline bool onAppInitialized (smart_refctd_ptr<ISystem>&& system) override
58
+ {
59
+ // Remember to call the base class initialization!
60
+ if (!device_base_t::onAppInitialized (smart_refctd_ptr (system)))
61
+ return false ;
62
+ if (!asset_base_t::onAppInitialized (std::move (system)))
63
+ return false ;
64
+
65
+ return true ;
66
+ }
67
+
68
+ // We do a very simple thing, display an image and wait `DisplayImageMs` to show it
69
+ inline void workLoopBody () override
70
+ {
71
+ }
72
+
73
+ inline bool keepRunning () override
74
+ {
75
+ return false ;
76
+ }
77
+
78
+ inline bool onAppTerminated () override
79
+ {
80
+ return device_base_t::onAppTerminated ();
81
+ }
82
+
83
+ protected:
84
+ smart_refctd_ptr<IWindow> m_window;
85
+ smart_refctd_ptr<CSimpleResizeSurface<CDefaultSwapchainFramebuffers>> m_surface;
86
+ };
87
+
88
+ NBL_MAIN_FUNC (AutoexposureApp)
89
+
90
+ #if 0
91
+
1
92
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
2
93
// This file is part of the "Nabla Engine".
3
94
// For conditions of distribution and use, see copyright notice in nabla.h
@@ -174,4 +265,6 @@ int main()
174
265
}
175
266
176
267
return 0;
177
- }
268
+ }
269
+
270
+ #endif
0 commit comments