MCPcopy
hub / github.com/phaserjs/phaser / verifyCompressedTexture

Function verifyCompressedTexture

src/textures/parsers/VerifyCompressedTexture.js:22–46  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

20 * @return {boolean} Whether the compressed texture data is valid.
21 */
22var verifyCompressedTexture = function (data)
23{
24 // Check that mipmaps are power-of-two sized.
25 // WebGL does not allow non-power-of-two textures for mip levels above 0.
26 var mipmaps = data.mipmaps;
27 for (var level = 1; level < mipmaps.length; level++)
28 {
29 var width = mipmaps[level].width;
30 var height = mipmaps[level].height;
31 if (!IsSizePowerOfTwo(width, height))
32 {
33 console.warn('Mip level ' + level + ' is not a power-of-two size: ' + width + 'x' + height);
34 return false;
35 }
36 }
37
38 // Check specific format requirements.
39 var checker = formatCheckers[data.internalFormat];
40 if (!checker)
41 {
42 console.warn('No format checker found for internal format ' + data.internalFormat + '. Assuming valid.');
43 return true;
44 }
45 return checker(data);
46};
47
48/**
49 * @ignore

Calls 1

IsSizePowerOfTwoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…