1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2007 VMware, Inc.
4bf215546Sopenharmony_ci * Copyright (c) 2010 VMware, Inc.
5bf215546Sopenharmony_ci * All Rights Reserved.
6bf215546Sopenharmony_ci *
7bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
8bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
9bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
10bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
11bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
12bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
13bf215546Sopenharmony_ci * the following conditions:
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
16bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
17bf215546Sopenharmony_ci * of the Software.
18bf215546Sopenharmony_ci *
19bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
23bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26bf215546Sopenharmony_ci *
27bf215546Sopenharmony_ci **************************************************************************/
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci#ifndef ST_FORMAT_H
31bf215546Sopenharmony_ci#define ST_FORMAT_H
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci#include "main/formats.h"
34bf215546Sopenharmony_ci#include "main/glheader.h"
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci#include "pipe/p_format.h"
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ci#ifdef __cplusplus
39bf215546Sopenharmony_ciextern "C" {
40bf215546Sopenharmony_ci#endif
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_cistruct gl_context;
43bf215546Sopenharmony_cistruct st_context;
44bf215546Sopenharmony_cistruct pipe_screen;
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ci
47bf215546Sopenharmony_ciextern enum pipe_format
48bf215546Sopenharmony_cist_mesa_format_to_pipe_format(const struct st_context *st, mesa_format mesaFormat);
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_ciextern mesa_format
51bf215546Sopenharmony_cist_pipe_format_to_mesa_format(enum pipe_format pipeFormat);
52bf215546Sopenharmony_ci
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_ciextern enum pipe_format
55bf215546Sopenharmony_cist_choose_format(struct st_context *st, GLenum internalFormat,
56bf215546Sopenharmony_ci                 GLenum format, GLenum type,
57bf215546Sopenharmony_ci                 enum pipe_texture_target target, unsigned sample_count,
58bf215546Sopenharmony_ci                 unsigned storage_sample_count,
59bf215546Sopenharmony_ci                 unsigned bindings, bool swap_bytes, bool allow_dxt);
60bf215546Sopenharmony_ci
61bf215546Sopenharmony_ciextern enum pipe_format
62bf215546Sopenharmony_cist_choose_matching_format_noverify(struct st_context *st,
63bf215546Sopenharmony_ci                                   GLenum format, GLenum type, GLboolean swapBytes);
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ciextern enum pipe_format
66bf215546Sopenharmony_cist_choose_matching_format(struct st_context *st, unsigned bind,
67bf215546Sopenharmony_ci			  GLenum format, GLenum type, GLboolean swapBytes);
68bf215546Sopenharmony_ci
69bf215546Sopenharmony_ciextern mesa_format
70bf215546Sopenharmony_cist_ChooseTextureFormat(struct gl_context * ctx, GLenum target,
71bf215546Sopenharmony_ci                       GLint internalFormat,
72bf215546Sopenharmony_ci                       GLenum format, GLenum type);
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_civoid
75bf215546Sopenharmony_cist_QueryInternalFormat(struct gl_context *ctx, GLenum target,
76bf215546Sopenharmony_ci                       GLenum internalFormat, GLenum pname, GLint *params);
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_ciextern void
79bf215546Sopenharmony_cist_translate_color(union pipe_color_union *color,
80bf215546Sopenharmony_ci                   GLenum baseFormat, GLboolean is_integer);
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ci#ifdef __cplusplus
83bf215546Sopenharmony_ci}
84bf215546Sopenharmony_ci#endif
85bf215546Sopenharmony_ci
86bf215546Sopenharmony_ci#endif /* ST_FORMAT_H */
87