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