18e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul/*
28e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * Mesa 3-D graphics library
3a9bcf751030895494fc098f8d0ff56b2496bd993Brian Paul * Version:  6.5.1
48e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
5a9bcf751030895494fc098f8d0ff56b2496bd993Brian Paul * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
65bd093bd7b3711f88e1fd0fc9cdb37a18d7d24b9Roland Scheidegger * Copyright (c) 2008 VMware, Inc.
78e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
88e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * Permission is hereby granted, free of charge, to any person obtaining a
98e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * copy of this software and associated documentation files (the "Software"),
108e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * to deal in the Software without restriction, including without limitation
118e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * the rights to use, copy, modify, merge, publish, distribute, sublicense,
128e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * and/or sell copies of the Software, and to permit persons to whom the
138e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * Software is furnished to do so, subject to the following conditions:
148e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
158e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * The above copyright notice and this permission notice shall be included
168e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * in all copies or substantial portions of the Software.
178e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
188e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
198e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
208e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
218e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
228e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
238e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
248e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul */
258e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
268e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
27f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul/**
28f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul * \file texstore.h
29f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul * Texture image storage routines.
30f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul *
31f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul * \author Brian Paul
32f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul */
33f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul
34f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul
358e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul#ifndef TEXSTORE_H
368e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul#define TEXSTORE_H
378e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
388e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
398e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul#include "mtypes.h"
40485105ed182e2e997b084f047e72d5a2c3460057Brian Paul#include "formats.h"
418e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
42f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul
43cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul/**
44cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * This macro defines the (many) parameters to the texstore functions.
45cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param dims  either 1 or 2 or 3
46cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param baseInternalFormat  user-specified base internal format
47cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param dstFormat  destination Mesa texture format
48cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param dstX/Y/Zoffset  destination x/y/z offset (ala TexSubImage), in texels
49cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param dstRowStride  destination image row stride, in bytes
505253cf98057dad54e25b4b8c36f8cf24f559314cBrian Paul * \param dstSlices  array of addresses of image slices (for 3D, array texture)
51cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param srcWidth/Height/Depth  source image size, in pixels
52cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param srcFormat  incoming image format
53cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param srcType  incoming image data type
54cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param srcAddr  source image address
55cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul * \param srcPacking  source image packing parameters
56cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul */
57cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul#define TEXSTORE_PARAMS \
58f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg	struct gl_context *ctx, GLuint dims, \
59cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul	GLenum baseInternalFormat, \
601f7c914ad0beea8a29c1a171c7cd1a12f2efe0faBrian Paul	gl_format dstFormat, \
615253cf98057dad54e25b4b8c36f8cf24f559314cBrian Paul        GLint dstRowStride, \
625253cf98057dad54e25b4b8c36f8cf24f559314cBrian Paul        GLubyte **dstSlices, \
63cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul	GLint srcWidth, GLint srcHeight, GLint srcDepth, \
64cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul	GLenum srcFormat, GLenum srcType, \
65cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul	const GLvoid *srcAddr, \
66cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul	const struct gl_pixelstore_attrib *srcPacking
67cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul
68cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul
69e2e7bd6c1f979179e6840cf0e8db72fc72751650Brian Paulextern GLboolean
70e2e7bd6c1f979179e6840cf0e8db72fc72751650Brian Paul_mesa_texstore(TEXSTORE_PARAMS);
71cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul
72cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47Brian Paul
73663f61a3e177a443c36f414a16a9d5f94e74135dBrian Paulextern GLubyte *
74663f61a3e177a443c36f414a16a9d5f94e74135dBrian Paul_mesa_make_temp_ubyte_image(struct gl_context *ctx, GLuint dims,
758f04c12e0ad876baa7eb9ed379e2b00150b376e0Brian Paul                           GLenum logicalBaseFormat,
768f04c12e0ad876baa7eb9ed379e2b00150b376e0Brian Paul                           GLenum textureBaseFormat,
778f04c12e0ad876baa7eb9ed379e2b00150b376e0Brian Paul                           GLint srcWidth, GLint srcHeight, GLint srcDepth,
788f04c12e0ad876baa7eb9ed379e2b00150b376e0Brian Paul                           GLenum srcFormat, GLenum srcType,
798f04c12e0ad876baa7eb9ed379e2b00150b376e0Brian Paul                           const GLvoid *srcAddr,
808f04c12e0ad876baa7eb9ed379e2b00150b376e0Brian Paul                           const struct gl_pixelstore_attrib *srcPacking);
818f04c12e0ad876baa7eb9ed379e2b00150b376e0Brian Paul
82e792e79f5ae6be008d9521eccf1c647492cd682aDave AirlieGLfloat *
83e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie_mesa_make_temp_float_image(struct gl_context *ctx, GLuint dims,
84e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie			    GLenum logicalBaseFormat,
85e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie			    GLenum textureBaseFormat,
86e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie			    GLint srcWidth, GLint srcHeight, GLint srcDepth,
87e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie			    GLenum srcFormat, GLenum srcType,
88e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie			    const GLvoid *srcAddr,
89e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie			    const struct gl_pixelstore_attrib *srcPacking,
90e792e79f5ae6be008d9521eccf1c647492cd682aDave Airlie			    GLbitfield transferOps);
91f959f6e1dc27c71fc0ccc56e09b29101b3bf3b97Brian Paul
928e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulextern void
938f5fffe75d2f8ae7c7ee706b53379a25bc673ae4Brian Paul_mesa_store_teximage(struct gl_context *ctx,
948f5fffe75d2f8ae7c7ee706b53379a25bc673ae4Brian Paul                     GLuint dims,
958f5fffe75d2f8ae7c7ee706b53379a25bc673ae4Brian Paul                     struct gl_texture_image *texImage,
968f5fffe75d2f8ae7c7ee706b53379a25bc673ae4Brian Paul                     GLenum format, GLenum type, const GLvoid *pixels,
978f5fffe75d2f8ae7c7ee706b53379a25bc673ae4Brian Paul                     const struct gl_pixelstore_attrib *packing);
988e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
998e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
1008e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulextern void
101e42d00b3f4503a0840575c8e5f4517a66c8af613Brian Paul_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims,
102e42d00b3f4503a0840575c8e5f4517a66c8af613Brian Paul                        struct gl_texture_image *texImage,
103e42d00b3f4503a0840575c8e5f4517a66c8af613Brian Paul                        GLint xoffset, GLint yoffset, GLint zoffset,
104e42d00b3f4503a0840575c8e5f4517a66c8af613Brian Paul                        GLint width, GLint height, GLint depth,
105e42d00b3f4503a0840575c8e5f4517a66c8af613Brian Paul                        GLenum format, GLenum type, const GLvoid *pixels,
106e42d00b3f4503a0840575c8e5f4517a66c8af613Brian Paul                        const struct gl_pixelstore_attrib *packing);
1078e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
1088e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
1092aadbf41dfd4f63c6118d0ad2d8659d289cbe454Brian Paulextern void
110e8fdd0e0d5286f4a9c763ffde44decec51124ebcBrian Paul_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
111e8fdd0e0d5286f4a9c763ffde44decec51124ebcBrian Paul                                struct gl_texture_image *texImage,
112e8fdd0e0d5286f4a9c763ffde44decec51124ebcBrian Paul                                GLsizei imageSize, const GLvoid *data);
1138e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
1148e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
115e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paulextern void
116ec19bdd16c3d4070af69fd865042babe0a627595Brian Paul_mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
117ec19bdd16c3d4070af69fd865042babe0a627595Brian Paul                                   struct gl_texture_image *texImage,
118ec19bdd16c3d4070af69fd865042babe0a627595Brian Paul                                   GLint xoffset, GLint yoffset, GLint zoffset,
119ec19bdd16c3d4070af69fd865042babe0a627595Brian Paul                                   GLsizei width, GLsizei height, GLsizei depth,
120ec19bdd16c3d4070af69fd865042babe0a627595Brian Paul                                   GLenum format,
121ec19bdd16c3d4070af69fd865042babe0a627595Brian Paul                                   GLsizei imageSize, const GLvoid *data);
122e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul
123e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul
1248e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul#endif
125