glformats.h revision 7ec681f3
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 <stdint.h> 33#include <GL/gl.h> 34 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40struct gl_context; 41 42extern void 43_mesa_compute_component_mapping(GLenum inFormat, GLenum outFormat, GLubyte *map); 44 45extern GLboolean 46_mesa_type_is_packed(GLenum type); 47 48extern GLint 49_mesa_sizeof_type( GLenum type ); 50 51extern GLint 52_mesa_sizeof_packed_type( GLenum type ); 53 54extern GLint 55_mesa_components_in_format( GLenum format ); 56 57extern GLint 58_mesa_bytes_per_pixel( GLenum format, GLenum type ); 59 60extern GLint 61_mesa_bytes_per_vertex_attrib(GLint comps, GLenum type); 62 63extern GLboolean 64_mesa_is_astc_format(GLenum internalFormat); 65 66extern GLboolean 67_mesa_is_etc2_format(GLenum internalFormat); 68 69extern GLboolean 70_mesa_is_type_unsigned(GLenum type); 71 72extern GLboolean 73_mesa_is_enum_format_unsized(GLenum format); 74 75extern GLboolean 76_mesa_is_enum_format_unorm(GLenum format); 77 78extern GLboolean 79_mesa_is_enum_format_snorm(GLenum format); 80 81extern GLboolean 82_mesa_is_enum_format_integer(GLenum format); 83 84extern GLboolean 85_mesa_is_enum_format_unsigned_int(GLenum format); 86 87extern GLboolean 88_mesa_is_enum_format_signed_int(GLenum format); 89 90extern GLboolean 91_mesa_is_color_format(GLenum format); 92 93extern GLboolean 94_mesa_is_depth_format(GLenum format); 95 96extern GLboolean 97_mesa_is_stencil_format(GLenum format); 98 99extern GLboolean 100_mesa_is_ycbcr_format(GLenum format); 101 102extern GLboolean 103_mesa_is_depthstencil_format(GLenum format); 104 105extern GLboolean 106_mesa_is_depth_or_stencil_format(GLenum format); 107 108extern GLboolean 109_mesa_has_depth_float_channel(GLenum internalFormat); 110 111extern GLboolean 112_mesa_is_compressed_format(const struct gl_context *ctx, GLenum format); 113 114extern GLboolean 115_mesa_is_srgb_format(GLenum format); 116 117extern GLenum 118_mesa_base_format_to_integer_format(GLenum format); 119 120extern GLenum 121_mesa_unpack_format_to_base_format(GLenum format); 122 123extern GLboolean 124_mesa_base_format_has_channel(GLenum base_format, GLenum pname); 125 126extern GLenum 127_mesa_generic_compressed_format_to_uncompressed_format(GLenum format); 128 129extern GLenum 130_mesa_get_nongeneric_internalformat(GLenum format); 131 132extern GLenum 133_mesa_get_linear_internalformat(GLenum format); 134 135extern GLenum 136_mesa_error_check_format_and_type(const struct gl_context *ctx, 137 GLenum format, GLenum type); 138 139extern GLenum 140_mesa_es_error_check_format_and_type(const struct gl_context *ctx, 141 GLenum format, GLenum type, 142 unsigned dimensions); 143 144extern GLenum 145_mesa_gles_error_check_format_and_type(const struct gl_context *ctx, 146 GLenum format, GLenum type, 147 GLenum internalFormat); 148extern GLint 149_mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat ); 150 151extern uint32_t 152_mesa_format_from_format_and_type(GLenum format, GLenum type); 153 154bool 155_mesa_swap_bytes_in_type_enum(GLenum *type); 156 157extern uint32_t 158_mesa_tex_format_from_format_and_type(const struct gl_context *ctx, 159 GLenum gl_format, GLenum type); 160 161extern bool 162_mesa_is_es3_color_renderable(const struct gl_context *ctx, 163 GLenum internal_format); 164 165extern bool 166_mesa_is_es3_texture_filterable(const struct gl_context *ctx, 167 GLenum internal_format); 168 169#ifdef __cplusplus 170} 171#endif 172 173#endif /* GLFORMATS_H */ 174