def main():
    pargs = parse_args()

    formats = list(format_parser.parse(pargs.csv))

    template_env = {
        'unorm_to_srgb_map': list(get_unorm_to_srgb_map(formats)),
        'rgbx_to_rgba_map': list(get_rgbx_to_rgba_map(formats)),
    }

    with open(pargs.out, 'w') as f:
        f.write(TEMPLATE.render(**template_env))
Beispiel #2
0
def main():
    pargs = parse_args()

    formats = list(format_parser.parse(pargs.csv))

    template_env = {
        'unorm_to_srgb_map': list(get_unorm_to_srgb_map(formats)),
        'intensity_to_red_map': list(get_intensity_to_red_map(formats)),
    }

    with open(pargs.out, 'w') as f:
        f.write(TEMPLATE.render(**template_env))
Beispiel #3
0
         bits = 16 if 'RGBA' in fmat.name else 8
         return bits if fmat.has_channel(chan_name) else 0
      elif fmat.layout == 'atc':
         return 8 if fmat.has_channel(chan_name) else 0
      elif fmat.layout == 'other' and ('RG_RB' in fmat.name or 'GR_BR' in fmat.name):
         return 8 if fmat.has_channel(chan_name) else 0
      else:
         assert False
   else:
      # Uncompressed textures
      for chan in fmat.channels:
         if chan.name == chan_name:
            return chan.size
      return 0

formats = parser.parse(sys.argv[1])

print('''
/*
 * Mesa 3-D graphics library
 *
 * Copyright (c) 2014 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
Beispiel #4
0
      elif fmat.layout == 'bptc':
         bits = 16 if fmat.name.endswith('_FLOAT') else 8
         return bits if fmat.has_channel(chan_name) else 0
      elif fmat.layout == 'astc':
         bits = 16 if 'RGBA' in fmat.name else 8
         return bits if fmat.has_channel(chan_name) else 0
      else:
         assert False
   else:
      # Uncompressed textures
      for chan in fmat.channels:
         if chan.name == chan_name:
            return chan.size
      return 0

formats = parser.parse(sys.argv[1])

print '''
/*
 * Mesa 3-D graphics library
 *
 * Copyright (c) 2014 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included