--- /dev/null
+custom: "https://www.paypal.me/GrandTetraSoftware"
#ifdef VKVG_TEST_DIRECT_DRAW
VkvgSurface* surfaces;
#endif
-_print_usage_and_exit () {
+void _print_usage_and_exit () {
printf("\nUsage: test [options]\n\n");
printf("\t-i iterations:\tSpecify the repeat count for the test.\n");
printf("\t-s size:\tWhen applicable, specify the size of the test.\n");
- printf("\t-w width:\tOutput surface width.\n");
- printf("\t-h height:\tOutput surface height.\n");
+ printf("\t-x width:\tOutput surface width.\n");
+ printf("\t-y height:\tOutput surface height.\n");
+ printf("\t-S num samples:\tOutput surface filter, default is 1.\n");
+ printf("\t-G gpu_type:\tSet prefered GPU type:\n");
+ printf("\t\t\t\t- 0: Other\n");
+ printf("\t\t\t\t- 1: Integrated\n");
+ printf("\t\t\t\t- 2: Discrete\n");
+ printf("\t\t\t\t- 3: Virtual\n");
+ printf("\t\t\t\t- 4: Cpu\n");
printf("\t-n index:\tRun only a single test, zero based index.\n");
printf("\t-q:\t\tQuiet, don't print measures table head row, usefull for batch tests\n");
printf("\t-p:\t\tPrint test details and exit without performing test, usefull to print details in logs\n");
exit(-1);
}
void _parse_args (int argc, char* argv[]) {
+ bool printTestDetailsAndExit = false;
for (int i = 1; i < argc; i++) {
- if (strcmp (argv[i], "-help\0") == 0)
+ if (strcmp (argv[i], "-h\0") == 0)
_print_usage_and_exit ();
- if (strcmp (argv[i], "-p\0") == 0) {
- #ifdef DEBUG
- printf("Debug build\n");
- #else
- printf("Release build\n");
- #endif
- #ifdef VKVG_USE_RENDERDOC
- printf("Render doc enabled\n");
- #endif
- #ifdef VKVG_USE_VALIDATION
- printf("Validation enabled\n");
- #endif
- printf("surf dims:\t%d x %d\n", test_width, test_height);
- printf("Samples:\t%d\n", samples);
- #ifdef VKVG_TEST_OFFSCREEN
- printf("Offscreen:\ttrue\n");
- #else
- printf("Offscreen:\ttrue\n");
- #endif
- printf("\n");
- exit(0);
- }
- if (strcmp (argv[i], "-vsync\0") == 0)
+ if (strcmp (argv[i], "-p\0") == 0)
+ printTestDetailsAndExit = true;
+ else if (strcmp (argv[i], "-vsync\0") == 0)
test_vsync = true;
else if (strcmp (argv[i], "-q\0") == 0)
quiet = true;
if (argc -1 < ++i)
_print_usage_and_exit();
iterations = atoi (argv[i]);
- }else if (strcmp (argv[i], "-w\0") == 0) {
+ }else if (strcmp (argv[i], "-x\0") == 0) {
if (argc -1 < ++i)
_print_usage_and_exit();
test_width = atoi (argv[i]);
- }else if (strcmp (argv[i], "-h\0") == 0) {
+ }else if (strcmp (argv[i], "-y\0") == 0) {
if (argc -1 < ++i)
_print_usage_and_exit();
test_height = atoi (argv[i]);
if (argc -1 < ++i)
_print_usage_and_exit();
test_size = atoi (argv[i]);
+ }else if (strcmp (argv[i], "-S\0") == 0) {
+ if (argc -1 < ++i)
+ _print_usage_and_exit();
+ samples = (VkSampleCountFlags)atoi (argv[i]);
+ }else if (strcmp (argv[i], "-g\0") == 0) {
+ if (argc -1 < ++i)
+ _print_usage_and_exit();
+ preferedPhysicalDeviceType = (VkPhysicalDeviceType)atoi (argv[i]);
+ }
+ if (printTestDetailsAndExit) {
+ #ifdef DEBUG
+ printf("Debug build\n");
+ #else
+ printf("Release build\n");
+ #endif
+ #ifdef VKVG_USE_RENDERDOC
+ printf("Render doc enabled\n");
+ #endif
+ #ifdef VKVG_USE_VALIDATION
+ printf("Validation enabled\n");
+ #endif
+ printf("surf dims:\t%d x %d\n", test_width, test_height);
+ printf("Samples:\t%d\n", samples);
+ printf("Gpu type:\t");
+ switch (preferedPhysicalDeviceType) {
+ case VK_PHYSICAL_DEVICE_TYPE_OTHER:
+ printf("Other\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
+ printf("Integrated\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
+ printf("Discrete\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
+ printf("Virtual\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_CPU:
+ printf("CPU\n");
+ break;
+ }
+
+ #ifdef VKVG_TEST_OFFSCREEN
+ printf("Offscreen:\ttrue\n");
+ #else
+ printf("Offscreen:\tfalse\n");
+ #endif
+ printf("\n");
+ exit(0);
}
}
}
VkhPhyInfo pi = 0;
for (uint32_t i=0; i<phyCount; i++){
pi = phys[i];
- if (pi->properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
+ if (pi->properties.deviceType == preferedPhysicalDeviceType)
break;
}
}
}
+
+
void vkengine_dump_available_layers () {
uint32_t layerCount;
vkEnumerateInstanceLayerProperties(&layerCount, NULL);
enabledExts[enabledExtsCount] = "VK_EXT_debug_utils";
enabledExtsCount++;
#endif
-
+ /*enabledExts[enabledExtsCount] = "VK_KHR_get_physical_device_properties2";
+ enabledExtsCount++;*/
e->app = vkh_app_create("vkvgTest", enabledLayersCount, enabledLayers, enabledExtsCount, enabledExts);
#if defined(DEBUG) && defined (VKVG_DBG_UTILS)
//| VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT
//| VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT
, VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT
- //cma| VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
+ //| VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
//| VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT
//| VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT
, NULL);
break;
}
- e->memory_properties = pi->memProps;
- e->gpu_props = pi->properties;
+ if (pi) {
+ e->memory_properties = pi->memProps;
+ e->gpu_props = pi->properties;
+ }
uint32_t qCount = 0;
float qPriorities[] = {0.0};
if (vkh_phyinfo_create_transfer_queues (pi, 1, qPriorities, &pQueueInfos[qCount]))
qCount++;*/
- char const * dex [] = {"VK_KHR_swapchain"};
- enabledExtsCount = 1;
+ enabledExtsCount=0;
+
+ enabledExts[enabledExtsCount] = "VK_KHR_swapchain";
+ enabledExtsCount++;
+
+ if (vkh_phyinfo_try_get_extension_properties(pi, "VK_EXT_blend_operation_advanced", NULL)) {
+ enabledExts[enabledExtsCount] = "VK_EXT_blend_operation_advanced";
+ enabledExtsCount++;
+ }
VkPhysicalDeviceFeatures enabledFeatures = {
.fillModeNonSolid = true,
.queueCreateInfoCount = qCount,
.pQueueCreateInfos = (VkDeviceQueueCreateInfo*)&pQueueInfos,
.enabledExtensionCount = enabledExtsCount,
- .ppEnabledExtensionNames = dex,
+ .ppEnabledExtensionNames = enabledExts,
.pEnabledFeatures = &enabledFeatures};
e->dev = vkh_device_create(e->app, pi, &device_info);
#include "test.h"
void test(){
- dash_offset += 0.1f;
+ dash_offset += 0.2f;
VkvgContext ctx = vkvg_create(surf);
vkvg_clear(ctx);
+ vkvg_set_source_rgb(ctx, 1, 1, 1);
+ vkvg_paint(ctx);
//const float dashes[] = {160.0f, 80};
- float dashes[] = {700.0f, 30};
- //const float dashes[] = {50, 40};
+ //float dashes[] = {7.0f, 3};
+ float dashes[] = {100, 20, 20, 20};
vkvg_set_line_cap(ctx, VKVG_LINE_CAP_ROUND);
- vkvg_set_dash(ctx, dashes, 2, dash_offset);
- vkvg_set_line_width(ctx, 20);
+ vkvg_set_line_join(ctx, VKVG_LINE_JOIN_ROUND);
+ vkvg_set_dash(ctx, dashes, 4, dash_offset);
+ vkvg_set_line_width(ctx, 4);
vkvg_set_source_rgb(ctx, 0, 0, 1);
- vkvg_move_to (ctx, 150, 50);
+ vkvg_move_to (ctx, 50, 50);
vkvg_rel_line_to (ctx, 500, 0);
vkvg_rel_line_to (ctx, 0, 200);
vkvg_rel_line_to (ctx, 200, 0);
vkvg_stroke (ctx);
dashes[0] = 0;
- dashes[1] = 30;
+ dashes[1] = 20;
vkvg_set_dash(ctx, dashes, 2, dash_offset);
vkvg_set_source_rgb(ctx, 0, 1, 0);
- vkvg_move_to (ctx, 200, 100);
+ vkvg_move_to (ctx, 100, 100);
vkvg_rel_line_to (ctx, 400, 0);
vkvg_rel_line_to (ctx, 0, 200);
vkvg_rel_line_to (ctx, 200, 0);
vkvg_close_path(ctx);
vkvg_stroke (ctx);
+ dashes[0] = 80;
+ dashes[1] = 20;
+
+ vkvg_set_line_width(ctx, 10);
+ vkvg_set_source_rgb(ctx, 1, 0, 0);
+
+ vkvg_set_dash(ctx, dashes, 2, dash_offset);
+
+ vkvg_rectangle(ctx, 200,300,200,200);
+ /*vkvg_move_to(ctx, 200,300);
+ vkvg_rel_line_to(ctx,200,0);*/
+ vkvg_stroke (ctx);
+
vkvg_destroy(ctx);
}
}
void _long_path() {
- float w = (float)test_width-10;
- float h = (float)test_height-10;
-
- VkvgContext ctx = _initCtx();
-
- randomize_color(ctx);
- float x1 = w*rndf();
- float y1 = h*rndf();
- vkvg_move_to (ctx, x1, y1);
- for (uint32_t i=0; i<test_size; i++) {
- x1 = w*rndf();
- y1 = h*rndf();
- vkvg_line_to (ctx, x1, y1);
- }
- vkvg_stroke (ctx);
- vkvg_destroy(ctx);
+ float w = (float)test_width-10;
+ float h = (float)test_height-10;
+
+ VkvgContext ctx = _initCtx();
+
+ randomize_color(ctx);
+ float x1 = w*rndf();
+ float y1 = h*rndf();
+ vkvg_move_to (ctx, x1, y1);
+ for (uint32_t i=0; i<test_size; i++) {
+ x1 = w*rndf();
+ y1 = h*rndf();
+ vkvg_line_to (ctx, x1, y1);
+ }
+ vkvg_stroke (ctx);
+ vkvg_destroy(ctx);
}
void path () {
//PERFORM_TEST(test, argc, argv);
//vkvg_log_level = VKVG_LOG_ERR|VKVG_LOG_DEBUG|VKVG_LOG_INFO|VKVG_LOG_INFO_PATH|VKVG_LOG_DBG_ARRAYS|VKVG_LOG_FULL;
dashes_count = 2;
- dashes[0] = 2;
- dashes[1] = 3;
- line_width = 2;
+ dashes[0] = 0;
+ dashes[1] = 10;
+ line_width = 4;
+ //test_size = 50;
line_cap = VKVG_LINE_CAP_ROUND;
+ PERFORM_TEST(test, argc, argv);
PERFORM_TEST(path, argc, argv);
- //PERFORM_TEST(curve, argc, argv);
+ PERFORM_TEST(curve, argc, argv);
return 0;
}
vkvg_rel_line_to(ctx,-190,-50);
vkvg_close_path(ctx);
- vkvg_stroke(ctx);
+ vkvg_fill(ctx);
vkvg_destroy(ctx);
}