blob: f623d23bc041452a981c52221a863f77e818f02e [file] [log] [blame]
Lingfeng Yang74e29292017-01-10 14:54:38 -08001#ifndef GLES_TEXTURE_UTILS_H
2#define GLES_TEXTURE_UTILS_H
3
4#include <GLES3/gl31.h>
5
6namespace GLESTextureUtils {
7
8void 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
20int 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
30int 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 Yang372c4252018-05-29 10:11:38 -070040// 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.
45void 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 Yang74e29292017-01-10 14:54:38 -080055
56} // namespace GLESTextureUtils
57#endif