LCOV - code coverage report
Current view: top level - xenolith/backend/vkgui - XLVkGuiApplication.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2024-05-12 00:16:13 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /**
       2             :  Copyright (c) 2023 Stappler LLC <admin@stappler.dev>
       3             : 
       4             :  Permission is hereby granted, free of charge, to any person obtaining a copy
       5             :  of this software and associated documentation files (the "Software"), to deal
       6             :  in the Software without restriction, including without limitation the rights
       7             :  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       8             :  copies of the Software, and to permit persons to whom the Software is
       9             :  furnished to do so, subject to the following conditions:
      10             : 
      11             :  The above copyright notice and this permission notice shall be included in
      12             :  all copies or substantial portions of the Software.
      13             : 
      14             :  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      15             :  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      16             :  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      17             :  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      18             :  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      19             :  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      20             :  THE SOFTWARE.
      21             :  **/
      22             : 
      23             : #ifndef XENOLITH_BACKEND_VKGUI_XLVKGUIAPPLICATION_H_
      24             : #define XENOLITH_BACKEND_VKGUI_XLVKGUIAPPLICATION_H_
      25             : 
      26             : #include "XLApplication.h"
      27             : #include "XLVkGuiConfig.h"
      28             : #include "XLVkPlatform.h"
      29             : #include "XLVkView.h"
      30             : 
      31             : #include "XLViewCommandLine.h"
      32             : #include "XLStorageServer.h"
      33             : #include "XLNetworkController.h"
      34             : #include "XLAssetLibrary.h"
      35             : 
      36             : namespace STAPPLER_VERSIONIZED stappler::xenolith::vk {
      37             : 
      38             : class GuiApplication : public Application {
      39             : public:
      40             :         using VulkanInstanceData = platform::VulkanInstanceData;
      41             :         using VulkanInstanceInfo = platform::VulkanInstanceInfo;
      42             : 
      43             :         virtual ~GuiApplication();
      44             : 
      45             :         virtual bool init(CommonInfo &&, Rc<core::Instance> && = nullptr);
      46             :         virtual bool init(CommonInfo &&, const Callback<bool(VulkanInstanceData &, const VulkanInstanceInfo &)> &);
      47             : 
      48             :         virtual void run(const CallbackInfo &, uint32_t threadsCount = config::getMainThreadCount(),
      49             :                         TimeInterval = TimeInterval(config::GuiMainLoopDefaultInterval));
      50             :         virtual void run(const CallbackInfo &, core::LoopInfo &&, uint32_t threadsCount = config::getMainThreadCount(),
      51             :                         TimeInterval = TimeInterval(config::GuiMainLoopDefaultInterval));
      52             : };
      53             : 
      54             : class BootstrapApplication : public GuiApplication {
      55             : public:
      56             :         static EventHeader onSwapchainConfig;
      57             : 
      58           0 :         virtual ~BootstrapApplication() = default;
      59             : 
      60             :         virtual bool init(ViewCommandLineData &&, void *native = nullptr);
      61             : 
      62             :         virtual void run(Function<void()> &&initCb = nullptr);
      63             : 
      64             :         const core::SurfaceInfo &getSurfaceInfo() const { return _surfaceInfo; }
      65             :         const core::SwapchainConfig &getSwapchainConfig() const { return _swapchainConfig; }
      66             : 
      67             :         void setPreferredPresentMode(core::PresentMode);
      68             : 
      69             : protected:
      70             :         virtual Rc<Scene> createSceneForView(vk::View &view, const core::FrameContraints &constraints);
      71             :         virtual void finalizeView(vk::View &view);
      72             : 
      73             :         virtual core::SwapchainConfig selectConfig(vk::View &, const core::SurfaceInfo &info);
      74             : 
      75             :         Value _storageParams;
      76             : 
      77             :         ViewCommandLineData _data;
      78             : 
      79             :         Mutex _configMutex;
      80             :         core::PresentMode _preferredPresentMode = core::PresentMode::Unsupported;
      81             : 
      82             :         core::SurfaceInfo _surfaceInfo;
      83             :         core::SwapchainConfig _swapchainConfig;
      84             : 
      85             : #if MODULE_XENOLITH_RESOURCES_NETWORK
      86             : public:
      87             :         xenolith::network::Controller *getNetworkController() const { return _networkController; }
      88             : protected:
      89             :         Rc<xenolith::network::Controller> _networkController;
      90             : #endif
      91             : 
      92             : #if MODULE_XENOLITH_RESOURCES_STORAGE
      93             : public:
      94             :         xenolith::storage::Server *getStorageServer() const { return _storageServer; }
      95             : protected:
      96             :         Rc<xenolith::storage::Server> _storageServer;
      97             : #endif
      98             : 
      99             : #if MODULE_XENOLITH_RESOURCES_STORAGE
     100             : public:
     101             :         xenolith::storage::AssetLibrary *getAssetLibrary() const { return _assetLibrary; }
     102             : protected:
     103             :         Rc<xenolith::storage::AssetLibrary> _assetLibrary;
     104             : #endif
     105             : };
     106             : 
     107             : }
     108             : 
     109             : #endif /* XENOLITH_BACKEND_VKGUI_XLVKGUIAPPLICATION_H_ */

Generated by: LCOV version 1.14