17117f1b4Smrg/* 27117f1b4Smrg * Mesa 3-D graphics library 37117f1b4Smrg * 47117f1b4Smrg * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 54a49301eSmrg * Copyright (c) 2008 VMware, Inc. 67117f1b4Smrg * 77117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a 87117f1b4Smrg * copy of this software and associated documentation files (the "Software"), 97117f1b4Smrg * to deal in the Software without restriction, including without limitation 107117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 117117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the 127117f1b4Smrg * Software is furnished to do so, subject to the following conditions: 137117f1b4Smrg * 147117f1b4Smrg * The above copyright notice and this permission notice shall be included 157117f1b4Smrg * in all copies or substantial portions of the Software. 167117f1b4Smrg * 177117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 187117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 197117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE. 247117f1b4Smrg */ 257117f1b4Smrg 267117f1b4Smrg 277117f1b4Smrg/** 287117f1b4Smrg * \file texstore.h 297117f1b4Smrg * Texture image storage routines. 307117f1b4Smrg * 317117f1b4Smrg * \author Brian Paul 327117f1b4Smrg */ 337117f1b4Smrg 347117f1b4Smrg 357117f1b4Smrg#ifndef TEXSTORE_H 367117f1b4Smrg#define TEXSTORE_H 377117f1b4Smrg 387117f1b4Smrg 3901e04c3fSmrg#include "glheader.h" 404a49301eSmrg#include "formats.h" 4101e04c3fSmrg#include "util/macros.h" 427117f1b4Smrg 4301e04c3fSmrgstruct gl_context; 4401e04c3fSmrgstruct gl_pixelstore_attrib; 4501e04c3fSmrgstruct gl_texture_image; 467117f1b4Smrg 474a49301eSmrg/** 484a49301eSmrg * This macro defines the (many) parameters to the texstore functions. 494a49301eSmrg * \param dims either 1 or 2 or 3 504a49301eSmrg * \param baseInternalFormat user-specified base internal format 514a49301eSmrg * \param dstFormat destination Mesa texture format 524a49301eSmrg * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels 534a49301eSmrg * \param dstRowStride destination image row stride, in bytes 54af69d88dSmrg * \param dstSlices array of addresses of image slices (for 3D, array texture) 554a49301eSmrg * \param srcWidth/Height/Depth source image size, in pixels 564a49301eSmrg * \param srcFormat incoming image format 574a49301eSmrg * \param srcType incoming image data type 584a49301eSmrg * \param srcAddr source image address 594a49301eSmrg * \param srcPacking source image packing parameters 604a49301eSmrg */ 614a49301eSmrg#define TEXSTORE_PARAMS \ 623464ebd5Sriastradh struct gl_context *ctx, GLuint dims, \ 637ec681f3Smrg UNUSED GLenum baseInternalFormat, \ 647ec681f3Smrg UNUSED mesa_format dstFormat, \ 65af69d88dSmrg GLint dstRowStride, \ 66af69d88dSmrg GLubyte **dstSlices, \ 674a49301eSmrg GLint srcWidth, GLint srcHeight, GLint srcDepth, \ 684a49301eSmrg GLenum srcFormat, GLenum srcType, \ 694a49301eSmrg const GLvoid *srcAddr, \ 704a49301eSmrg const struct gl_pixelstore_attrib *srcPacking 714a49301eSmrg 7201e04c3fSmrg/* This macro must be kept in sync with TEXSTORE_PARAMS. It is used in the 7301e04c3fSmrg * few places where none of the parameters are used (i.e., the ETC texstore 7401e04c3fSmrg * functions). 7501e04c3fSmrg */ 7601e04c3fSmrg#define UNUSED_TEXSTORE_PARAMS \ 7701e04c3fSmrg UNUSED struct gl_context *ctx, UNUSED GLuint dims, \ 7801e04c3fSmrg UNUSED GLenum baseInternalFormat, \ 7901e04c3fSmrg UNUSED mesa_format dstFormat, \ 8001e04c3fSmrg UNUSED GLint dstRowStride, \ 8101e04c3fSmrg UNUSED GLubyte **dstSlices, \ 8201e04c3fSmrg UNUSED GLint srcWidth, UNUSED GLint srcHeight, UNUSED GLint srcDepth, \ 8301e04c3fSmrg UNUSED GLenum srcFormat, UNUSED GLenum srcType, \ 8401e04c3fSmrg UNUSED const GLvoid *srcAddr, \ 8501e04c3fSmrg UNUSED const struct gl_pixelstore_attrib *srcPacking 864a49301eSmrg 874a49301eSmrgextern GLboolean 884a49301eSmrg_mesa_texstore(TEXSTORE_PARAMS); 897117f1b4Smrg 90af69d88dSmrgextern GLboolean 91af69d88dSmrg_mesa_texstore_needs_transfer_ops(struct gl_context *ctx, 92af69d88dSmrg GLenum baseInternalFormat, 93af69d88dSmrg mesa_format dstFormat); 94af69d88dSmrg 9501e04c3fSmrgextern void 9601e04c3fSmrg_mesa_memcpy_texture(struct gl_context *ctx, 9701e04c3fSmrg GLuint dimensions, 9801e04c3fSmrg mesa_format dstFormat, 9901e04c3fSmrg GLint dstRowStride, 10001e04c3fSmrg GLubyte **dstSlices, 10101e04c3fSmrg GLint srcWidth, GLint srcHeight, GLint srcDepth, 10201e04c3fSmrg GLenum srcFormat, GLenum srcType, 10301e04c3fSmrg const GLvoid *srcAddr, 10401e04c3fSmrg const struct gl_pixelstore_attrib *srcPacking); 10501e04c3fSmrg 106af69d88dSmrgextern GLboolean 107af69d88dSmrg_mesa_texstore_can_use_memcpy(struct gl_context *ctx, 108af69d88dSmrg GLenum baseInternalFormat, mesa_format dstFormat, 109af69d88dSmrg GLenum srcFormat, GLenum srcType, 110af69d88dSmrg const struct gl_pixelstore_attrib *srcPacking); 1117117f1b4Smrg 112af69d88dSmrg 1137117f1b4Smrgextern void 114af69d88dSmrg_mesa_store_teximage(struct gl_context *ctx, 115af69d88dSmrg GLuint dims, 116af69d88dSmrg struct gl_texture_image *texImage, 117af69d88dSmrg GLenum format, GLenum type, const GLvoid *pixels, 118af69d88dSmrg const struct gl_pixelstore_attrib *packing); 1197117f1b4Smrg 1207117f1b4Smrg 1217117f1b4Smrgextern void 122af69d88dSmrg_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, 123af69d88dSmrg struct gl_texture_image *texImage, 124af69d88dSmrg GLint xoffset, GLint yoffset, GLint zoffset, 125af69d88dSmrg GLint width, GLint height, GLint depth, 126af69d88dSmrg GLenum format, GLenum type, const GLvoid *pixels, 127af69d88dSmrg const struct gl_pixelstore_attrib *packing); 1287117f1b4Smrg 1297117f1b4Smrg 1307117f1b4Smrgextern void 131af69d88dSmrg_mesa_store_cleartexsubimage(struct gl_context *ctx, 132af69d88dSmrg struct gl_texture_image *texImage, 133af69d88dSmrg GLint xoffset, GLint yoffset, GLint zoffset, 134af69d88dSmrg GLsizei width, GLsizei height, GLsizei depth, 135af69d88dSmrg const GLvoid *clearValue); 1367117f1b4Smrg 1377117f1b4Smrgextern void 138af69d88dSmrg_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, 139af69d88dSmrg struct gl_texture_image *texImage, 140af69d88dSmrg GLsizei imageSize, const GLvoid *data); 1417117f1b4Smrg 1427117f1b4Smrg 1437117f1b4Smrgextern void 144af69d88dSmrg_mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, 145af69d88dSmrg struct gl_texture_image *texImage, 146af69d88dSmrg GLint xoffset, GLint yoffset, GLint zoffset, 147af69d88dSmrg GLsizei width, GLsizei height, GLsizei depth, 148af69d88dSmrg GLenum format, 149af69d88dSmrg GLsizei imageSize, const GLvoid *data); 1507117f1b4Smrg 1517117f1b4Smrg 152af69d88dSmrgstruct compressed_pixelstore { 153af69d88dSmrg int SkipBytes; 154af69d88dSmrg int CopyBytesPerRow; 155af69d88dSmrg int CopyRowsPerSlice; 156af69d88dSmrg int TotalBytesPerRow; 157af69d88dSmrg int TotalRowsPerSlice; 158af69d88dSmrg int CopySlices; 159af69d88dSmrg}; 1607117f1b4Smrg 1617117f1b4Smrg 1627117f1b4Smrgextern void 163af69d88dSmrg_mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat, 164af69d88dSmrg GLsizei width, GLsizei height, 165af69d88dSmrg GLsizei depth, 166af69d88dSmrg const struct gl_pixelstore_attrib *packing, 167af69d88dSmrg struct compressed_pixelstore *store); 1687117f1b4Smrg 1697117f1b4Smrg 1707117f1b4Smrg#endif 171