Lines Matching full:format

147  * Convert a GL image format enum to an IDX_* value (see above).
199 * \param inFormat the incoming format of the texture
200 * \param outFormat the final texture format
307 * format data types.
362 * Get the number of components in a pixel format.
364 * \param format pixel format.
366 * \return the number of components in the given format, or -1 if a bad format.
369 _mesa_components_in_format(GLenum format) in _mesa_components_in_format() argument
371 switch (format) { in _mesa_components_in_format()
416 * Get the bytes per pixel of pixel format type pair.
418 * \param format pixel format.
421 * \return bytes per pixel, or -1 if a bad format or type was given.
424 _mesa_bytes_per_pixel(GLenum format, GLenum type) in _mesa_bytes_per_pixel() argument
426 GLint comps = _mesa_components_in_format(format); in _mesa_bytes_per_pixel()
449 if (format == GL_RGB || format == GL_BGR || in _mesa_bytes_per_pixel()
450 format == GL_RGB_INTEGER_EXT || format == GL_BGR_INTEGER_EXT) in _mesa_bytes_per_pixel()
456 if (format == GL_RGB || format == GL_BGR || in _mesa_bytes_per_pixel()
457 format == GL_RGB_INTEGER_EXT || format == GL_BGR_INTEGER_EXT) in _mesa_bytes_per_pixel()
463 if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT || in _mesa_bytes_per_pixel()
464 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) in _mesa_bytes_per_pixel()
470 if (format == GL_RGBA || format == GL_BGRA || in _mesa_bytes_per_pixel()
471 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) in _mesa_bytes_per_pixel()
477 if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT || in _mesa_bytes_per_pixel()
478 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT || in _mesa_bytes_per_pixel()
479 format == GL_RGB) in _mesa_bytes_per_pixel()
485 if (format == GL_RGBA || format == GL_BGRA || in _mesa_bytes_per_pixel()
486 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT || in _mesa_bytes_per_pixel()
487 format == GL_RGB) in _mesa_bytes_per_pixel()
493 if (format == GL_YCBCR_MESA) in _mesa_bytes_per_pixel()
498 if (format == GL_DEPTH_COMPONENT || in _mesa_bytes_per_pixel()
499 format == GL_DEPTH_STENCIL_EXT) in _mesa_bytes_per_pixel()
504 if (format == GL_RGB) in _mesa_bytes_per_pixel()
509 if (format == GL_RGB) in _mesa_bytes_per_pixel()
514 if (format == GL_DEPTH_STENCIL) in _mesa_bytes_per_pixel()
572 * Test if the given format is unsized.
575 _mesa_is_enum_format_unsized(GLenum format) in _mesa_is_enum_format_unsized() argument
577 switch (format) { in _mesa_is_enum_format_unsized()
628 * Test if the given format is a UNORM (unsigned-normalized) format.
631 _mesa_is_enum_format_unorm(GLenum format) in _mesa_is_enum_format_unorm() argument
633 switch(format) { in _mesa_is_enum_format_unorm()
699 * Test if the given format is a SNORM (signed-normalized) format.
702 _mesa_is_enum_format_snorm(GLenum format) in _mesa_is_enum_format_snorm() argument
704 switch (format) { in _mesa_is_enum_format_snorm()
737 * Test if the given format is an integer (non-normalized) format.
740 _mesa_is_enum_format_unsigned_int(GLenum format) in _mesa_is_enum_format_unsigned_int() argument
742 switch (format) { in _mesa_is_enum_format_unsigned_int()
777 * Test if the given format is an integer (non-normalized) format.
780 _mesa_is_enum_format_signed_int(GLenum format) in _mesa_is_enum_format_signed_int() argument
782 switch (format) { in _mesa_is_enum_format_signed_int()
827 * Test if the given format is an ASTC 2D format.
868 * Test if the given format is an ASTC 3D format.
901 * Test if the given format is an ASTC format.
911 * Test if the given format is an ETC2 format.
934 * Test if the given format is an integer (non-normalized) format.
937 _mesa_is_enum_format_integer(GLenum format) in _mesa_is_enum_format_integer() argument
939 return _mesa_is_enum_format_unsigned_int(format) || in _mesa_is_enum_format_integer()
940 _mesa_is_enum_format_signed_int(format); in _mesa_is_enum_format_integer()
976 * Test if the given image format is a color/RGBA format (i.e., not color
978 * \param format the image format value (may by an internal texture format)
979 * \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.
982 _mesa_is_color_format(GLenum format) in _mesa_is_color_format() argument
984 switch (format) { in _mesa_is_color_format()
1242 * Test if the given image format is a depth component format.
1245 _mesa_is_depth_format(GLenum format) in _mesa_is_depth_format() argument
1247 switch (format) { in _mesa_is_depth_format()
1261 * Test if the given image format is a stencil format.
1264 _mesa_is_stencil_format(GLenum format) in _mesa_is_stencil_format() argument
1266 switch (format) { in _mesa_is_stencil_format()
1276 * Test if the given image format is a YCbCr format.
1279 _mesa_is_ycbcr_format(GLenum format) in _mesa_is_ycbcr_format() argument
1281 switch (format) { in _mesa_is_ycbcr_format()
1291 * Test if the given image format is a depth+stencil format.
1294 _mesa_is_depthstencil_format(GLenum format) in _mesa_is_depthstencil_format() argument
1296 switch (format) { in _mesa_is_depthstencil_format()
1308 * Test if the given image format is a depth or stencil format.
1311 _mesa_is_depth_or_stencil_format(GLenum format) in _mesa_is_depth_or_stencil_format() argument
1313 switch (format) { in _mesa_is_depth_or_stencil_format()
1335 * Test if an image format is a supported compressed format.
1336 * \param format the internal format token provided by the user.
1340 _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format) in _mesa_is_compressed_format() argument
1342 mesa_format m_format = _mesa_glenum_to_compressed_format(format); in _mesa_is_compressed_format()
1348 switch (format) { in _mesa_is_compressed_format()
1408 * Test if the given format represents an sRGB format.
1409 * \param format the GL format (can be an internal format)
1410 * \return GL_TRUE if format is sRGB, GL_FALSE otherwise
1413 _mesa_is_srgb_format(GLenum format) in _mesa_is_srgb_format() argument
1415 switch (format) { in _mesa_is_srgb_format()
1453 * Convert various unpack formats to the corresponding base format.
1456 _mesa_unpack_format_to_base_format(GLenum format) in _mesa_unpack_format_to_base_format() argument
1458 switch(format) { in _mesa_unpack_format_to_base_format()
1493 return format; in _mesa_unpack_format_to_base_format()
1498 * Convert various base formats to the corresponding integer format.
1501 _mesa_base_format_to_integer_format(GLenum format) in _mesa_base_format_to_integer_format() argument
1503 switch(format) { in _mesa_base_format_to_integer_format()
1528 return format; in _mesa_base_format_to_integer_format()
1533 * Does the given base texture/renderbuffer format have the channel
1632 * Returns the number of channels/components for a base format.
1659 * If format is a generic compressed format, return the corresponding
1660 * non-compressed format. For other formats, return the format as-is.
1663 _mesa_generic_compressed_format_to_uncompressed_format(GLenum format) in _mesa_generic_compressed_format_to_uncompressed_format() argument
1665 switch (format) { in _mesa_generic_compressed_format_to_uncompressed_format()
1692 return format; in _mesa_generic_compressed_format_to_uncompressed_format()
1698 * Return the equivalent non-generic internal format.
1702 _mesa_get_nongeneric_internalformat(GLenum format) in _mesa_get_nongeneric_internalformat() argument
1704 switch (format) { in _mesa_get_nongeneric_internalformat()
1758 return format; in _mesa_get_nongeneric_internalformat()
1764 * Convert an sRGB internal format to linear.
1767 _mesa_get_linear_internalformat(GLenum format) in _mesa_get_linear_internalformat() argument
1769 switch (format) { in _mesa_get_linear_internalformat()
1787 return format; in _mesa_get_linear_internalformat()
1793 * Do error checking of format/type combinations for glReadPixels,
1794 * glDrawPixels and glTex[Sub]Image. Note that depending on the format
1798 * \param format pixel format.
1805 GLenum format, GLenum type) in _mesa_error_check_format_and_type() argument
1808 * "If the format is DEPTH_STENCIL, then values are taken from in _mesa_error_check_format_and_type()
1818 if (_mesa_is_desktop_gl(ctx) && format == GL_DEPTH_STENCIL in _mesa_error_check_format_and_type()
1826 if (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX) { in _mesa_error_check_format_and_type()
1835 if (format == GL_RGB) { in _mesa_error_check_format_and_type()
1838 if (format == GL_RGB_INTEGER_EXT && in _mesa_error_check_format_and_type()
1848 if (format == GL_RGBA || in _mesa_error_check_format_and_type()
1849 format == GL_BGRA || in _mesa_error_check_format_and_type()
1850 format == GL_ABGR_EXT) { in _mesa_error_check_format_and_type()
1853 if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) && in _mesa_error_check_format_and_type()
1863 if (format == GL_RGBA || in _mesa_error_check_format_and_type()
1864 format == GL_BGRA) { in _mesa_error_check_format_and_type()
1867 if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) && in _mesa_error_check_format_and_type()
1871 if (type == GL_UNSIGNED_INT_2_10_10_10_REV && format == GL_RGB && in _mesa_error_check_format_and_type()
1879 if (ctx->API == API_OPENGLES2 && format == GL_DEPTH_COMPONENT) in _mesa_error_check_format_and_type()
1882 if (format != GL_DEPTH_STENCIL) { in _mesa_error_check_format_and_type()
1891 if (format != GL_DEPTH_STENCIL) { in _mesa_error_check_format_and_type()
1900 if (format != GL_RGB) { in _mesa_error_check_format_and_type()
1906 switch (format) { in _mesa_error_check_format_and_type()
1925 /* now, for each format, check the type for compatibility */ in _mesa_error_check_format_and_type()
1926 switch (format) { in _mesa_error_check_format_and_type()
2142 /* NOTE: no packed formats w/ BGR format */ in _mesa_error_check_format_and_type()
2199 * Do error checking of format/type combinations for OpenGL ES glReadPixels
2205 GLenum format, GLenum type, in _mesa_es_error_check_format_and_type() argument
2210 switch (format) { in _mesa_es_error_check_format_and_type()
2242 /* This format is filtered against invalid dimensionalities elsewhere. in _mesa_es_error_check_format_and_type()
2249 /* This format is filtered against invalid dimensionalities elsewhere. in _mesa_es_error_check_format_and_type()
2258 * the format does not appear to be allowed for 3D textures in OpenGL in _mesa_es_error_check_format_and_type()
2274 * Return the simple base format for a given internal texture format.
2278 * \param internalFormat the internal texture format token or 1, 2, 3, or 4.
2280 * \return the corresponding \u base internal format (GL_ALPHA, GL_LUMINANCE,
2283 * This is the format which is used during texture application (i.e. the
2284 * texture format and env mode determine the arithmetic used.
2344 /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0). in _mesa_base_tex_format()
2655 * Returns the effective internal format from a texture format and type.
2657 * the specified internal format is a base (unsized) format.
2659 * This method will only return a valid effective internal format if the
2660 * combination of format, type and internal format in base form, is acceptable.
2662 * If a single sized internal format is defined in the spec (OpenGL-ES 3.0.4) or
2663 * in extensions, to unambiguously correspond to the given base format, then
2664 * that internal format is returned as the effective. Otherwise, if the
2665 * combination is accepted but a single effective format is not defined, the
2666 * passed base format will be returned instead.
2668 * \param format the texture format
2672 _mesa_es3_effective_internal_format_for_format_and_type(GLenum format, in _mesa_es3_effective_internal_format_for_format_and_type() argument
2677 switch (format) { in _mesa_es3_effective_internal_format_for_format_and_type()
2689 * format is returned instead. in _mesa_es3_effective_internal_format_for_format_and_type()
2695 return format; in _mesa_es3_effective_internal_format_for_format_and_type()
2700 if (format == GL_RGBA) in _mesa_es3_effective_internal_format_for_format_and_type()
2705 if (format == GL_RGBA) in _mesa_es3_effective_internal_format_for_format_and_type()
2710 if (format == GL_RGB) in _mesa_es3_effective_internal_format_for_format_and_type()
2716 if (format == GL_DEPTH_STENCIL) in _mesa_es3_effective_internal_format_for_format_and_type()
2721 if (format == GL_DEPTH_STENCIL) in _mesa_es3_effective_internal_format_for_format_and_type()
2726 if (format == GL_DEPTH_COMPONENT) in _mesa_es3_effective_internal_format_for_format_and_type()
2732 * the format. in _mesa_es3_effective_internal_format_for_format_and_type()
2734 if (format == GL_DEPTH_COMPONENT) in _mesa_es3_effective_internal_format_for_format_and_type()
2735 return format; in _mesa_es3_effective_internal_format_for_format_and_type()
2740 if (format == GL_DEPTH_COMPONENT) in _mesa_es3_effective_internal_format_for_format_and_type()
2744 switch (format) { in _mesa_es3_effective_internal_format_for_format_and_type()
2752 return format; in _mesa_es3_effective_internal_format_for_format_and_type()
2756 switch (format) { in _mesa_es3_effective_internal_format_for_format_and_type()
2759 return format; in _mesa_es3_effective_internal_format_for_format_and_type()
2765 switch (format) { in _mesa_es3_effective_internal_format_for_format_and_type()
2768 return format; in _mesa_es3_effective_internal_format_for_format_and_type()
2781 * Do error checking of format/type combinations for OpenGL ES 3
2787 GLenum format, GLenum type, in _mesa_es3_error_check_format_and_type() argument
2790 /* If internalFormat is an unsized format, then the effective internal in _mesa_es3_error_check_format_and_type()
2791 * format derived from format and type should be used instead. Page 127, in _mesa_es3_error_check_format_and_type()
2794 * "if internalformat is a base internal format, the effective in _mesa_es3_error_check_format_and_type()
2795 * internal format is a sized internal format that is derived in _mesa_es3_error_check_format_and_type()
2796 * from the format and type for internal use by the GL. in _mesa_es3_error_check_format_and_type()
2797 * Table 3.12 specifies the mapping of format and type to effective in _mesa_es3_error_check_format_and_type()
2798 * internal formats. The effective internal format is used by the GL in _mesa_es3_error_check_format_and_type()
2801 * as if the effective internal format was used as the internalformat in _mesa_es3_error_check_format_and_type()
2806 _mesa_es3_effective_internal_format_for_format_and_type(format, type); in _mesa_es3_error_check_format_and_type()
2813 /* Unfortunately, _mesa_base_tex_format returns a base format of in _mesa_es3_error_check_format_and_type()
2815 * asking the question, "what channels does this format have?" in _mesa_es3_error_check_format_and_type()
2831 switch (format) { in _mesa_es3_error_check_format_and_type()
2906 if (ctx->Extensions.OES_texture_float && internalFormat == format) in _mesa_es3_error_check_format_and_type()
2914 if (ctx->Extensions.OES_texture_half_float && internalFormat == format) in _mesa_es3_error_check_format_and_type()
3030 if (ctx->Extensions.OES_texture_float && internalFormat == format) in _mesa_es3_error_check_format_and_type()
3038 if (!ctx->Extensions.OES_texture_half_float || internalFormat != format) in _mesa_es3_error_check_format_and_type()
3345 if (!ctx->Extensions.OES_texture_float || internalFormat != format) in _mesa_es3_error_check_format_and_type()
3349 if (!ctx->Extensions.OES_texture_half_float || internalFormat != format) in _mesa_es3_error_check_format_and_type()
3353 if (!(format == internalFormat || in _mesa_es3_error_check_format_and_type()
3354 (format == GL_ALPHA && internalFormat == GL_ALPHA8) || in _mesa_es3_error_check_format_and_type()
3355 (format == GL_LUMINANCE && internalFormat == GL_LUMINANCE8) || in _mesa_es3_error_check_format_and_type()
3356 (format == GL_LUMINANCE_ALPHA && in _mesa_es3_error_check_format_and_type()
3381 get_swizzle_from_gl_format(GLenum format, uint8_t *swizzle) in get_swizzle_from_gl_format() argument
3383 switch (format) { in get_swizzle_from_gl_format()
3440 * Take an OpenGL format (GL_RGB, GL_RGBA, etc), OpenGL data type (GL_INT,
3444 * This function will typically be used to compute a mesa format from a GL type
3451 * mesa_array_format. Clients must check the mesa array format bit
3453 * format is a mesa_array_format or a mesa_format.
3456 _mesa_format_from_format_and_type(GLenum format, GLenum type) in _mesa_format_from_format_and_type() argument
3463 /* Extract array format type information from the OpenGL data type */ in _mesa_format_from_format_and_type()
3502 /* Extract array format swizzle information from the OpenGL format */ in _mesa_format_from_format_and_type()
3504 is_array_format = get_swizzle_from_gl_format(format, swizzle); in _mesa_format_from_format_and_type()
3506 /* If this is an array format type after checking data type and format, in _mesa_format_from_format_and_type()
3507 * create the array format in _mesa_format_from_format_and_type()
3510 normalized = !_mesa_is_enum_format_integer(format); in _mesa_format_from_format_and_type()
3511 num_channels = _mesa_components_in_format(format); in _mesa_format_from_format_and_type()
3518 /* Otherwise this is not an array format, so return the mesa_format in _mesa_format_from_format_and_type()
3519 * matching the OpenGL format and data type in _mesa_format_from_format_and_type()
3523 if (format == GL_RGB) in _mesa_format_from_format_and_type()
3525 else if (format == GL_BGR) in _mesa_format_from_format_and_type()
3527 else if (format == GL_RGB_INTEGER) in _mesa_format_from_format_and_type()
3531 if (format == GL_RGB) in _mesa_format_from_format_and_type()
3533 else if (format == GL_BGR) in _mesa_format_from_format_and_type()
3535 else if (format == GL_RGB_INTEGER) in _mesa_format_from_format_and_type()
3539 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3541 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3543 else if (format == GL_ABGR_EXT) in _mesa_format_from_format_and_type()
3545 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3547 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3551 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3553 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3555 else if (format == GL_ABGR_EXT) in _mesa_format_from_format_and_type()
3557 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3559 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3563 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3565 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3567 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3569 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3573 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3575 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3577 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3579 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3583 if (format == GL_RGB) in _mesa_format_from_format_and_type()
3585 else if (format == GL_RGB_INTEGER) in _mesa_format_from_format_and_type()
3589 if (format == GL_RGB) in _mesa_format_from_format_and_type()
3591 else if (format == GL_RGB_INTEGER) in _mesa_format_from_format_and_type()
3595 if (format == GL_RGB) in _mesa_format_from_format_and_type()
3599 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3601 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3603 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3605 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3609 if (format == GL_RGB) in _mesa_format_from_format_and_type()
3611 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3613 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3615 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3617 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3621 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3623 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3625 else if (format == GL_ABGR_EXT) in _mesa_format_from_format_and_type()
3627 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3629 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3633 if (format == GL_RGBA) in _mesa_format_from_format_and_type()
3635 else if (format == GL_BGRA) in _mesa_format_from_format_and_type()
3637 else if (format == GL_ABGR_EXT) in _mesa_format_from_format_and_type()
3639 else if (format == GL_RGBA_INTEGER) in _mesa_format_from_format_and_type()
3641 else if (format == GL_BGRA_INTEGER) in _mesa_format_from_format_and_type()
3645 if (format == GL_YCBCR_MESA) in _mesa_format_from_format_and_type()
3649 if (format == GL_YCBCR_MESA) in _mesa_format_from_format_and_type()
3653 if (format == GL_RGB) in _mesa_format_from_format_and_type()
3657 if (format == GL_DEPTH_COMPONENT) in _mesa_format_from_format_and_type()
3661 if (format == GL_DEPTH_COMPONENT) in _mesa_format_from_format_and_type()
3665 if (format == GL_DEPTH_COMPONENT) in _mesa_format_from_format_and_type()
3669 if (format == GL_DEPTH_STENCIL) in _mesa_format_from_format_and_type()
3673 if (format == GL_DEPTH_STENCIL) in _mesa_format_from_format_and_type()
3680 /* If we got here it means that we could not find a Mesa format that in _mesa_format_from_format_and_type()
3681 * matches the GL format/type provided. We may need to add a new Mesa in _mesa_format_from_format_and_type()
3682 * format in that case. in _mesa_format_from_format_and_type()
3684 unreachable("Unsupported format"); in _mesa_format_from_format_and_type()
3691 mesa_format format = _mesa_format_from_format_and_type(gl_format, type); in _mesa_tex_format_from_format_and_type() local
3693 if (_mesa_format_is_mesa_array_format(format)) in _mesa_tex_format_from_format_and_type()
3694 format = _mesa_format_from_array_format(format); in _mesa_tex_format_from_format_and_type()
3696 if (format == MESA_FORMAT_NONE || !ctx->TextureFormatSupported[format]) in _mesa_tex_format_from_format_and_type()
3699 return format; in _mesa_tex_format_from_format_and_type()
3703 * Returns true if \p internal_format is a sized internal format that
3752 * Returns true if \p internal_format is a sized internal format that