1848b8605Smrg/*
2848b8605Smrg * Mesa 3-D graphics library
3848b8605Smrg *
4848b8605Smrg * Copyright (C) 2011  VMware, Inc.  All Rights Reserved.
5848b8605Smrg *
6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7848b8605Smrg * copy of this software and associated documentation files (the "Software"),
8848b8605Smrg * to deal in the Software without restriction, including without limitation
9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the
11848b8605Smrg * Software is furnished to do so, subject to the following conditions:
12848b8605Smrg *
13848b8605Smrg * The above copyright notice and this permission notice shall be included
14848b8605Smrg * in all copies or substantial portions of the Software.
15848b8605Smrg *
16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE.
23848b8605Smrg */
24848b8605Smrg
25848b8605Smrg
26848b8605Smrg#ifndef TEXSTORAGE_H
27848b8605Smrg#define TEXSTORAGE_H
28848b8605Smrg
29b8e80941Smrg/**
30b8e80941Smrg * \name Internal functions
31b8e80941Smrg */
32b8e80941Smrg/*@{*/
33b8e80941Smrg
34b8e80941Smrg/**
35b8e80941Smrg * Texture width, height and depth check shared with the
36b8e80941Smrg * multisample variants of TexStorage functions.
37b8e80941Smrg *
38b8e80941Smrg * From OpenGL 4.5 Core spec, page 260 (section 8.19)
39b8e80941Smrg *
40b8e80941Smrg *     "An INVALID_VALUE error is generated if width, height, depth
41b8e80941Smrg *     or levels are less than 1, for commands with the corresponding
42b8e80941Smrg *     parameters."
43b8e80941Smrg *
44b8e80941Smrg * (referring to TextureStorage* commands, these also match values
45b8e80941Smrg * specified for OpenGL ES 3.1.)
46b8e80941Smrg */
47b8e80941Smrgstatic inline bool
48b8e80941Smrg_mesa_valid_tex_storage_dim(GLsizei width, GLsizei height, GLsizei depth)
49b8e80941Smrg{
50b8e80941Smrg   if (width < 1 || height < 1 || depth < 1)
51b8e80941Smrg      return false;
52b8e80941Smrg   return true;
53b8e80941Smrg}
54b8e80941Smrg
55b8e80941Smrg/*@}*/
56b8e80941Smrg
57b8e80941Smrg/**
58b8e80941Smrg * \name API functions
59b8e80941Smrg */
60b8e80941Smrg/*@{*/
61b8e80941Smrg
62b8e80941Smrgvoid GLAPIENTRY
63b8e80941Smrg_mesa_TexStorage1D_no_error(GLenum target, GLsizei levels,
64b8e80941Smrg                            GLenum internalformat, GLsizei width);
65848b8605Smrg
66848b8605Smrgextern void GLAPIENTRY
67848b8605Smrg_mesa_TexStorage1D(GLenum target, GLsizei levels, GLenum internalformat,
68848b8605Smrg                   GLsizei width);
69848b8605Smrg
70b8e80941Smrgvoid GLAPIENTRY
71b8e80941Smrg_mesa_TexStorage2D_no_error(GLenum target, GLsizei levels,
72b8e80941Smrg                            GLenum internalformat, GLsizei width,
73b8e80941Smrg                            GLsizei height);
74848b8605Smrg
75848b8605Smrgextern void GLAPIENTRY
76848b8605Smrg_mesa_TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat,
77848b8605Smrg                   GLsizei width, GLsizei height);
78848b8605Smrg
79b8e80941Smrgvoid GLAPIENTRY
80b8e80941Smrg_mesa_TexStorage3D_no_error(GLenum target, GLsizei levels,
81b8e80941Smrg                            GLenum internalformat, GLsizei width,
82b8e80941Smrg                            GLsizei height, GLsizei depth);
83848b8605Smrg
84848b8605Smrgextern void GLAPIENTRY
85848b8605Smrg_mesa_TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat,
86848b8605Smrg                   GLsizei width, GLsizei height, GLsizei depth);
87848b8605Smrg
88b8e80941Smrgvoid GLAPIENTRY
89b8e80941Smrg_mesa_TextureStorage1D_no_error(GLuint texture, GLsizei levels,
90b8e80941Smrg                                GLenum internalformat, GLsizei width);
91b8e80941Smrg
92b8e80941Smrgextern void GLAPIENTRY
93b8e80941Smrg_mesa_TextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat,
94b8e80941Smrg                       GLsizei width);
95b8e80941Smrg
96b8e80941Smrgvoid GLAPIENTRY
97b8e80941Smrg_mesa_TextureStorage2D_no_error(GLuint texture, GLsizei levels,
98b8e80941Smrg                                GLenum internalformat, GLsizei width,
99b8e80941Smrg                                GLsizei height);
100b8e80941Smrg
101b8e80941Smrgextern void GLAPIENTRY
102b8e80941Smrg_mesa_TextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat,
103b8e80941Smrg                       GLsizei width, GLsizei height);
104b8e80941Smrg
105b8e80941Smrgvoid GLAPIENTRY
106b8e80941Smrg_mesa_TextureStorage3D_no_error(GLuint texture, GLsizei levels,
107b8e80941Smrg                                GLenum internalformat, GLsizei width,
108b8e80941Smrg                                GLsizei height, GLsizei depth);
109b8e80941Smrg
110b8e80941Smrgextern void GLAPIENTRY
111b8e80941Smrg_mesa_TextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat,
112b8e80941Smrg                       GLsizei width, GLsizei height, GLsizei depth);
113848b8605Smrg
114848b8605Smrg
115848b8605Smrgextern void GLAPIENTRY
116848b8605Smrg_mesa_TextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels,
117848b8605Smrg                          GLenum internalformat,
118848b8605Smrg                          GLsizei width);
119848b8605Smrg
120848b8605Smrgextern void GLAPIENTRY
121848b8605Smrg_mesa_TextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels,
122848b8605Smrg                          GLenum internalformat,
123848b8605Smrg                          GLsizei width, GLsizei height);
124848b8605Smrg
125848b8605Smrgextern void GLAPIENTRY
126848b8605Smrg_mesa_TextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels,
127848b8605Smrg                          GLenum internalformat,
128848b8605Smrg                          GLsizei width, GLsizei height, GLsizei depth);
129848b8605Smrg
130848b8605Smrgextern GLboolean
131b8e80941Smrg_mesa_is_legal_tex_storage_format(const struct gl_context *ctx,
132b8e80941Smrg                                  GLenum internalformat);
133848b8605Smrg
134848b8605Smrgextern GLboolean
135b8e80941Smrg_mesa_AllocTextureStorage_sw(struct gl_context *ctx,
136b8e80941Smrg                             struct gl_texture_object *texObj,
137b8e80941Smrg                             GLsizei levels, GLsizei width,
138b8e80941Smrg                             GLsizei height, GLsizei depth);
139b8e80941Smrg
140b8e80941Smrgextern void
141b8e80941Smrg_mesa_texture_storage_memory(struct gl_context *ctx, GLuint dims,
142b8e80941Smrg                             struct gl_texture_object *texObj,
143b8e80941Smrg                             struct gl_memory_object *memObj,
144b8e80941Smrg                             GLenum target, GLsizei levels,
145b8e80941Smrg                             GLenum internalformat, GLsizei width,
146b8e80941Smrg                             GLsizei height, GLsizei depth,
147b8e80941Smrg                             GLuint64 offset, bool dsa);
148848b8605Smrg
149848b8605Smrg#endif /* TEXSTORAGE_H */
150