Skip to content

Commit

Permalink
[Fix] Fix to texture upload issue on WebGPU (playcanvas#7375)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky authored Feb 24, 2025
1 parent f47ac84 commit 28be2d7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/platform/graphics/texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ class Texture {
// #endif

this._levels = options.levels;
const upload = !!options.levels;
if (!this._levels) {
this._levels = this._cubemap ? [[null, null, null, null, null, null]] : [null];
}

this.recreateImpl();
this.recreateImpl(upload);

// track the texture
graphicsDevice.textures.push(this);
Expand Down Expand Up @@ -327,7 +328,7 @@ class Texture {
}
}

recreateImpl() {
recreateImpl(upload = true) {

const { device } = this;

Expand All @@ -338,7 +339,10 @@ class Texture {
// create new
this.impl = device.createTextureImpl(this);
this.dirtyAll();
this.upload();

if (upload) {
this.upload();
}
}

/**
Expand Down

0 comments on commit 28be2d7

Please sign in to comment.