1 #ifndef GLES_TEXTURE_UTILS_H 2 #define GLES_TEXTURE_UTILS_H 3 4 #include <GLES3/gl31.h> 5 6 namespace GLESTextureUtils { 7 8 void computeTextureStartEnd( 9 GLsizei width, GLsizei height, GLsizei depth, 10 GLenum format, GLenum type, 11 int unpackAlignment, 12 int unpackRowLength, 13 int unpackImageHeight, 14 int unpackSkipPixels, 15 int unpackSkipRows, 16 int unpackSkipImages, 17 int* start, 18 int* end); 19 20 int computeTotalImageSize( 21 GLsizei width, GLsizei height, GLsizei depth, 22 GLenum format, GLenum type, 23 int unpackAlignment, 24 int unpackRowLength, 25 int unpackImageHeight, 26 int unpackSkipPixels, 27 int unpackSkipRows, 28 int unpackSkipImages); 29 30 int computeNeededBufferSize( 31 GLsizei width, GLsizei height, GLsizei depth, 32 GLenum format, GLenum type, 33 int unpackAlignment, 34 int unpackRowLength, 35 int unpackImageHeight, 36 int unpackSkipPixels, 37 int unpackSkipRows, 38 int unpackSkipImages); 39 40 // Writes out |height| offsets for glReadPixels to read back 41 // data in separate rows of pixels. Returns: 42 // 1. |startOffset|: offset in bytes to apply at the beginning 43 // 2. |packingPixelRowSize|: the buffer size in bytes that has the actual pixels per row. 44 // 2. |packingTotalRowSize|: the length in bytes of each row including the padding from row length. 45 void computePackingOffsets2D( 46 GLsizei width, GLsizei height, 47 GLenum format, GLenum type, 48 int packAlignment, 49 int packRowLength, 50 int packSkipPixels, 51 int packSkipRows, 52 int* bpp, 53 int* startOffset, 54 int* packingPixelRowSize, 55 int* packingTotalRowSize); 56 57 // For processing 3D textures exactly to the sizes of client buffers. 58 void computePackingOffsets3D( 59 GLsizei width, GLsizei height, GLsizei depth, 60 GLenum format, GLenum type, 61 int packAlignment, 62 int packRowLength, 63 int packImageHeight, 64 int packSkipPixels, 65 int packSkipRows, 66 int packSkipImages, 67 int* bpp, 68 int* startOffset, 69 int* packingPixelRowSize, 70 int* packingTotalRowSize, 71 int* packingPixelImageSize, 72 int* packingTotalImageSize); 73 74 } // namespace GLESTextureUtils 75 #endif 76