Skip to content

Commit

Permalink
Add additional texSubImage2d checks (#5840)
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck committed Nov 22, 2023
1 parent 681e9a7 commit 1218409
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/platform/graphics/webgl/webgl-texture.js
Expand Up @@ -386,7 +386,7 @@ class WebglTexture {

const texData = mipObject[face];
if (texture._compressed) {
if (this._glCreated) {
if (this._glCreated && texData) {
gl.compressedTexSubImage2D(
gl.TEXTURE_CUBE_MAP_POSITIVE_X + face,
mipLevel,
Expand All @@ -409,7 +409,7 @@ class WebglTexture {
} else {
device.setUnpackFlipY(false);
device.setUnpackPremultiplyAlpha(texture._premultiplyAlpha);
if (this._glCreated) {
if (this._glCreated && texData) {
gl.texSubImage2D(
gl.TEXTURE_CUBE_MAP_POSITIVE_X + face,
mipLevel,
Expand Down Expand Up @@ -546,7 +546,7 @@ class WebglTexture {
// Upload the byte array
resMult = 1 / Math.pow(2, mipLevel);
if (texture._compressed) {
if (this._glCreated) {
if (this._glCreated && mipObject) {
gl.compressedTexSubImage2D(
gl.TEXTURE_2D,
mipLevel,
Expand All @@ -570,7 +570,7 @@ class WebglTexture {
} else {
device.setUnpackFlipY(false);
device.setUnpackPremultiplyAlpha(texture._premultiplyAlpha);
if (this._glCreated) {
if (this._glCreated && mipObject) {
gl.texSubImage2D(
gl.TEXTURE_2D,
mipLevel,
Expand Down

0 comments on commit 1218409

Please sign in to comment.