1/* 2 * Mesa 3-D graphics library 3 * 4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. 5 * Copyright (c) 2008-2009 VMware, Inc. 6 * Copyright (c) 2012 Intel Corporation 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a 9 * copy of this software and associated documentation files (the "Software"), 10 * to deal in the Software without restriction, including without limitation 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * and/or sell copies of the Software, and to permit persons to whom the 13 * Software is furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice shall be included 16 * in all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 * OTHER DEALINGS IN THE SOFTWARE. 25 */ 26 27#ifndef GLFORMATS_H 28#define GLFORMATS_H 29 30 31#include <stdbool.h> 32#include <GL/gl.h> 33 34 35#ifdef __cplusplus 36extern "C" { 37#endif 38 39struct gl_context; 40 41extern void 42_mesa_compute_component_mapping(GLenum inFormat, GLenum outFormat, GLubyte *map); 43 44extern GLboolean 45_mesa_type_is_packed(GLenum type); 46 47extern GLint 48_mesa_sizeof_type( GLenum type ); 49 50extern GLint 51_mesa_sizeof_packed_type( GLenum type ); 52 53extern GLint 54_mesa_components_in_format( GLenum format ); 55 56extern GLint 57_mesa_bytes_per_pixel( GLenum format, GLenum type ); 58 59extern GLint 60_mesa_bytes_per_vertex_attrib(GLint comps, GLenum type); 61 62extern GLboolean 63_mesa_is_astc_format(GLenum internalFormat); 64 65extern GLboolean 66_mesa_is_etc2_format(GLenum internalFormat); 67 68extern GLboolean 69_mesa_is_type_unsigned(GLenum type); 70 71extern GLboolean 72_mesa_is_enum_format_unsized(GLenum format); 73 74extern GLboolean 75_mesa_is_enum_format_unorm(GLenum format); 76 77extern GLboolean 78_mesa_is_enum_format_snorm(GLenum format); 79 80extern GLboolean 81_mesa_is_enum_format_integer(GLenum format); 82 83extern GLboolean 84_mesa_is_enum_format_unsigned_int(GLenum format); 85 86extern GLboolean 87_mesa_is_enum_format_signed_int(GLenum format); 88 89extern GLboolean 90_mesa_is_color_format(GLenum format); 91 92extern GLboolean 93_mesa_is_depth_format(GLenum format); 94 95extern GLboolean 96_mesa_is_stencil_format(GLenum format); 97 98extern GLboolean 99_mesa_is_ycbcr_format(GLenum format); 100 101extern GLboolean 102_mesa_is_depthstencil_format(GLenum format); 103 104extern GLboolean 105_mesa_is_depth_or_stencil_format(GLenum format); 106 107extern GLboolean 108_mesa_is_compressed_format(const struct gl_context *ctx, GLenum format); 109 110extern GLboolean 111_mesa_is_srgb_format(GLenum format); 112 113extern GLenum 114_mesa_base_format_to_integer_format(GLenum format); 115 116extern GLenum 117_mesa_unpack_format_to_base_format(GLenum format); 118 119extern GLboolean 120_mesa_base_format_has_channel(GLenum base_format, GLenum pname); 121 122extern GLenum 123_mesa_generic_compressed_format_to_uncompressed_format(GLenum format); 124 125extern GLenum 126_mesa_get_nongeneric_internalformat(GLenum format); 127 128extern GLenum 129_mesa_get_linear_internalformat(GLenum format); 130 131extern GLenum 132_mesa_error_check_format_and_type(const struct gl_context *ctx, 133 GLenum format, GLenum type); 134 135extern GLenum 136_mesa_es_error_check_format_and_type(const struct gl_context *ctx, 137 GLenum format, GLenum type, 138 unsigned dimensions); 139 140extern GLenum 141_mesa_gles_error_check_format_and_type(const struct gl_context *ctx, 142 GLenum format, GLenum type, 143 GLenum internalFormat); 144extern GLint 145_mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat ); 146 147extern uint32_t 148_mesa_format_from_format_and_type(GLenum format, GLenum type); 149 150extern uint32_t 151_mesa_tex_format_from_format_and_type(const struct gl_context *ctx, 152 GLenum gl_format, GLenum type); 153 154extern bool 155_mesa_is_es3_color_renderable(const struct gl_context *ctx, 156 GLenum internal_format); 157 158extern bool 159_mesa_is_es3_texture_filterable(const struct gl_context *ctx, 160 GLenum internal_format); 161 162#ifdef __cplusplus 163} 164#endif 165 166#endif /* GLFORMATS_H */ 167