1*61046927SAndroid Build Coastguard Worker /* 2*61046927SAndroid Build Coastguard Worker * Mesa 3-D graphics library 3*61046927SAndroid Build Coastguard Worker * 4*61046927SAndroid Build Coastguard Worker * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 5*61046927SAndroid Build Coastguard Worker * Copyright (c) 2008 VMware, Inc. 6*61046927SAndroid Build Coastguard Worker * 7*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a 8*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the "Software"), 9*61046927SAndroid Build Coastguard Worker * to deal in the Software without restriction, including without limitation 10*61046927SAndroid Build Coastguard Worker * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11*61046927SAndroid Build Coastguard Worker * and/or sell copies of the Software, and to permit persons to whom the 12*61046927SAndroid Build Coastguard Worker * Software is furnished to do so, subject to the following conditions: 13*61046927SAndroid Build Coastguard Worker * 14*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice shall be included 15*61046927SAndroid Build Coastguard Worker * in all copies or substantial portions of the Software. 16*61046927SAndroid Build Coastguard Worker * 17*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18*61046927SAndroid Build Coastguard Worker * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20*61046927SAndroid Build Coastguard Worker * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21*61046927SAndroid Build Coastguard Worker * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22*61046927SAndroid Build Coastguard Worker * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23*61046927SAndroid Build Coastguard Worker * OTHER DEALINGS IN THE SOFTWARE. 24*61046927SAndroid Build Coastguard Worker */ 25*61046927SAndroid Build Coastguard Worker 26*61046927SAndroid Build Coastguard Worker 27*61046927SAndroid Build Coastguard Worker /** 28*61046927SAndroid Build Coastguard Worker * \file texstore.h 29*61046927SAndroid Build Coastguard Worker * Texture image storage routines. 30*61046927SAndroid Build Coastguard Worker * 31*61046927SAndroid Build Coastguard Worker * \author Brian Paul 32*61046927SAndroid Build Coastguard Worker */ 33*61046927SAndroid Build Coastguard Worker 34*61046927SAndroid Build Coastguard Worker 35*61046927SAndroid Build Coastguard Worker #ifndef TEXSTORE_H 36*61046927SAndroid Build Coastguard Worker #define TEXSTORE_H 37*61046927SAndroid Build Coastguard Worker 38*61046927SAndroid Build Coastguard Worker 39*61046927SAndroid Build Coastguard Worker #include "util/glheader.h" 40*61046927SAndroid Build Coastguard Worker #include "formats.h" 41*61046927SAndroid Build Coastguard Worker #include "util/macros.h" 42*61046927SAndroid Build Coastguard Worker 43*61046927SAndroid Build Coastguard Worker struct gl_context; 44*61046927SAndroid Build Coastguard Worker struct gl_pixelstore_attrib; 45*61046927SAndroid Build Coastguard Worker struct gl_texture_image; 46*61046927SAndroid Build Coastguard Worker 47*61046927SAndroid Build Coastguard Worker /** 48*61046927SAndroid Build Coastguard Worker * This macro defines the (many) parameters to the texstore functions. 49*61046927SAndroid Build Coastguard Worker * \param dims either 1 or 2 or 3 50*61046927SAndroid Build Coastguard Worker * \param baseInternalFormat user-specified base internal format 51*61046927SAndroid Build Coastguard Worker * \param dstFormat destination Mesa texture format 52*61046927SAndroid Build Coastguard Worker * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels 53*61046927SAndroid Build Coastguard Worker * \param dstRowStride destination image row stride, in bytes 54*61046927SAndroid Build Coastguard Worker * \param dstSlices array of addresses of image slices (for 3D, array texture) 55*61046927SAndroid Build Coastguard Worker * \param srcWidth/Height/Depth source image size, in pixels 56*61046927SAndroid Build Coastguard Worker * \param srcFormat incoming image format 57*61046927SAndroid Build Coastguard Worker * \param srcType incoming image data type 58*61046927SAndroid Build Coastguard Worker * \param srcAddr source image address 59*61046927SAndroid Build Coastguard Worker * \param srcPacking source image packing parameters 60*61046927SAndroid Build Coastguard Worker */ 61*61046927SAndroid Build Coastguard Worker #define TEXSTORE_PARAMS \ 62*61046927SAndroid Build Coastguard Worker struct gl_context *ctx, GLuint dims, \ 63*61046927SAndroid Build Coastguard Worker UNUSED GLenum baseInternalFormat, \ 64*61046927SAndroid Build Coastguard Worker UNUSED mesa_format dstFormat, \ 65*61046927SAndroid Build Coastguard Worker GLint dstRowStride, \ 66*61046927SAndroid Build Coastguard Worker GLubyte **dstSlices, \ 67*61046927SAndroid Build Coastguard Worker GLint srcWidth, GLint srcHeight, GLint srcDepth, \ 68*61046927SAndroid Build Coastguard Worker GLenum srcFormat, GLenum srcType, \ 69*61046927SAndroid Build Coastguard Worker const GLvoid *srcAddr, \ 70*61046927SAndroid Build Coastguard Worker const struct gl_pixelstore_attrib *srcPacking 71*61046927SAndroid Build Coastguard Worker 72*61046927SAndroid Build Coastguard Worker /* This macro must be kept in sync with TEXSTORE_PARAMS. It is used in the 73*61046927SAndroid Build Coastguard Worker * few places where none of the parameters are used (i.e., the ETC texstore 74*61046927SAndroid Build Coastguard Worker * functions). 75*61046927SAndroid Build Coastguard Worker */ 76*61046927SAndroid Build Coastguard Worker #define UNUSED_TEXSTORE_PARAMS \ 77*61046927SAndroid Build Coastguard Worker UNUSED struct gl_context *ctx, UNUSED GLuint dims, \ 78*61046927SAndroid Build Coastguard Worker UNUSED GLenum baseInternalFormat, \ 79*61046927SAndroid Build Coastguard Worker UNUSED mesa_format dstFormat, \ 80*61046927SAndroid Build Coastguard Worker UNUSED GLint dstRowStride, \ 81*61046927SAndroid Build Coastguard Worker UNUSED GLubyte **dstSlices, \ 82*61046927SAndroid Build Coastguard Worker UNUSED GLint srcWidth, UNUSED GLint srcHeight, UNUSED GLint srcDepth, \ 83*61046927SAndroid Build Coastguard Worker UNUSED GLenum srcFormat, UNUSED GLenum srcType, \ 84*61046927SAndroid Build Coastguard Worker UNUSED const GLvoid *srcAddr, \ 85*61046927SAndroid Build Coastguard Worker UNUSED const struct gl_pixelstore_attrib *srcPacking 86*61046927SAndroid Build Coastguard Worker 87*61046927SAndroid Build Coastguard Worker extern GLboolean 88*61046927SAndroid Build Coastguard Worker _mesa_texstore(TEXSTORE_PARAMS); 89*61046927SAndroid Build Coastguard Worker 90*61046927SAndroid Build Coastguard Worker extern GLboolean 91*61046927SAndroid Build Coastguard Worker _mesa_texstore_needs_transfer_ops(struct gl_context *ctx, 92*61046927SAndroid Build Coastguard Worker GLenum baseInternalFormat, 93*61046927SAndroid Build Coastguard Worker mesa_format dstFormat); 94*61046927SAndroid Build Coastguard Worker 95*61046927SAndroid Build Coastguard Worker extern void 96*61046927SAndroid Build Coastguard Worker _mesa_memcpy_texture(struct gl_context *ctx, 97*61046927SAndroid Build Coastguard Worker GLuint dimensions, 98*61046927SAndroid Build Coastguard Worker mesa_format dstFormat, 99*61046927SAndroid Build Coastguard Worker GLint dstRowStride, 100*61046927SAndroid Build Coastguard Worker GLubyte **dstSlices, 101*61046927SAndroid Build Coastguard Worker GLint srcWidth, GLint srcHeight, GLint srcDepth, 102*61046927SAndroid Build Coastguard Worker GLenum srcFormat, GLenum srcType, 103*61046927SAndroid Build Coastguard Worker const GLvoid *srcAddr, 104*61046927SAndroid Build Coastguard Worker const struct gl_pixelstore_attrib *srcPacking); 105*61046927SAndroid Build Coastguard Worker 106*61046927SAndroid Build Coastguard Worker extern GLboolean 107*61046927SAndroid Build Coastguard Worker _mesa_texstore_can_use_memcpy(struct gl_context *ctx, 108*61046927SAndroid Build Coastguard Worker GLenum baseInternalFormat, mesa_format dstFormat, 109*61046927SAndroid Build Coastguard Worker GLenum srcFormat, GLenum srcType, 110*61046927SAndroid Build Coastguard Worker const struct gl_pixelstore_attrib *srcPacking); 111*61046927SAndroid Build Coastguard Worker 112*61046927SAndroid Build Coastguard Worker 113*61046927SAndroid Build Coastguard Worker extern void 114*61046927SAndroid Build Coastguard Worker _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, 115*61046927SAndroid Build Coastguard Worker struct gl_texture_image *texImage, 116*61046927SAndroid Build Coastguard Worker GLint xoffset, GLint yoffset, GLint zoffset, 117*61046927SAndroid Build Coastguard Worker GLint width, GLint height, GLint depth, 118*61046927SAndroid Build Coastguard Worker GLenum format, GLenum type, const GLvoid *pixels, 119*61046927SAndroid Build Coastguard Worker const struct gl_pixelstore_attrib *packing); 120*61046927SAndroid Build Coastguard Worker 121*61046927SAndroid Build Coastguard Worker 122*61046927SAndroid Build Coastguard Worker extern void 123*61046927SAndroid Build Coastguard Worker _mesa_store_cleartexsubimage(struct gl_context *ctx, 124*61046927SAndroid Build Coastguard Worker struct gl_texture_image *texImage, 125*61046927SAndroid Build Coastguard Worker GLint xoffset, GLint yoffset, GLint zoffset, 126*61046927SAndroid Build Coastguard Worker GLsizei width, GLsizei height, GLsizei depth, 127*61046927SAndroid Build Coastguard Worker const GLvoid *clearValue); 128*61046927SAndroid Build Coastguard Worker 129*61046927SAndroid Build Coastguard Worker extern void 130*61046927SAndroid Build Coastguard Worker _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, 131*61046927SAndroid Build Coastguard Worker struct gl_texture_image *texImage, 132*61046927SAndroid Build Coastguard Worker GLsizei imageSize, const GLvoid *data); 133*61046927SAndroid Build Coastguard Worker 134*61046927SAndroid Build Coastguard Worker 135*61046927SAndroid Build Coastguard Worker extern void 136*61046927SAndroid Build Coastguard Worker _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, 137*61046927SAndroid Build Coastguard Worker struct gl_texture_image *texImage, 138*61046927SAndroid Build Coastguard Worker GLint xoffset, GLint yoffset, GLint zoffset, 139*61046927SAndroid Build Coastguard Worker GLsizei width, GLsizei height, GLsizei depth, 140*61046927SAndroid Build Coastguard Worker GLenum format, 141*61046927SAndroid Build Coastguard Worker GLsizei imageSize, const GLvoid *data); 142*61046927SAndroid Build Coastguard Worker 143*61046927SAndroid Build Coastguard Worker 144*61046927SAndroid Build Coastguard Worker struct compressed_pixelstore { 145*61046927SAndroid Build Coastguard Worker int SkipBytes; 146*61046927SAndroid Build Coastguard Worker int CopyBytesPerRow; 147*61046927SAndroid Build Coastguard Worker int CopyRowsPerSlice; 148*61046927SAndroid Build Coastguard Worker int TotalBytesPerRow; 149*61046927SAndroid Build Coastguard Worker int TotalRowsPerSlice; 150*61046927SAndroid Build Coastguard Worker int CopySlices; 151*61046927SAndroid Build Coastguard Worker }; 152*61046927SAndroid Build Coastguard Worker 153*61046927SAndroid Build Coastguard Worker 154*61046927SAndroid Build Coastguard Worker extern void 155*61046927SAndroid Build Coastguard Worker _mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat, 156*61046927SAndroid Build Coastguard Worker GLsizei width, GLsizei height, 157*61046927SAndroid Build Coastguard Worker GLsizei depth, 158*61046927SAndroid Build Coastguard Worker const struct gl_pixelstore_attrib *packing, 159*61046927SAndroid Build Coastguard Worker struct compressed_pixelstore *store); 160*61046927SAndroid Build Coastguard Worker 161*61046927SAndroid Build Coastguard Worker 162*61046927SAndroid Build Coastguard Worker #endif 163