diff options
| author | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-02-25 11:46:58 -0700 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-02-25 17:15:47 -0700 |
| commit | e88f99c1c0f693cc2c15f0a4d56537251124fc61 (patch) | |
| tree | a7af447d20085fe8f412104bf641b887972f3b1c | |
| parent | b4fc0074ffbdfaca67b12a25a473d6017c4fccec (diff) | |
| download | usermoji-e88f99c1c0f693cc2c15f0a4d56537251124fc61.tar.xz | |
demos: Add use_staging option
Specifying --use_staging as a command line argument to tri
will force tri to upload the texture via a linear mapped staging buffer.
| -rw-r--r-- | demos/tri.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/demos/tri.c b/demos/tri.c index d77d7739..e497c670 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -96,6 +96,7 @@ struct demo { #endif bool quit; + bool use_staging_buffer; uint32_t current_buffer; }; @@ -533,7 +534,7 @@ static void demo_prepare_textures(struct demo *demo) assert(!err); for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { - if (props.linearTilingFeatures & XGL_FORMAT_IMAGE_SHADER_READ_BIT) { + if ((props.linearTilingFeatures & XGL_FORMAT_IMAGE_SHADER_READ_BIT) && !demo->use_staging_buffer) { /* Device can texture using linear textures */ demo_prepare_texture_image(demo, tex_colors[i], &demo->textures[i], XGL_LINEAR_TILING, XGL_MEMORY_PROPERTY_CPU_VISIBLE_BIT); @@ -1275,10 +1276,15 @@ static void demo_init_connection(struct demo *demo) #endif } -static void demo_init(struct demo *demo) +static void demo_init(struct demo *demo, const int argc, const char *argv[]) { memset(demo, 0, sizeof(*demo)); + for (int i = 0; i < argc; i++) { + if (strncmp(argv[i], "--use_staging", strlen("--use_staging")) == 0) + demo->use_staging_buffer = true; + } + demo_init_connection(demo); demo_init_xgl(demo); @@ -1341,11 +1347,11 @@ static void demo_cleanup(struct demo *demo) #endif } -int main(void) +int main(const int argc, const char *argv[]) { struct demo demo; - demo_init(&demo); + demo_init(&demo, argc, argv); demo_prepare(&demo); demo_create_window(&demo); |
