mesa: add infra for ARB_shader_clock
[mesa.git] / src / mesa / main / image.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #ifndef IMAGE_H
27 #define IMAGE_H
28
29
30 #include "glheader.h"
31 #include "compiler.h"
32
33 struct gl_context;
34 struct gl_pixelstore_attrib;
35 struct gl_framebuffer;
36
37 extern void
38 _mesa_swap2(GLushort *p, GLuint n);
39
40 extern void
41 _mesa_swap4(GLuint *p, GLuint n);
42
43
44 extern GLintptr
45 _mesa_image_offset( GLuint dimensions,
46 const struct gl_pixelstore_attrib *packing,
47 GLsizei width, GLsizei height,
48 GLenum format, GLenum type,
49 GLint img, GLint row, GLint column );
50
51 extern GLvoid *
52 _mesa_image_address( GLuint dimensions,
53 const struct gl_pixelstore_attrib *packing,
54 const GLvoid *image,
55 GLsizei width, GLsizei height,
56 GLenum format, GLenum type,
57 GLint img, GLint row, GLint column );
58
59 extern GLvoid *
60 _mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
61 const GLvoid *image,
62 GLsizei width,
63 GLenum format, GLenum type,
64 GLint column );
65
66 extern GLvoid *
67 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
68 const GLvoid *image,
69 GLsizei width, GLsizei height,
70 GLenum format, GLenum type,
71 GLint row, GLint column );
72
73 extern GLvoid *
74 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
75 const GLvoid *image,
76 GLsizei width, GLsizei height,
77 GLenum format, GLenum type,
78 GLint img, GLint row, GLint column );
79
80
81 extern GLint
82 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
83 GLint width, GLenum format, GLenum type );
84
85
86 extern GLint
87 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
88 GLint width, GLint height,
89 GLenum format, GLenum type );
90
91
92 extern void
93 _mesa_expand_bitmap(GLsizei width, GLsizei height,
94 const struct gl_pixelstore_attrib *unpack,
95 const GLubyte *bitmap,
96 GLubyte *destBuffer, GLint destStride,
97 GLubyte onValue);
98
99
100 extern void
101 _mesa_convert_colors(GLenum srcType, const GLvoid *src,
102 GLenum dstType, GLvoid *dst,
103 GLuint count, const GLubyte mask[]);
104
105
106 extern GLboolean
107 _mesa_clip_drawpixels(const struct gl_context *ctx,
108 GLint *destX, GLint *destY,
109 GLsizei *width, GLsizei *height,
110 struct gl_pixelstore_attrib *unpack);
111
112
113 extern GLboolean
114 _mesa_clip_readpixels(const struct gl_context *ctx,
115 GLint *srcX, GLint *srcY,
116 GLsizei *width, GLsizei *height,
117 struct gl_pixelstore_attrib *pack);
118
119 extern GLboolean
120 _mesa_clip_copytexsubimage(const struct gl_context *ctx,
121 GLint *destX, GLint *destY,
122 GLint *srcX, GLint *srcY,
123 GLsizei *width, GLsizei *height);
124
125 extern GLboolean
126 _mesa_clip_to_region(GLint xmin, GLint ymin,
127 GLint xmax, GLint ymax,
128 GLint *x, GLint *y,
129 GLsizei *width, GLsizei *height );
130
131 extern GLboolean
132 _mesa_clip_blit(struct gl_context *ctx,
133 const struct gl_framebuffer *readFb,
134 const struct gl_framebuffer *drawFb,
135 GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
136 GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
137
138 void
139 _mesa_swap_bytes_2d_image(GLenum format, GLenum type,
140 const struct gl_pixelstore_attrib *packing,
141 GLsizei width, GLsizei height,
142 GLvoid *dst, const GLvoid *src);
143
144 #endif