| 1086 | } |
| 1087 | |
| 1088 | void Demo::init(int argc, char **argv) { |
| 1089 | vec3 eye = {0.0f, 3.0f, 5.0f}; |
| 1090 | vec3 origin = {0, 0, 0}; |
| 1091 | vec3 up = {0.0f, 1.0f, 0.0}; |
| 1092 | |
| 1093 | presentMode = vk::PresentModeKHR::eFifo; |
| 1094 | frameCount = UINT32_MAX; |
| 1095 | width = 500; |
| 1096 | height = 500; |
| 1097 | /* Autodetect suitable / best GPU by default */ |
| 1098 | gpu_number = -1; |
| 1099 | |
| 1100 | for (int i = 1; i < argc; i++) { |
| 1101 | if (strcmp(argv[i], "--use_staging") == 0) { |
| 1102 | use_staging_buffer = true; |
| 1103 | continue; |
| 1104 | } |
| 1105 | if ((strcmp(argv[i], "--present_mode") == 0) && (i < argc - 1)) { |
| 1106 | presentMode = static_cast<vk::PresentModeKHR>(atoi(argv[i + 1])); |
| 1107 | i++; |
| 1108 | continue; |
| 1109 | } |
| 1110 | if (strcmp(argv[i], "--break") == 0) { |
| 1111 | use_break = true; |
| 1112 | continue; |
| 1113 | } |
| 1114 | if (strcmp(argv[i], "--validate") == 0) { |
| 1115 | validate = true; |
| 1116 | continue; |
| 1117 | } |
| 1118 | if (strcmp(argv[i], "--xlib") == 0) { |
| 1119 | fprintf(stderr, "--xlib is deprecated and no longer does anything\n"); |
| 1120 | continue; |
| 1121 | } |
| 1122 | if (strcmp(argv[i], "--c") == 0 && frameCount == UINT32_MAX && i < argc - 1 && |
| 1123 | sscanf(argv[i + 1], "%" SCNu32, &frameCount) == 1) { |
| 1124 | i++; |
| 1125 | continue; |
| 1126 | } |
| 1127 | if (strcmp(argv[i], "--width") == 0) { |
| 1128 | int32_t in_width = 0; |
| 1129 | if (i < argc - 1 && sscanf(argv[i + 1], "%d", &in_width) == 1) { |
| 1130 | if (in_width > 0) { |
| 1131 | width = static_cast<uint32_t>(in_width); |
| 1132 | i++; |
| 1133 | continue; |
| 1134 | } else { |
| 1135 | ERR_EXIT("The --width parameter must be greater than 0", "User Error"); |
| 1136 | } |
| 1137 | } |
| 1138 | ERR_EXIT("The --width parameter must be followed by a number", "User Error"); |
| 1139 | } |
| 1140 | if (strcmp(argv[i], "--height") == 0) { |
| 1141 | int32_t in_height = 0; |
| 1142 | if (i < argc - 1 && sscanf(argv[i + 1], "%d", &in_height) == 1) { |
| 1143 | if (in_height > 0) { |
| 1144 | height = static_cast<uint32_t>(in_height); |
| 1145 | i++; |
no test coverage detected