-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Property pool hlsl #94
base: master
Are you sure you want to change the base?
Conversation
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove files you're not using
66_PropertyPools/main.cpp
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make the example/test headless
66_PropertyPools/main.cpp
Outdated
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you conflating two examples/PRs into one?
Sister PR : Devsh-Graphics-Programming/Nabla#649