Lingfeng Yang | 74e2929 | 2017-01-10 14:54:38 -0800 | [diff] [blame] | 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 | |
Lingfeng Yang | 372c425 | 2018-05-29 10:11:38 -0700 | [diff] [blame] | 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* startOffset, |
| 53 | int* packingPixelRowSize, |
| 54 | int* packingTotalRowSize); |
Lingfeng Yang | 74e2929 | 2017-01-10 14:54:38 -0800 | [diff] [blame] | 55 | |
| 56 | } // namespace GLESTextureUtils |
| 57 | #endif |