Skip to content

Commit ddb10cc

Browse files
committed
fix: handle different layout in webgl2 vs webgl1
1 parent 3678e46 commit ddb10cc

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

packages/engine/Specs/Renderer/TextureAtlasSpec.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -705,16 +705,18 @@ describe("Scene/TextureAtlas", function () {
705705
expect(index3).toEqual(3);
706706

707707
// Webgl1 textures should only be powers of 2
708-
const textureWidth = scene.frameState.context.webgl2 ? 20 : 32;
709-
const textureHeight = scene.frameState.context.webgl2 ? 32 : 16;
708+
const isWebGL2 = scene.frameState.context.webgl2;
709+
const textureWidth = isWebGL2 ? 20 : 32;
710+
const textureHeight = isWebGL2 ? 32 : 16;
710711

711712
const texture = atlas.texture;
712713
expect(texture.pixelFormat).toEqual(PixelFormat.RGBA);
713714
expect(texture.width).toEqual(textureWidth);
714715
expect(texture.height).toEqual(textureHeight);
715716

716-
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
717-
`
717+
if (isWebGL2) {
718+
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
719+
`
718720
333333333333333301••
719721
33333333333333330•••
720722
33333333333333330•••
@@ -748,7 +750,29 @@ describe("Scene/TextureAtlas", function () {
748750
••••••••••••••••••••
749751
••••••••••••••••••••
750752
`.trim(),
751-
);
753+
);
754+
} else {
755+
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
756+
`
757+
3333333333333333222222222201••••
758+
333333333333333322222222220•••••
759+
333333333333333322222222220•••••
760+
333333333333333322222222220•••••
761+
33333333333333332222222222••••••
762+
33333333333333332222222222••••••
763+
33333333333333332222222222••••••
764+
33333333333333332222222222••••••
765+
33333333333333332222222222••••••
766+
33333333333333332222222222••••••
767+
3333333333333333••••••••••••••••
768+
3333333333333333••••••••••••••••
769+
3333333333333333••••••••••••••••
770+
3333333333333333••••••••••••••••
771+
3333333333333333••••••••••••••••
772+
3333333333333333••••••••••••••••
773+
`.trim(),
774+
);
775+
}
752776

753777
let textureCoordinates = atlas.computeTextureCoordinates(index0);
754778
expect(

0 commit comments

Comments
 (0)