Lines Matching refs: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)
371 switch (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)
426 GLint comps = _mesa_components_in_format(format);
449 if (format == GL_RGB || format == GL_BGR ||
450 format == GL_RGB_INTEGER_EXT || format == GL_BGR_INTEGER_EXT)
456 if (format == GL_RGB || format == GL_BGR ||
457 format == GL_RGB_INTEGER_EXT || format == GL_BGR_INTEGER_EXT)
463 if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT ||
464 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT)
470 if (format == GL_RGBA || format == GL_BGRA ||
471 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT)
477 if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT ||
478 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT ||
479 format == GL_RGB)
485 if (format == GL_RGBA || format == GL_BGRA ||
486 format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT ||
487 format == GL_RGB)
493 if (format == GL_YCBCR_MESA)
498 if (format == GL_DEPTH_COMPONENT ||
499 format == GL_DEPTH_STENCIL_EXT)
504 if (format == GL_RGB)
509 if (format == GL_RGB)
514 if (format == GL_DEPTH_STENCIL)
574 * Test if the given format is unsized.
577 _mesa_is_enum_format_unsized(GLenum format)
579 switch (format) {
630 * Test if the given format is a UNORM (unsigned-normalized) format.
633 _mesa_is_enum_format_unorm(GLenum format)
635 switch(format) {
701 * Test if the given format is a SNORM (signed-normalized) format.
704 _mesa_is_enum_format_snorm(GLenum format)
706 switch (format) {
739 * Test if the given format is an integer (non-normalized) format.
742 _mesa_is_enum_format_unsigned_int(GLenum format)
744 switch (format) {
779 * Test if the given format is an integer (non-normalized) format.
782 _mesa_is_enum_format_signed_int(GLenum format)
784 switch (format) {
829 * Test if the given format is an ASTC 2D format.
870 * Test if the given format is an ASTC 3D format.
903 * Test if the given format is an ASTC format.
913 * Test if the given format is an ETC2 format.
936 * Test if the given format is an integer (non-normalized) format.
939 _mesa_is_enum_format_integer(GLenum format)
941 return _mesa_is_enum_format_unsigned_int(format) ||
942 _mesa_is_enum_format_signed_int(format);
978 * Test if the given image format is a color/RGBA format (i.e., not color
980 * \param format the image format value (may by an internal texture format)
981 * \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.
984 _mesa_is_color_format(GLenum format)
986 switch (format) {
1249 * Test if the given image format is a depth component format.
1252 _mesa_is_depth_format(GLenum format)
1254 switch (format) {
1268 * Test if the given image format is a stencil format.
1271 _mesa_is_stencil_format(GLenum format)
1273 switch (format) {
1283 * Test if the given image format is a YCbCr format.
1286 _mesa_is_ycbcr_format(GLenum format)
1288 switch (format) {
1298 * Test if the given image format is a depth+stencil format.
1301 _mesa_is_depthstencil_format(GLenum format)
1303 switch (format) {
1315 * Test if the given image format is a depth or stencil format.
1318 _mesa_is_depth_or_stencil_format(GLenum format)
1320 switch (format) {
1341 * Test if the given image format has a floating-point depth component.
1351 * Test if an image format is a supported compressed format.
1352 * \param format the internal format token provided by the user.
1356 _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
1358 mesa_format m_format = _mesa_glenum_to_compressed_format(format);
1364 switch (format) {
1418 * Test if the given format represents an sRGB format.
1419 * \param format the GL format (can be an internal format)
1420 * \return GL_TRUE if format is sRGB, GL_FALSE otherwise
1423 _mesa_is_srgb_format(GLenum format)
1425 switch (format) {
1465 * Convert various unpack formats to the corresponding base format.
1468 _mesa_unpack_format_to_base_format(GLenum format)
1470 switch(format) {
1505 return format;
1510 * Convert various base formats to the corresponding integer format.
1513 _mesa_base_format_to_integer_format(GLenum format)
1515 switch(format) {
1540 return format;
1545 * Does the given base texture/renderbuffer format have the channel
1644 * If format is a generic compressed format, return the corresponding
1645 * non-compressed format. For other formats, return the format as-is.
1648 _mesa_generic_compressed_format_to_uncompressed_format(GLenum format)
1650 switch (format) {
1677 return format;
1683 * Return the equivalent non-generic internal format.
1687 _mesa_get_nongeneric_internalformat(GLenum format)
1689 switch (format) {
1743 return format;
1749 * Convert an sRGB internal format to linear.
1752 _mesa_get_linear_internalformat(GLenum format)
1754 switch (format) {
1772 return format;
1778 * Do error checking of format/type combinations for glReadPixels,
1779 * glDrawPixels and glTex[Sub]Image. Note that depending on the format
1783 * \param format pixel format.
1790 GLenum format, GLenum type)
1793 * "If the format is DEPTH_STENCIL, then values are taken from
1803 if (_mesa_is_desktop_gl(ctx) && format == GL_DEPTH_STENCIL
1811 if (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX) {
1820 if (format == GL_RGB) {
1823 if (format == GL_RGB_INTEGER_EXT &&
1833 if (format == GL_RGBA ||
1834 format == GL_BGRA ||
1835 format == GL_ABGR_EXT) {
1838 if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) &&
1848 if (format == GL_RGBA ||
1849 format == GL_BGRA) {
1852 if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) &&
1856 if (type == GL_UNSIGNED_INT_2_10_10_10_REV && format == GL_RGB &&
1864 if (ctx->API == API_OPENGLES2 && format == GL_DEPTH_COMPONENT)
1867 if (format != GL_DEPTH_STENCIL) {
1876 if (format != GL_DEPTH_STENCIL) {
1885 if (format != GL_RGB) {
1891 switch (format) {
1911 /* now, for each format, check the type for compatibility */
1912 switch (format) {
2126 /* NOTE: no packed formats w/ BGR format */
2181 * Do error checking of format/type combinations for OpenGL ES glReadPixels
2187 GLenum format, GLenum type,
2192 switch (format) {
2224 /* This format is filtered against invalid dimensionalities elsewhere.
2231 /* This format is filtered against invalid dimensionalities elsewhere.
2240 * the format does not appear to be allowed for 3D textures in OpenGL
2256 * Return the simple base format for a given internal texture format.
2260 * \param internalFormat the internal texture format token or 1, 2, 3, or 4.
2262 * \return the corresponding \u base internal format (GL_ALPHA, GL_LUMINANCE,
2265 * This is the format which is used during texture application (i.e. the
2266 * texture format and env mode determine the arithmetic used.
2326 /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0).
2672 * Returns the effective internal format from a texture format and type.
2674 * the specified internal format is a base (unsized) format.
2676 * This method will only return a valid effective internal format if the
2677 * combination of format, type and internal format in base form, is acceptable.
2679 * If a single sized internal format is defined in the spec (OpenGL-ES 3.0.4) or
2680 * in extensions, to unambiguously correspond to the given base format, then
2681 * that internal format is returned as the effective. Otherwise, if the
2682 * combination is accepted but a single effective format is not defined, the
2683 * passed base format will be returned instead.
2685 * \param format the texture format
2689 gles_effective_internal_format_for_format_and_type(GLenum format,
2694 switch (format) {
2706 * format is returned instead.
2712 return format;
2717 if (format == GL_RGBA)
2722 if (format == GL_RGBA)
2727 if (format == GL_RGB)
2733 if (format == GL_DEPTH_STENCIL)
2738 if (format == GL_DEPTH_STENCIL)
2743 if (format == GL_DEPTH_COMPONENT)
2749 * the format.
2751 if (format == GL_DEPTH_COMPONENT)
2752 return format;
2757 if (format == GL_DEPTH_COMPONENT)
2761 switch (format) {
2769 return format;
2773 switch (format) {
2776 return format;
2782 switch (format) {
2785 return format;
2802 * are required for complete checking between format and type.
2966 * Do error checking of format/type combinations for OpenGL ES 3
2972 GLenum format, GLenum type,
2975 /* If internalFormat is an unsized format, then the effective internal
2976 * format derived from format and type should be used instead. Page 127,
2979 * "if internalformat is a base internal format, the effective
2980 * internal format is a sized internal format that is derived
2981 * from the format and type for internal use by the GL.
2982 * Table 3.12 specifies the mapping of format and type to effective
2983 * internal formats. The effective internal format is used by the GL
2986 * as if the effective internal format was used as the internalformat
2991 gles_effective_internal_format_for_format_and_type(format, type);
2998 /* Unfortunately, _mesa_base_tex_format returns a base format of
3000 * asking the question, "what channels does this format have?"
3023 return format == GL_RGB || format == GL_RGBA ? GL_NO_ERROR :
3035 switch (format) {
3133 if (!_mesa_has_OES_texture_float(ctx) || internalFormat != format)
3142 if (!_mesa_has_OES_texture_half_float(ctx) || internalFormat != format)
3272 if (!_mesa_has_OES_texture_float(ctx) || internalFormat != format)
3281 if (!_mesa_has_OES_texture_half_float(ctx) || internalFormat != format)
3610 if (!_mesa_has_OES_texture_float(ctx) || internalFormat != format)
3614 if (!_mesa_has_OES_texture_half_float(ctx) || internalFormat != format)
3618 if (!(format == internalFormat ||
3619 (format == GL_ALPHA && internalFormat == GL_ALPHA8) ||
3620 (format == GL_LUMINANCE && internalFormat == GL_LUMINANCE8) ||
3621 (format == GL_LUMINANCE_ALPHA &&
3646 get_swizzle_from_gl_format(GLenum format, uint8_t *swizzle)
3648 switch (format) {
3728 /* format/types that are arrays of 8-bit values are unaffected by
3734 * never match a Mesa format.
3741 * Take an OpenGL format (GL_RGB, GL_RGBA, etc), OpenGL data type (GL_INT,
3745 * This function will typically be used to compute a mesa format from a GL type
3752 * mesa_array_format. Clients must check the mesa array format bit
3754 * format is a mesa_array_format or a mesa_format.
3757 _mesa_format_from_format_and_type(GLenum format, GLenum type)
3764 if (format == GL_COLOR_INDEX)
3767 /* Extract array format type information from the OpenGL data type */
3806 /* Extract array format swizzle information from the OpenGL format */
3808 is_array_format = get_swizzle_from_gl_format(format, swizzle);
3810 /* If this is an array format type after checking data type and format,
3811 * create the array format
3815 switch (format) {
3827 normalized = !(_mesa_is_enum_format_integer(format) ||
3828 format == GL_STENCIL_INDEX);
3829 num_channels = _mesa_components_in_format(format);
3836 /* Otherwise this is not an array format, so return the mesa_format
3837 * matching the OpenGL format and data type
3841 if (format == GL_RGB)
3843 else if (format == GL_BGR)
3845 else if (format == GL_RGB_INTEGER)
3849 if (format == GL_RGB)
3851 else if (format == GL_BGR)
3853 else if (format == GL_RGB_INTEGER)
3857 if (format == GL_RGBA)
3859 else if (format == GL_BGRA)
3861 else if (format == GL_ABGR_EXT)
3863 else if (format == GL_RGBA_INTEGER)
3865 else if (format == GL_BGRA_INTEGER)
3869 if (format == GL_RGBA)
3871 else if (format == GL_BGRA)
3873 else if (format == GL_ABGR_EXT)
3875 else if (format == GL_RGBA_INTEGER)
3877 else if (format == GL_BGRA_INTEGER)
3881 if (format == GL_RGBA)
3883 else if (format == GL_BGRA)
3885 else if (format == GL_RGBA_INTEGER)
3887 else if (format == GL_BGRA_INTEGER)
3891 if (format == GL_RGBA)
3893 else if (format == GL_BGRA)
3895 else if (format == GL_RGBA_INTEGER)
3897 else if (format == GL_BGRA_INTEGER)
3901 if (format == GL_RGB)
3903 else if (format == GL_RGB_INTEGER)
3907 if (format == GL_RGB)
3909 else if (format == GL_RGB_INTEGER)
3913 if (format == GL_RGB)
3917 if (format == GL_RGBA)
3919 else if (format == GL_RGBA_INTEGER)
3921 else if (format == GL_BGRA)
3923 else if (format == GL_BGRA_INTEGER)
3927 if (format == GL_RGB)
3929 if (format == GL_RGBA)
3931 else if (format == GL_RGBA_INTEGER)
3933 else if (format == GL_BGRA)
3935 else if (format == GL_BGRA_INTEGER)
3939 if (format == GL_RGBA)
3941 else if (format == GL_BGRA)
3943 else if (format == GL_ABGR_EXT)
3945 else if (format == GL_RGBA_INTEGER)
3947 else if (format == GL_BGRA_INTEGER)
3951 if (format == GL_RGBA)
3953 else if (format == GL_BGRA)
3955 else if (format == GL_ABGR_EXT)
3957 else if (format == GL_RGBA_INTEGER)
3959 else if (format == GL_BGRA_INTEGER)
3963 if (format == GL_YCBCR_MESA)
3967 if (format == GL_YCBCR_MESA)
3971 if (format == GL_RGB)
3975 if (format == GL_DEPTH_COMPONENT)
3979 if (format == GL_DEPTH_COMPONENT)
3983 if (format == GL_DEPTH_COMPONENT)
3987 if (format == GL_DEPTH_STENCIL)
3989 else if (format == GL_DEPTH_COMPONENT)
3993 if (format == GL_DEPTH_STENCIL)
4000 fprintf(stderr, "Unsupported format/type: %s/%s\n",
4001 _mesa_enum_to_string(format),
4004 /* If we got here it means that we could not find a Mesa format that
4005 * matches the GL format/type provided. We may need to add a new Mesa
4006 * format in that case.
4008 unreachable("Unsupported format");
4015 mesa_format format = _mesa_format_from_format_and_type(gl_format, type);
4017 if (_mesa_format_is_mesa_array_format(format))
4018 format = _mesa_format_from_array_format(format);
4020 if (format == MESA_FORMAT_NONE || !ctx->TextureFormatSupported[format])
4023 return format;
4027 * Returns true if \p internal_format is a sized internal format that
4090 * Returns true if \p internal_format is a sized internal format that