Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property pool hlsl #94

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft

Property pool hlsl #94

wants to merge 14 commits into from

Conversation

deprilula28
Copy link
Contributor

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;

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

Comment on lines 21 to 139
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;
}
};

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

@devshgraphicsprogramming devshgraphicsprogramming changed the base branch from master to vulkan_1_3 January 27, 2024 22:24
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;

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?

smart_refctd_ptr<IGPUBuffer> m_transferDstBuffer;
std::vector<uint16_t> m_data;

smart_refctd_ptr<nbl::video::SubAllocatedDescriptorSet<core::GeneralpurposeAddressAllocator<uint32_t>>> m_subAllocDescriptorSet;

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?

Base automatically changed from vulkan_1_3 to master March 20, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants