Draft
Conversation
Comment on lines
+1
to
+5
| #include "nbl/builtin/hlsl/cpp_compat.hlsl" | ||
|
|
||
| // Unfortunately not every piece of C++14 metaprogramming syntax is available in HLSL 202x | ||
| // https://github.com/microsoft/DirectXShaderCompiler/issues/5751#issuecomment-1800847954 | ||
| typedef nbl::hlsl::float32_t3 input_t; |
There was a problem hiding this comment.
remove files you're not using
66_PropertyPools/main.cpp
Outdated
Comment on lines
21
to
139
| // Virtual Inheritance because apps might end up doing diamond inheritance | ||
| class WindowedApplication : public virtual BasicMultiQueueApplication | ||
| { | ||
| using base_t = BasicMultiQueueApplication; | ||
|
|
||
| public: | ||
| using base_t::base_t; | ||
|
|
||
| virtual video::IAPIConnection::SFeatures getAPIFeaturesToEnable() override | ||
| { | ||
| auto retval = base_t::getAPIFeaturesToEnable(); | ||
| // We only support one swapchain mode, surface, the other one is Display which we have not implemented yet. | ||
| retval.swapchainMode = video::E_SWAPCHAIN_MODE::ESM_SURFACE; | ||
| return retval; | ||
| } | ||
|
|
||
| // New function, we neeed to know about surfaces to create ahead of time | ||
| virtual core::vector<video::SPhysicalDeviceFilter::SurfaceCompatibility> getSurfaces() const = 0; | ||
|
|
||
| virtual core::set<video::IPhysicalDevice*> filterDevices(const core::SRange<video::IPhysicalDevice* const>& physicalDevices) const | ||
| { | ||
| const auto firstFilter = base_t::filterDevices(physicalDevices); | ||
|
|
||
| video::SPhysicalDeviceFilter deviceFilter = {}; | ||
|
|
||
| const auto surfaces = getSurfaces(); | ||
| deviceFilter.requiredSurfaceCompatibilities = surfaces.data(); | ||
| deviceFilter.requiredSurfaceCompatibilitiesCount = surfaces.size(); | ||
|
|
||
| return deviceFilter(physicalDevices); | ||
| } | ||
|
|
||
| virtual bool onAppInitialized(smart_refctd_ptr<ISystem>&& system) | ||
| { | ||
| // Remember to call the base class initialization! | ||
| if (!base_t::onAppInitialized(std::move(system))) | ||
| return false; | ||
|
|
||
| #ifdef _NBL_PLATFORM_WINDOWS_ | ||
| m_winMgr = nbl::ui::IWindowManagerWin32::create(); | ||
| #else | ||
| #error "Unimplemented!" | ||
| #endif | ||
| } | ||
|
|
||
| core::smart_refctd_ptr<ui::IWindowManager> m_winMgr; | ||
| }; | ||
|
|
||
|
|
||
| // Before we get onto creating a window, we need to discuss how Nabla handles input, clipboards and cursor control | ||
| class IWindowClosedCallback : public virtual nbl::ui::IWindow::IEventCallback | ||
| { | ||
| public: | ||
| IWindowClosedCallback() : m_gotWindowClosedMsg(false) {} | ||
|
|
||
| // unless you create a separate callback per window, both will "trip" this condition | ||
| bool windowGotClosed() const {return m_gotWindowClosedMsg;} | ||
|
|
||
| private: | ||
| bool onWindowClosed_impl() override | ||
| { | ||
| m_gotWindowClosedMsg = true; | ||
| return true; | ||
| } | ||
|
|
||
| bool m_gotWindowClosedMsg; | ||
| }; | ||
|
|
||
| // We inherit from an application that tries to find Graphics and Compute queues | ||
| // because applications with presentable images often want to perform Graphics family operations | ||
| // Virtual Inheritance because apps might end up doing diamond inheritance | ||
| class SingleNonResizableWindowApplication : public virtual WindowedApplication | ||
| { | ||
| using base_t = WindowedApplication; | ||
|
|
||
| protected: | ||
| virtual IWindow::SCreationParams getWindowCreationParams() const | ||
| { | ||
| IWindow::SCreationParams params = {}; | ||
| params.callback = make_smart_refctd_ptr<IWindowClosedCallback>(); | ||
| params.width = 640; | ||
| params.height = 480; | ||
| params.x = 32; | ||
| params.y = 32; | ||
| params.flags = IWindow::ECF_NONE; | ||
| params.windowCaption = "SingleNonResizableWindowApplication"; | ||
| return params; | ||
| } | ||
|
|
||
| core::smart_refctd_ptr<ui::IWindow> m_window; | ||
| core::smart_refctd_ptr<video::ISurfaceVulkan> m_surface; | ||
|
|
||
| public: | ||
| using base_t::base_t; | ||
|
|
||
| virtual bool onAppInitialized(smart_refctd_ptr<nbl::system::ISystem>&& system) override | ||
| { | ||
| // Remember to call the base class initialization! | ||
| if (!base_t::onAppInitialized(std::move(system))) | ||
| return false; | ||
|
|
||
| m_window = m_winMgr->createWindow(getWindowCreationParams()); | ||
| m_surface = video::CSurfaceVulkanWin32::create(core::smart_refctd_ptr(m_api),core::smart_refctd_ptr_static_cast<ui::IWindowWin32>(m_window)); | ||
| return true; | ||
| } | ||
|
|
||
| virtual core::vector<video::SPhysicalDeviceFilter::SurfaceCompatibility> getSurfaces() const | ||
| { | ||
| return {{m_surface.get()/*,EQF_NONE*/}}; | ||
| } | ||
|
|
||
| virtual bool keepRunning() override | ||
| { | ||
| if (!m_window || reinterpret_cast<const IWindowClosedCallback*>(m_window->getEventCallback())->windowGotClosed()) | ||
| return false; | ||
|
|
||
| return true; | ||
| } | ||
| }; |
There was a problem hiding this comment.
make the example/test headless
66_PropertyPools/main.cpp
Outdated
Comment on lines
22
to
34
| // Virtual Inheritance because apps might end up doing diamond inheritance | ||
| class WindowedApplication : public virtual BasicMultiQueueApplication | ||
| { | ||
| using base_t = BasicMultiQueueApplication; | ||
|
|
||
| public: | ||
| using base_t::base_t; | ||
|
|
||
| virtual video::IAPIConnection::SFeatures getAPIFeaturesToEnable() override | ||
| { | ||
| auto retval = base_t::getAPIFeaturesToEnable(); | ||
| // We only support one swapchain mode, surface, the other one is Display which we have not implemented yet. | ||
| retval.swapchainMode = video::E_SWAPCHAIN_MODE::ESM_SURFACE; |
There was a problem hiding this comment.
why are you making a windowed application for this?
66_PropertyPools/main.cpp
Outdated
| smart_refctd_ptr<IGPUBuffer> m_transferDstBuffer; | ||
| std::vector<uint16_t> m_data; | ||
|
|
||
| smart_refctd_ptr<nbl::video::SubAllocatedDescriptorSet<core::GeneralpurposeAddressAllocator<uint32_t>>> m_subAllocDescriptorSet; |
There was a problem hiding this comment.
why are you conflating two examples/PRs into one?
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sister PR : Devsh-Graphics-Programming/Nabla#649