Skip to content

Commit

Permalink
Merge pull request #14314 from Popov72/fix-texture-type-format-atload
Browse files Browse the repository at this point in the history
Texture: Set type and format at load time
  • Loading branch information
RaananW committed Sep 18, 2023
2 parents 6adfb63 + 621ea9e commit dd7539d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/dev/core/src/Engines/thinEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4970,6 +4970,8 @@ export class ThinEngine {
texture.width = potWidth;
texture.height = potHeight;
texture.isReady = true;
texture.type = Constants.TEXTURETYPE_UNSIGNED_BYTE;
texture.format = extension === ".jpg" && !texture._useSRGBBuffer ? Constants.TEXTUREFORMAT_RGB : Constants.TEXTUREFORMAT_RGBA;

if (
processFunction(potWidth, potHeight, img, extension, texture, () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/dev/core/src/Engines/webgpuEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,8 @@ export class WebGPUEngine extends Engine {
texture.baseHeight = imageBitmap.height;
texture.width = imageBitmap.width;
texture.height = imageBitmap.height;
texture.format = format ?? -1;
texture.format = format ?? Constants.TEXTUREFORMAT_RGBA;
texture.type = Constants.TEXTURETYPE_UNSIGNED_BYTE;

processFunction(texture.width, texture.height, imageBitmap, extension, texture, () => {});

Expand Down

0 comments on commit dd7539d

Please sign in to comment.