reconstruct setter complete
|
@ -6,7 +6,7 @@ set(NAME PlumageRender)
|
||||||
project(${NAME})
|
project(${NAME})
|
||||||
|
|
||||||
include_directories(external)
|
include_directories(external)
|
||||||
include_directories(external/glfw-3.4)
|
include_directories(external/glfw-3.4/include)
|
||||||
include_directories(external/glm)
|
include_directories(external/glm)
|
||||||
include_directories(external/gli)
|
include_directories(external/gli)
|
||||||
include_directories(external/imgui)
|
include_directories(external/imgui)
|
||||||
|
|
|
@ -36,7 +36,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageCallback(VkDebugReportFlagsEXT flags,
|
||||||
|
|
||||||
VkResult VulkanExampleBase::createInstance(bool enableValidation)
|
VkResult VulkanExampleBase::createInstance(bool enableValidation)
|
||||||
{
|
{
|
||||||
this->settings.validation = enableValidation;
|
setter.settings.validation = enableValidation;
|
||||||
|
|
||||||
// Validation can also be forced via a define
|
// Validation can also be forced via a define
|
||||||
#if defined(_VALIDATION)
|
#if defined(_VALIDATION)
|
||||||
|
@ -334,7 +334,7 @@ void VulkanExampleBase::renderFrame()
|
||||||
|
|
||||||
void VulkanExampleBase::renderLoop()
|
void VulkanExampleBase::renderLoop()
|
||||||
{
|
{
|
||||||
destWidth = width;
|
destWidth = settings.width;
|
||||||
destHeight = height;
|
destHeight = height;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
@ -500,28 +500,7 @@ void VulkanExampleBase::renderLoop()
|
||||||
|
|
||||||
VulkanExampleBase::VulkanExampleBase()
|
VulkanExampleBase::VulkanExampleBase()
|
||||||
{
|
{
|
||||||
char* numConvPtr;
|
|
||||||
// Parse command line arguments
|
|
||||||
for (size_t i = 0; i < args.size(); i++)
|
|
||||||
{
|
|
||||||
if (args[i] == std::string("-validation")) {
|
|
||||||
settings.validation = true;
|
|
||||||
}
|
|
||||||
if (args[i] == std::string("-vsync")) {
|
|
||||||
settings.vsync = true;
|
|
||||||
}
|
|
||||||
if ((args[i] == std::string("-f")) || (args[i] == std::string("--fullscreen"))) {
|
|
||||||
settings.fullscreen = true;
|
|
||||||
}
|
|
||||||
if ((args[i] == std::string("-w")) || (args[i] == std::string("--width"))) {
|
|
||||||
uint32_t w = strtol(args[i + 1], &numConvPtr, 10);
|
|
||||||
if (numConvPtr != args[i + 1]) { width = w; };
|
|
||||||
}
|
|
||||||
if ((args[i] == std::string("-h")) || (args[i] == std::string("--height"))) {
|
|
||||||
uint32_t h = strtol(args[i + 1], &numConvPtr, 10);
|
|
||||||
if (numConvPtr != args[i + 1]) { height = h; };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
// Vulkan library is loaded dynamically on Android
|
// Vulkan library is loaded dynamically on Android
|
||||||
|
@ -636,24 +615,6 @@ void VulkanExampleBase::initVulkan()
|
||||||
exit(err);
|
exit(err);
|
||||||
}
|
}
|
||||||
uint32_t selectedDevice = 0;
|
uint32_t selectedDevice = 0;
|
||||||
#if !defined(VK_USE_PLATFORM_ANDROID_KHR)
|
|
||||||
for (size_t i = 0; i < args.size(); i++) {
|
|
||||||
if ((args[i] == std::string("-g")) || (args[i] == std::string("--gpu"))) {
|
|
||||||
char* endptr;
|
|
||||||
selectedPhysicalDeviceIndex = strtol(args[i + 1], &endptr, 10);
|
|
||||||
if (endptr != args[i + 1]) {
|
|
||||||
if (selectedPhysicalDeviceIndex > gpuCount - 1) {
|
|
||||||
std::cerr << "Selected device index " << selectedPhysicalDeviceIndex << " is out of range, reverting to device 0 (use -listgpus to show available Vulkan devices)" << std::endl;
|
|
||||||
} else {
|
|
||||||
std::cout << "Selected Vulkan device " << selectedPhysicalDeviceIndex << std::endl;
|
|
||||||
selectedDevice = selectedPhysicalDeviceIndex;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
physicalDevice = physicalDevices[selectedDevice];
|
physicalDevice = physicalDevices[selectedDevice];
|
||||||
|
|
||||||
vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties);
|
vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties);
|
||||||
|
|
|
@ -101,7 +101,7 @@ protected:
|
||||||
std::string name = "vulkanExample";
|
std::string name = "vulkanExample";
|
||||||
void windowResize();
|
void windowResize();
|
||||||
public:
|
public:
|
||||||
static std::vector<const char*> args;
|
|
||||||
uint32_t selectedPhysicalDeviceIndex = 0;
|
uint32_t selectedPhysicalDeviceIndex = 0;
|
||||||
bool prepared = false;
|
bool prepared = false;
|
||||||
float frameTimer = 1.0f;
|
float frameTimer = 1.0f;
|
||||||
|
|
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 635 B After Width: | Height: | Size: 635 B |
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |