xref: /third_party/mesa3d/src/mesa/main/pbo.h (revision bf215546)
1/*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
5 * Copyright (C) 2009-2011  VMware, Inc.  All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27#ifndef PBO_H
28#define PBO_H
29
30
31#include "glheader.h"
32
33struct gl_context;
34struct gl_pixelstore_attrib;
35
36extern GLboolean
37_mesa_validate_pbo_access(GLuint dimensions,
38                          const struct gl_pixelstore_attrib *pack,
39                          GLsizei width, GLsizei height, GLsizei depth,
40                          GLenum format, GLenum type, GLsizei clientMemSize,
41                          const GLvoid *ptr);
42
43extern const GLvoid *
44_mesa_map_pbo_source(struct gl_context *ctx,
45                     const struct gl_pixelstore_attrib *unpack,
46                     const GLvoid *src);
47
48extern const GLvoid *
49_mesa_map_validate_pbo_source(struct gl_context *ctx,
50                              GLuint dimensions,
51                              const struct gl_pixelstore_attrib *unpack,
52                              GLsizei width, GLsizei height, GLsizei depth,
53                              GLenum format, GLenum type, GLsizei clientMemSize,
54                              const GLvoid *ptr, const char *where);
55
56extern void
57_mesa_unmap_pbo_source(struct gl_context *ctx,
58                       const struct gl_pixelstore_attrib *unpack);
59
60extern void *
61_mesa_map_pbo_dest(struct gl_context *ctx,
62                   const struct gl_pixelstore_attrib *pack,
63                   GLvoid *dest);
64
65extern GLvoid *
66_mesa_map_validate_pbo_dest(struct gl_context *ctx,
67                            GLuint dimensions,
68                            const struct gl_pixelstore_attrib *unpack,
69                            GLsizei width, GLsizei height, GLsizei depth,
70                            GLenum format, GLenum type, GLsizei clientMemSize,
71                            GLvoid *ptr, const char *where);
72
73extern void
74_mesa_unmap_pbo_dest(struct gl_context *ctx,
75                     const struct gl_pixelstore_attrib *pack);
76
77
78extern const GLvoid *
79_mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
80			    GLsizei width, GLsizei height, GLsizei depth,
81			    GLenum format, GLenum type, const GLvoid *pixels,
82			    const struct gl_pixelstore_attrib *unpack,
83			    const char *funcName);
84
85extern const GLvoid *
86_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
87                                    GLuint dimensions, GLsizei imageSize,
88                                    const GLvoid *pixels,
89                                    const struct gl_pixelstore_attrib *packing,
90                                    const char *funcName);
91
92extern void
93_mesa_unmap_teximage_pbo(struct gl_context *ctx,
94                         const struct gl_pixelstore_attrib *unpack);
95
96
97extern bool
98_mesa_validate_pbo_source(struct gl_context *ctx, GLuint dimensions,
99                          const struct gl_pixelstore_attrib *unpack,
100                          GLsizei width, GLsizei height, GLsizei depth,
101                          GLenum format, GLenum type,
102                          GLsizei clientMemSize,
103                          const GLvoid *ptr, const char *where);
104
105extern bool
106_mesa_validate_pbo_source_compressed(struct gl_context *ctx, GLuint dimensions,
107                                     const struct gl_pixelstore_attrib *unpack,
108                                     GLsizei imageSize, const GLvoid *ptr,
109                                     const char *where);
110
111#endif
112