Gregg Tavares cceaa19c47 Fix pixel store issues
Internal change. `gl.pixelStorei` state for `UNPACK_COLORSPACE_CONVERSION_WEBGL`
`UNPACK_PREMULTIPLY_ALPHA_WEBGL` and `UNPACK_FLIP_Y_WEBGL`
is now saved and restored as the previous behavior had a race condition.

Before

```js
t1 = twgl.createTexture(gl, {src: 'https://p.com/slow.jpg'});  // may or may not be flipped!!!!
t2 = twgl.createTexture(gl, {src: 'https://p.com/fast.jpg', flipY: true });  // flipped
```

In the example above, whether or not `t1` is flipped was unknown
since if `t2` loads first, it would be flipped. If `t1` loads first
it would not be flipped.

The fix is to save and restore the `pixelStorei` state for each texture.

Unfortunately, this is a breaking change.

Before

```js
twgl.createTexture(gl, {src: someImageElem1, flipY: true });  // flipped
twgl.createTexture(gl, {src: someImageElem2 });               // also flipped
```

after

```js
twgl.createTexture(gl, {src: someImage, flipY: true });  // flipped
twgl.createTexture(gl, {src: someImage });               // NOT flipped
```

Note: in all versions the behavior was and still is, that if you set
the `pixelStorei` parameters outside they applied.

```js
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true)
twgl.createTexture(gl, {src: someImage });  // flipped
twgl.createTexture(gl, {src: someImage });  // flipped
```
2024-09-07 10:24:54 -07:00
..
2019-11-22 09:41:28 +09:00
2022-07-07 14:26:40 -07:00
2022-06-11 20:36:16 -07:00
2022-08-30 14:11:40 -07:00
2024-09-07 10:24:54 -07:00
2017-10-25 19:20:54 +09:00
2017-10-25 19:20:54 +09:00
2022-06-12 18:36:44 -07:00
2021-02-02 12:32:37 +09:00
2021-02-18 12:43:16 +09:00
2019-10-23 17:29:29 +09:00