• Home
  • Raw
  • Download

Lines Matching refs:fmat

28 def get_gl_base_format(fmat):  argument
29 if fmat.name == 'MESA_FORMAT_NONE':
31 elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV']:
33 elif fmat.has_channel('r'):
34 if fmat.has_channel('g'):
35 if fmat.has_channel('b'):
36 if fmat.has_channel('a'):
44 elif fmat.has_channel('l'):
45 if fmat.has_channel('a'):
49 elif fmat.has_channel('a') and fmat.num_channels() == 1:
51 elif fmat.has_channel('z'):
52 if fmat.has_channel('s'):
56 elif fmat.has_channel('s'):
58 elif fmat.has_channel('i') and fmat.num_channels() == 1:
61 sys.exit("error, could not determine base format for {0}, check swizzle".format(fmat.name));
63 def get_gl_data_type(fmat): argument
64 if fmat.is_compressed():
65 if 'FLOAT' in fmat.name:
67 elif 'SIGNED' in fmat.name or 'SNORM' in fmat.name:
71 elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV']:
75 for chan in fmat.channels:
76 if chan.type == 'x' and len(fmat.channels) > 1:
78 elif chan.name == 's' and fmat.has_channel('z'):
101 def get_channel_bits(fmat, chan_name): argument
102 if fmat.is_compressed():
105 if fmat.layout == 's3tc':
106 return 4 if fmat.has_channel(chan_name) else 0
107 elif fmat.layout == 'fxt1':
111 return 1 if fmat.has_channel('a') else 0
114 elif fmat.layout in ('rgtc', 'latc'):
115 return 8 if fmat.has_channel(chan_name) else 0
116 elif fmat.layout in ('etc1', 'etc2'):
117 if fmat.name.endswith('_ALPHA1') and chan_name == 'a':
120 bits = 11 if fmat.name.endswith('11_EAC') else 8
121 return bits if fmat.has_channel(chan_name) else 0
122 elif fmat.layout == 'bptc':
123 bits = 16 if fmat.name.endswith('_FLOAT') else 8
124 return bits if fmat.has_channel(chan_name) else 0
125 elif fmat.layout == 'astc':
126 bits = 16 if 'RGBA' in fmat.name else 8
127 return bits if fmat.has_channel(chan_name) else 0
132 for chan in fmat.channels:
173 for fmat in formats:
175 print ' {0},'.format(fmat.name)
176 print ' "{0}",'.format(fmat.name)
177 print ' {0},'.format('MESA_FORMAT_LAYOUT_' + fmat.layout.upper())
178 print ' {0},'.format(get_gl_base_format(fmat))
179 print ' {0},'.format(get_gl_data_type(fmat))
181 bits = [ get_channel_bits(fmat, name) for name in ['r', 'g', 'b', 'a']]
183 bits = [ get_channel_bits(fmat, name) for name in ['l', 'i', 'z', 's']]
186 print ' {0:d},'.format(fmat.colorspace == 'srgb')
188 print ' {0}, {1}, {2}, {3},'.format(fmat.block_width, fmat.block_height,
189 fmat.block_depth,
190 int(fmat.block_size() / 8))
192 print ' {{ {0} }},'.format(', '.join(map(str, fmat.swizzle)))
193 if fmat.is_array():
194 chan = fmat.array_element()
201 str(len(fmat.channels)),
202 str(fmat.swizzle[0]),
203 str(fmat.swizzle[1]),
204 str(fmat.swizzle[2]),
205 str(fmat.swizzle[3]),