Vulkan-Samples
Vulkan-Samples copied to clipboard
Dynamic Runtime Samples
Description
There is a high chance that we want to reuse cross platform components in many executables. CUSTOM_MAIN aims to reduce duplication of a cross platform main.
CUSTOM_MAIN(context)
{
// _default is a temporary pattern, this is likely to be replaced in the future
auto window = windows::_default(context, "A Window"); // < window platform default
auto fs = vfs::_default(context); // < virtual fs platform default
auto camera = cameras::_default(context); // < get a devices camera AR?
}
Adds sample_main(context). Works similar to a normal main function except it hides the cross platform support.
The minimum code needed for a sample is
#include "components/platform/sample_main.hpp"
#include <iostream>
int sample_main(const components::PlatformContext *context)
{
return true;
}
Later a Sample Launcher will read library paths and sample info from a JSON file. Allow the user to select a sample to run and then run the sample by loading the dynamic library and calling sample_main. We can extend this to allow for CLI configuration and more.
Closed #488 as this PR includes its changes. Updated description