diff options
| author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2026-03-31 02:02:54 +0200 |
|---|---|---|
| committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2026-03-31 02:02:54 +0200 |
| commit | 1cd52970d52abbb71a60ba63931729f823d41501 (patch) | |
| tree | fa7e0a0d2163e4e09a1b5461d47ea9bc29e2aa1a /tools/Vulkan-Tools/cube/cube.c | |
| parent | 7716eebaaeaccc4f145a0670280dd8fcdf096e6b (diff) | |
| download | usermoji-1cd52970d52abbb71a60ba63931729f823d41501.tar.xz | |
vkcube: add --texture parameter
Diffstat (limited to 'tools/Vulkan-Tools/cube/cube.c')
| -rw-r--r-- | tools/Vulkan-Tools/cube/cube.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/Vulkan-Tools/cube/cube.c b/tools/Vulkan-Tools/cube/cube.c index 29946c90..b67e31c2 100644 --- a/tools/Vulkan-Tools/cube/cube.c +++ b/tools/Vulkan-Tools/cube/cube.c @@ -157,8 +157,6 @@ struct texture_object { int32_t tex_width, tex_height; }; -static char *tex_files[] = {"lunarg.ppm"}; - static int validation_error = 0; struct vktexcube_vs_uniform { @@ -523,6 +521,7 @@ struct demo { VkImageView view; } depth; + char *tex_file; struct texture_object textures[DEMO_TEXTURE_COUNT]; struct texture_object staging_texture; @@ -1905,7 +1904,7 @@ static void demo_prepare_textures(struct demo *demo) { if ((props.linearTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) && !demo->use_staging_buffer) { demo_push_cb_label(demo, demo->cmd, NULL, "DirectTexture(%u)", i); /* Device can texture using linear textures */ - demo_prepare_texture_image(demo, tex_files[i], &demo->textures[i], VK_IMAGE_TILING_LINEAR, VK_IMAGE_USAGE_SAMPLED_BIT, + demo_prepare_texture_image(demo, demo->tex_file, &demo->textures[i], VK_IMAGE_TILING_LINEAR, VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); // Nothing in the pipeline needs to be complete to start, and don't allow fragment // shader to run until layout transition completes @@ -1919,9 +1918,9 @@ static void demo_prepare_textures(struct demo *demo) { demo_push_cb_label(demo, demo->cmd, NULL, "StagingTexture(%u)", i); memset(&demo->staging_texture, 0, sizeof(demo->staging_texture)); - demo_prepare_texture_buffer(demo, tex_files[i], &demo->staging_texture); + demo_prepare_texture_buffer(demo, demo->tex_file, &demo->staging_texture); - demo_prepare_texture_image(demo, tex_files[i], &demo->textures[i], VK_IMAGE_TILING_OPTIMAL, + demo_prepare_texture_image(demo, demo->tex_file, &demo->textures[i], VK_IMAGE_TILING_OPTIMAL, (VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT), VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); @@ -4720,6 +4719,7 @@ static void demo_init(struct demo *demo, int argc, char **argv) { demo->gpu_number = -1; demo->width = 500; demo->height = 500; + demo->tex_file = "lunarg.ppm"; for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "--use_staging") == 0) { @@ -4810,6 +4810,15 @@ static void demo_init(struct demo *demo, int argc, char **argv) { i++; continue; } + if (strcmp(argv[i], "--texture") == 0) { + if (i < argc - 1) { + demo->tex_file = argv[i + 1]; + i++; + continue; + } + ERR_EXIT("The --texture parameter must be followed by a string", "User Error"); + } + #if defined(ANDROID) ERR_EXIT("Usage: vkcube [--validate]\n", "Usage"); #else @@ -4879,6 +4888,7 @@ static void demo_init(struct demo *demo, int argc, char **argv) { "\t[--present_mode <present mode enum>]\n" "\t[--width <width>] [--height <height>]\n" "\t[--force_errors]\n" + "\t[--texture <filename>]\n" "\t[--wsi <%s>]\n" "\t<present_mode_enum>\n" "\t\tVK_PRESENT_MODE_IMMEDIATE_KHR = %d\n" |
