3 from mako
.template
import Template
7 * Mesa 3-D graphics library
9 * Copyright (c) 2011 VMware, Inc.
10 * Copyright (c) 2014 Intel Corporation.
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
33 * Color, depth, stencil packing functions.
34 * Used to pack basic color, depth and stencil formats to specific
37 * There are both per-pixel and per-row packing functions:
38 * - The former will be used by swrast to write values to the color, depth,
39 * stencil buffers when drawing points, lines and masked spans.
40 * - The later will be used for image-oriented functions like glDrawPixels,
41 * glAccum, and glTexImage.
47 #include "format_pack.h"
48 #include "format_utils.h"
50 #include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
51 #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
52 #include "util/format_srgb.h"
54 #define UNPACK(SRC, OFFSET, BITS) (((SRC) >> (OFFSET)) & MAX_UINT(BITS))
55 #define PACK(SRC, OFFSET, BITS) (((SRC) & MAX_UINT(BITS)) << (OFFSET))
58 import format_parser as parser
60 formats = parser.parse(argv[1])
64 if f.name == 'MESA_FORMAT_NONE':
66 if f.colorspace not in ('rgb', 'srgb'):
72 /* ubyte packing functions */
74 %for f in rgb_formats:
75 %if f.name in ('MESA_FORMAT_R9G9B9E5_FLOAT', 'MESA_FORMAT_R11G11B10_FLOAT'):
77 %elif f.is_compressed():
82 pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst)
84 %for (i, c) in enumerate(f.channels):
85 <% i = f.swizzle.inverse()[i] %>
90 ${c.datatype()} ${c.name} =
91 %if not f.is_normalized() and f.is_int():
92 %if c.type == parser.SIGNED:
93 _mesa_unsigned_to_signed(src[${i}], ${c.size});
95 _mesa_unsigned_to_unsigned(src[${i}], ${c.size});
97 %elif c.type == parser.UNSIGNED:
98 %if f.colorspace == 'srgb' and c.name in 'rgb':
99 <% assert c.size == 8 %>
100 util_format_linear_to_srgb_8unorm(src[${i}]);
102 _mesa_unorm_to_unorm(src[${i}], 8, ${c.size});
104 %elif c.type == parser.SIGNED:
105 _mesa_unorm_to_snorm(src[${i}], 8, ${c.size});
106 %elif c.type == parser.FLOAT:
108 _mesa_unorm_to_float(src[${i}], 8);
110 _mesa_unorm_to_half(src[${i}], 8);
119 %if f.layout == parser.ARRAY:
120 ${f.datatype()} *d = (${f.datatype()} *)dst;
121 %for (i, c) in enumerate(f.channels):
127 %elif f.layout == parser.PACKED:
128 ${f.datatype()} d = 0;
129 %for (i, c) in enumerate(f.channels):
133 d |= PACK(${c.name}, ${c.shift}, ${c.size});
135 (*(${f.datatype()} *)dst) = d;
143 pack_ubyte_r9g9b9e5_float(const GLubyte src[4], void *dst)
145 GLuint *d = (GLuint *) dst;
147 rgb[0] = _mesa_unorm_to_float(src[RCOMP], 8);
148 rgb[1] = _mesa_unorm_to_float(src[GCOMP], 8);
149 rgb[2] = _mesa_unorm_to_float(src[BCOMP], 8);
150 *d = float3_to_rgb9e5(rgb);
154 pack_ubyte_r11g11b10_float(const GLubyte src[4], void *dst)
156 GLuint *d = (GLuint *) dst;
158 rgb[0] = _mesa_unorm_to_float(src[RCOMP], 8);
159 rgb[1] = _mesa_unorm_to_float(src[GCOMP], 8);
160 rgb[2] = _mesa_unorm_to_float(src[BCOMP], 8);
161 *d = float3_to_r11g11b10f(rgb);
165 /* float packing functions */
167 %for f in rgb_formats:
168 %if f.name in ('MESA_FORMAT_R9G9B9E5_FLOAT', 'MESA_FORMAT_R11G11B10_FLOAT'):
170 %elif f.is_int() and not f.is_normalized():
172 %elif f.is_compressed():
177 pack_float_${f.short_name()}(const GLfloat src[4], void *dst)
179 %for (i, c) in enumerate(f.channels):
180 <% i = f.swizzle.inverse()[i] %>
185 ${c.datatype()} ${c.name} =
186 %if c.type == parser.UNSIGNED:
187 %if f.colorspace == 'srgb' and c.name in 'rgb':
188 <% assert c.size == 8 %>
189 util_format_linear_float_to_srgb_8unorm(src[${i}]);
191 _mesa_float_to_unorm(src[${i}], ${c.size});
193 %elif c.type == parser.SIGNED:
194 _mesa_float_to_snorm(src[${i}], ${c.size});
195 %elif c.type == parser.FLOAT:
199 _mesa_float_to_half(src[${i}]);
208 %if f.layout == parser.ARRAY:
209 ${f.datatype()} *d = (${f.datatype()} *)dst;
210 %for (i, c) in enumerate(f.channels):
216 %elif f.layout == parser.PACKED:
217 ${f.datatype()} d = 0;
218 %for (i, c) in enumerate(f.channels):
222 d |= PACK(${c.name}, ${c.shift}, ${c.size});
224 (*(${f.datatype()} *)dst) = d;
232 pack_float_r9g9b9e5_float(const GLfloat src[4], void *dst)
234 GLuint *d = (GLuint *) dst;
235 *d = float3_to_rgb9e5(src);
239 pack_float_r11g11b10_float(const GLfloat src[4], void *dst)
241 GLuint *d = (GLuint *) dst;
242 *d = float3_to_r11g11b10f(src);
246 * Return a function that can pack a GLubyte rgba[4] color.
248 gl_pack_ubyte_rgba_func
249 _mesa_get_pack_ubyte_rgba_function(mesa_format format)
252 %for f in rgb_formats:
253 %if f.is_compressed():
258 return pack_ubyte_${f.short_name()};
266 * Return a function that can pack a GLfloat rgba[4] color.
268 gl_pack_float_rgba_func
269 _mesa_get_pack_float_rgba_function(mesa_format format)
272 %for f in rgb_formats:
273 %if f.is_compressed():
275 %elif f.is_int() and not f.is_normalized():
280 return pack_float_${f.short_name()};
288 * Pack a row of GLubyte rgba[4] values to the destination.
291 _mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n,
292 const GLubyte src[][4], void *dst)
298 %for f in rgb_formats:
299 %if f.is_compressed():
304 for (i = 0; i < n; ++i) {
305 pack_ubyte_${f.short_name()}(src[i], d);
306 d += ${f.block_size() / 8};
311 assert(!"Invalid format");
316 * Pack a row of GLfloat rgba[4] values to the destination.
319 _mesa_pack_float_rgba_row(mesa_format format, GLuint n,
320 const GLfloat src[][4], void *dst)
326 %for f in rgb_formats:
327 %if f.is_compressed():
329 %elif f.is_int() and not f.is_normalized():
334 for (i = 0; i < n; ++i) {
335 pack_float_${f.short_name()}(src[i], d);
336 d += ${f.block_size() / 8};
341 assert(!"Invalid format");
346 * Pack a 2D image of ubyte RGBA pixels in the given format.
347 * \param srcRowStride source image row stride in bytes
348 * \param dstRowStride destination image row stride in bytes
351 _mesa_pack_ubyte_rgba_rect(mesa_format format, GLuint width, GLuint height,
352 const GLubyte *src, GLint srcRowStride,
353 void *dst, GLint dstRowStride)
355 GLubyte *dstUB = dst;
358 if (srcRowStride == width * 4 * sizeof(GLubyte) &&
359 dstRowStride == _mesa_format_row_stride(format, width)) {
360 /* do whole image at once */
361 _mesa_pack_ubyte_rgba_row(format, width * height,
362 (const GLubyte (*)[4]) src, dst);
366 for (i = 0; i < height; i++) {
367 _mesa_pack_ubyte_rgba_row(format, width,
368 (const GLubyte (*)[4]) src, dstUB);
370 dstUB += dstRowStride;
376 /** Helper struct for MESA_FORMAT_Z32_FLOAT_S8X24_UINT */
385 ** Pack float Z pixels
389 pack_float_S8_UINT_Z24_UNORM(const GLfloat *src, void *dst)
391 /* don't disturb the stencil values */
392 GLuint *d = ((GLuint *) dst);
393 const GLdouble scale = (GLdouble) 0xffffff;
394 GLuint s = *d & 0xff;
395 GLuint z = (GLuint) (*src * scale);
396 assert(z <= 0xffffff);
401 pack_float_Z24_UNORM_S8_UINT(const GLfloat *src, void *dst)
403 /* don't disturb the stencil values */
404 GLuint *d = ((GLuint *) dst);
405 const GLdouble scale = (GLdouble) 0xffffff;
406 GLuint s = *d & 0xff000000;
407 GLuint z = (GLuint) (*src * scale);
408 assert(z <= 0xffffff);
413 pack_float_Z_UNORM16(const GLfloat *src, void *dst)
415 GLushort *d = ((GLushort *) dst);
416 const GLfloat scale = (GLfloat) 0xffff;
417 *d = (GLushort) (*src * scale);
421 pack_float_Z_UNORM32(const GLfloat *src, void *dst)
423 GLuint *d = ((GLuint *) dst);
424 const GLdouble scale = (GLdouble) 0xffffffff;
425 *d = (GLuint) (*src * scale);
429 pack_float_Z_FLOAT32(const GLfloat *src, void *dst)
431 GLfloat *d = (GLfloat *) dst;
436 _mesa_get_pack_float_z_func(mesa_format format)
439 case MESA_FORMAT_S8_UINT_Z24_UNORM:
440 case MESA_FORMAT_X8_UINT_Z24_UNORM:
441 return pack_float_S8_UINT_Z24_UNORM;
442 case MESA_FORMAT_Z24_UNORM_S8_UINT:
443 case MESA_FORMAT_Z24_UNORM_X8_UINT:
444 return pack_float_Z24_UNORM_S8_UINT;
445 case MESA_FORMAT_Z_UNORM16:
446 return pack_float_Z_UNORM16;
447 case MESA_FORMAT_Z_UNORM32:
448 return pack_float_Z_UNORM32;
449 case MESA_FORMAT_Z_FLOAT32:
450 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
451 return pack_float_Z_FLOAT32;
454 "unexpected format in _mesa_get_pack_float_z_func()");
462 ** Pack uint Z pixels. The incoming src value is always in
463 ** the range [0, 2^32-1].
467 pack_uint_S8_UINT_Z24_UNORM(const GLuint *src, void *dst)
469 /* don't disturb the stencil values */
470 GLuint *d = ((GLuint *) dst);
471 GLuint s = *d & 0xff;
472 GLuint z = *src & 0xffffff00;
477 pack_uint_Z24_UNORM_S8_UINT(const GLuint *src, void *dst)
479 /* don't disturb the stencil values */
480 GLuint *d = ((GLuint *) dst);
481 GLuint s = *d & 0xff000000;
482 GLuint z = *src >> 8;
487 pack_uint_Z_UNORM16(const GLuint *src, void *dst)
489 GLushort *d = ((GLushort *) dst);
494 pack_uint_Z_UNORM32(const GLuint *src, void *dst)
496 GLuint *d = ((GLuint *) dst);
501 pack_uint_Z_FLOAT32(const GLuint *src, void *dst)
503 GLuint *d = ((GLuint *) dst);
504 const GLdouble scale = 1.0 / (GLdouble) 0xffffffff;
505 *d = (GLuint) (*src * scale);
511 pack_uint_Z_FLOAT32_X24S8(const GLuint *src, void *dst)
513 GLfloat *d = ((GLfloat *) dst);
514 const GLdouble scale = 1.0 / (GLdouble) 0xffffffff;
515 *d = (GLfloat) (*src * scale);
521 _mesa_get_pack_uint_z_func(mesa_format format)
524 case MESA_FORMAT_S8_UINT_Z24_UNORM:
525 case MESA_FORMAT_X8_UINT_Z24_UNORM:
526 return pack_uint_S8_UINT_Z24_UNORM;
527 case MESA_FORMAT_Z24_UNORM_S8_UINT:
528 case MESA_FORMAT_Z24_UNORM_X8_UINT:
529 return pack_uint_Z24_UNORM_S8_UINT;
530 case MESA_FORMAT_Z_UNORM16:
531 return pack_uint_Z_UNORM16;
532 case MESA_FORMAT_Z_UNORM32:
533 return pack_uint_Z_UNORM32;
534 case MESA_FORMAT_Z_FLOAT32:
535 return pack_uint_Z_FLOAT32;
536 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
537 return pack_uint_Z_FLOAT32_X24S8;
539 _mesa_problem(NULL, "unexpected format in _mesa_get_pack_uint_z_func()");
546 ** Pack ubyte stencil pixels
550 pack_ubyte_stencil_Z24_S8(const GLubyte *src, void *dst)
552 /* don't disturb the Z values */
553 GLuint *d = ((GLuint *) dst);
555 GLuint z = *d & 0xffffff00;
560 pack_ubyte_stencil_S8_Z24(const GLubyte *src, void *dst)
562 /* don't disturb the Z values */
563 GLuint *d = ((GLuint *) dst);
564 GLuint s = *src << 24;
565 GLuint z = *d & 0xffffff;
570 pack_ubyte_stencil_S8(const GLubyte *src, void *dst)
572 GLubyte *d = (GLubyte *) dst;
577 pack_ubyte_stencil_Z32_FLOAT_X24S8(const GLubyte *src, void *dst)
579 GLfloat *d = ((GLfloat *) dst);
584 gl_pack_ubyte_stencil_func
585 _mesa_get_pack_ubyte_stencil_func(mesa_format format)
588 case MESA_FORMAT_S8_UINT_Z24_UNORM:
589 return pack_ubyte_stencil_Z24_S8;
590 case MESA_FORMAT_Z24_UNORM_S8_UINT:
591 return pack_ubyte_stencil_S8_Z24;
592 case MESA_FORMAT_S_UINT8:
593 return pack_ubyte_stencil_S8;
594 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
595 return pack_ubyte_stencil_Z32_FLOAT_X24S8;
598 "unexpected format in _mesa_pack_ubyte_stencil_func()");
606 _mesa_pack_float_z_row(mesa_format format, GLuint n,
607 const GLfloat *src, void *dst)
610 case MESA_FORMAT_S8_UINT_Z24_UNORM:
611 case MESA_FORMAT_X8_UINT_Z24_UNORM:
613 /* don't disturb the stencil values */
614 GLuint *d = ((GLuint *) dst);
615 const GLdouble scale = (GLdouble) 0xffffff;
617 for (i = 0; i < n; i++) {
618 GLuint s = d[i] & 0xff;
619 GLuint z = (GLuint) (src[i] * scale);
620 assert(z <= 0xffffff);
625 case MESA_FORMAT_Z24_UNORM_S8_UINT:
626 case MESA_FORMAT_Z24_UNORM_X8_UINT:
628 /* don't disturb the stencil values */
629 GLuint *d = ((GLuint *) dst);
630 const GLdouble scale = (GLdouble) 0xffffff;
632 for (i = 0; i < n; i++) {
633 GLuint s = d[i] & 0xff000000;
634 GLuint z = (GLuint) (src[i] * scale);
635 assert(z <= 0xffffff);
640 case MESA_FORMAT_Z_UNORM16:
642 GLushort *d = ((GLushort *) dst);
643 const GLfloat scale = (GLfloat) 0xffff;
645 for (i = 0; i < n; i++) {
646 d[i] = (GLushort) (src[i] * scale);
650 case MESA_FORMAT_Z_UNORM32:
652 GLuint *d = ((GLuint *) dst);
653 const GLdouble scale = (GLdouble) 0xffffffff;
655 for (i = 0; i < n; i++) {
656 d[i] = (GLuint) (src[i] * scale);
660 case MESA_FORMAT_Z_FLOAT32:
661 memcpy(dst, src, n * sizeof(GLfloat));
663 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
665 struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
667 for (i = 0; i < n; i++) {
673 _mesa_problem(NULL, "unexpected format in _mesa_pack_float_z_row()");
679 * The incoming Z values are always in the range [0, 0xffffffff].
682 _mesa_pack_uint_z_row(mesa_format format, GLuint n,
683 const GLuint *src, void *dst)
686 case MESA_FORMAT_S8_UINT_Z24_UNORM:
687 case MESA_FORMAT_X8_UINT_Z24_UNORM:
689 /* don't disturb the stencil values */
690 GLuint *d = ((GLuint *) dst);
692 for (i = 0; i < n; i++) {
693 GLuint s = d[i] & 0xff;
694 GLuint z = src[i] & 0xffffff00;
699 case MESA_FORMAT_Z24_UNORM_S8_UINT:
700 case MESA_FORMAT_Z24_UNORM_X8_UINT:
702 /* don't disturb the stencil values */
703 GLuint *d = ((GLuint *) dst);
705 for (i = 0; i < n; i++) {
706 GLuint s = d[i] & 0xff000000;
707 GLuint z = src[i] >> 8;
712 case MESA_FORMAT_Z_UNORM16:
714 GLushort *d = ((GLushort *) dst);
716 for (i = 0; i < n; i++) {
721 case MESA_FORMAT_Z_UNORM32:
722 memcpy(dst, src, n * sizeof(GLfloat));
724 case MESA_FORMAT_Z_FLOAT32:
726 GLuint *d = ((GLuint *) dst);
727 const GLdouble scale = 1.0 / (GLdouble) 0xffffffff;
729 for (i = 0; i < n; i++) {
730 d[i] = (GLuint) (src[i] * scale);
731 assert(d[i] >= 0.0f);
732 assert(d[i] <= 1.0f);
736 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
738 struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
739 const GLdouble scale = 1.0 / (GLdouble) 0xffffffff;
741 for (i = 0; i < n; i++) {
742 d[i].z = (GLfloat) (src[i] * scale);
743 assert(d[i].z >= 0.0f);
744 assert(d[i].z <= 1.0f);
749 _mesa_problem(NULL, "unexpected format in _mesa_pack_uint_z_row()");
755 _mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n,
756 const GLubyte *src, void *dst)
759 case MESA_FORMAT_S8_UINT_Z24_UNORM:
761 /* don't disturb the Z values */
762 GLuint *d = ((GLuint *) dst);
764 for (i = 0; i < n; i++) {
766 GLuint z = d[i] & 0xffffff00;
771 case MESA_FORMAT_Z24_UNORM_S8_UINT:
773 /* don't disturb the Z values */
774 GLuint *d = ((GLuint *) dst);
776 for (i = 0; i < n; i++) {
777 GLuint s = src[i] << 24;
778 GLuint z = d[i] & 0xffffff;
783 case MESA_FORMAT_S_UINT8:
784 memcpy(dst, src, n * sizeof(GLubyte));
786 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
788 struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
790 for (i = 0; i < n; i++) {
796 _mesa_problem(NULL, "unexpected format in _mesa_pack_ubyte_stencil_row()");
802 * Incoming Z/stencil values are always in uint_24_8 format.
805 _mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n,
806 const GLuint *src, void *dst)
809 case MESA_FORMAT_S8_UINT_Z24_UNORM:
810 memcpy(dst, src, n * sizeof(GLuint));
812 case MESA_FORMAT_Z24_UNORM_S8_UINT:
814 GLuint *d = ((GLuint *) dst);
816 for (i = 0; i < n; i++) {
817 GLuint s = src[i] << 24;
818 GLuint z = src[i] >> 8;
823 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
825 const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
826 struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
828 for (i = 0; i < n; i++) {
829 GLfloat z = (GLfloat) ((src[i] >> 8) * scale);
836 _mesa_problem(NULL, "bad format %s in _mesa_pack_ubyte_s_row",
837 _mesa_get_format_name(format));
845 * Convert a boolean color mask to a packed color where each channel of
846 * the packed value at dst will be 0 or ~0 depending on the colorMask.
849 _mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst)
851 GLfloat maskColor[4];
853 switch (_mesa_get_format_datatype(format)) {
854 case GL_UNSIGNED_NORMALIZED:
855 /* simple: 1.0 will convert to ~0 in the right bit positions */
856 maskColor[0] = colorMask[0] ? 1.0f : 0.0f;
857 maskColor[1] = colorMask[1] ? 1.0f : 0.0f;
858 maskColor[2] = colorMask[2] ? 1.0f : 0.0f;
859 maskColor[3] = colorMask[3] ? 1.0f : 0.0f;
860 _mesa_pack_float_rgba_row(format, 1,
861 (const GLfloat (*)[4]) maskColor, dst);
863 case GL_SIGNED_NORMALIZED:
865 /* These formats are harder because it's hard to know the floating
866 * point values that will convert to ~0 for each color channel's bits.
867 * This solution just generates a non-zero value for each color channel
868 * then fixes up the non-zero values to be ~0.
869 * Note: we'll need to add special case code if we ever have to deal
870 * with formats with unequal color channel sizes, like R11_G11_B10.
871 * We issue a warning below for channel sizes other than 8,16,32.
874 GLuint bits = _mesa_get_format_max_bits(format); /* bits per chan */
875 GLuint bytes = _mesa_get_format_bytes(format);
878 /* this should put non-zero values into the channels of dst */
879 maskColor[0] = colorMask[0] ? -1.0f : 0.0f;
880 maskColor[1] = colorMask[1] ? -1.0f : 0.0f;
881 maskColor[2] = colorMask[2] ? -1.0f : 0.0f;
882 maskColor[3] = colorMask[3] ? -1.0f : 0.0f;
883 _mesa_pack_float_rgba_row(format, 1,
884 (const GLfloat (*)[4]) maskColor, dst);
886 /* fix-up the dst channels by converting non-zero values to ~0 */
888 GLubyte *d = (GLubyte *) dst;
889 for (i = 0; i < bytes; i++) {
890 d[i] = d[i] ? 0xff : 0x0;
893 else if (bits == 16) {
894 GLushort *d = (GLushort *) dst;
895 for (i = 0; i < bytes / 2; i++) {
896 d[i] = d[i] ? 0xffff : 0x0;
899 else if (bits == 32) {
900 GLuint *d = (GLuint *) dst;
901 for (i = 0; i < bytes / 4; i++) {
902 d[i] = d[i] ? 0xffffffffU : 0x0;
906 _mesa_problem(NULL, "unexpected size in _mesa_pack_colormask()");
912 _mesa_problem(NULL, "unexpected format data type in gen_color_mask()");
918 template
= Template(string
);
920 print template
.render(argv
= argv
[0:])