blob: f6e54a82d10f7956f36b2d3cdf2b53d2b7b640ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#ifndef TEX_LEN_H
#define TEX_LEN_H
/**
* Compute a length for an array holding a texture.
* `type` is the array's element type.
* `width`, `height` are the texture dimensions.
* `bpp` is the texture's pixel size, in bits per pixels.
* The calculation computes the size of the texture in bits `width * height * bpp`,
* then divides by 8 to get the size in bytes, then divides by the element type size.
*/
#define TEX_LEN(type, width, height, bpp) ((width) * (height) * (bpp) / 8 / sizeof(type))
#endif
|