Home | History | Annotate | Download | only in u32
      1 /*
      2  * Copyright 2016 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can
      5  * be found in the LICENSE file.
      6  *
      7  */
      8 
      9 //
     10 //
     11 //
     12 
     13 #include "hs_target.h"
     14 #include "hs_config.h"
     15 
     16 //
     17 //
     18 //
     19 
     20 struct hs_vk_target const HS_TARGET_NAME =
     21 {
     22   .config = {
     23     .slab = {
     24       .threads_log2 = HS_SLAB_THREADS_LOG2,
     25       .width_log2   = HS_SLAB_WIDTH_LOG2,
     26       .height       = HS_SLAB_HEIGHT
     27     },
     28 
     29     .words = {
     30       .key          = HS_KEY_WORDS,
     31       .val          = HS_VAL_WORDS
     32     },
     33 
     34     .block = {
     35       .slabs        = HS_BS_SLABS
     36     },
     37 
     38     .merge = {
     39       .fm = {
     40         .scale_min  = HS_FM_SCALE_MIN,
     41         .scale_max  = HS_FM_SCALE_MAX
     42       },
     43       .hm = {
     44         .scale_min  = HS_HM_SCALE_MIN,
     45         .scale_max  = HS_HM_SCALE_MAX,
     46       }
     47     },
     48 
     49     .pad = { 0 }
     50   },
     51 
     52   .modules = {
     53 
     54 #include "hs_modules.h"
     55 
     56 #ifdef HS_DUMP
     57     0,0,0,0
     58 #endif
     59   }
     60 };
     61 
     62 //
     63 //
     64 //
     65 
     66 #ifdef HS_DUMP
     67 
     68 #include <stdlib.h>
     69 #include <stdio.h>
     70 
     71 int
     72 main(int argc, char const * argv[])
     73 {
     74   FILE * fp = fopen("hs_target.bin","wb");
     75 
     76   fwrite(&HS_TARGET_NAME.config,1,sizeof(HS_TARGET_NAME.config),fp);
     77 
     78   uint8_t const * modules = HS_TARGET_NAME.modules;
     79   size_t          modsize = (modules[0]<<24) | (modules[1]<<16) | (modules[2]<<8) | modules[3];
     80 
     81   while (modsize > 0) {
     82     // fprintf(stderr,"%zu\n",modsize);
     83     modsize += sizeof(uint32_t);
     84     fwrite(modules,1,modsize,fp);
     85     modules += modsize;
     86     modsize  = (modules[0]<<24) | (modules[1]<<16) | (modules[2]<<8) | modules[3];
     87   }
     88 
     89   fclose(fp);
     90 
     91   return EXIT_SUCCESS;
     92 }
     93 
     94 #endif
     95 
     96 //
     97 //
     98 //
     99