diff options
author | Nanley Chery <nanley.g.chery@intel.com> | 2015-07-23 10:49:10 -0700 |
---|---|---|
committer | Nanley Chery <nanley.g.chery@intel.com> | 2015-07-23 10:51:31 -0700 |
commit | 8889ad1de5d911b9430ffb33b5a6860d93835ade (patch) | |
tree | 902e680f25c6721570df58826829dd860a1d01af | |
parent | 6556675e7244302a4db86e077d965046f561bca1 (diff) |
array cleanups
-rw-r--r-- | gen_array.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/gen_array.c b/gen_array.c index ba12dd2..a605159 100644 --- a/gen_array.c +++ b/gen_array.c @@ -9,16 +9,6 @@ #include <waffle-1/waffle.h> #include "piglit_ktx.h" - -int -no_dot_output_filter (const struct dirent * dir_entity) -{ - return strlen(dir_entity->d_name) > 2 && - strstr(dir_entity->d_name, "waffles.ktx") == NULL && - strstr(dir_entity->d_name, ".ktx") != NULL && - strstr(dir_entity->d_name, "swp") == NULL; -} - void make_context() { /* Generate a context */ @@ -123,26 +113,22 @@ main(int argc, char *argv[]) GLuint tex[imgs]; glGenTextures(imgs, tex); for (cur_lev = 0; cur_lev < miplevels; ++cur_lev) { - int level_size = 0; + /* Read in the files into memory */ for (cur_img = 0; cur_img < imgs; ++cur_img) { - - char * cur_file = argv[cur_img+arg_offset]; - - /* Read in the files into memory */ if (cur_lev == 0) { + cur_file = argv[cur_img+arg_offset]; printf("%s\n", cur_file); GLenum my_gl_error; files[cur_img] = piglit_ktx_read_file(cur_file); piglit_ktx_load_texture(files[cur_img], &tex[cur_img], &my_gl_error); } - - - /* Get level size */ - w = (files[cur_img]->info.pixel_width >> cur_lev) ? (files[cur_img]->info.pixel_width >> cur_lev) : 1; - h = (files[cur_img]->info.pixel_height >> cur_lev) ? (files[cur_img]->info.pixel_height >> cur_lev) : 1; - expt = w*h*6; - level_size += piglit_ktx_get_image(files[cur_img], cur_lev, 0)->size; } + /* Get level size. All images have the same dimension */ + w = files[0]->info.pixel_width; + h = files[0]->info.pixel_height; + w = w >> cur_lev ? w >> cur_lev : 1; + h = h >> cur_lev ? h >> cur_lev : 1; + expt = w*h*6; /* Create the texture array */ img_info[cur_lev].size = expt*imgs; |