Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/platform/graphics/texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class Texture {
this._levels = options.levels;
const upload = !!options.levels;
if (!this._levels) {
this._levels = this._cubemap ? [[null, null, null, null, null, null]] : [null];
this._clearLevels();
}

this.recreateImpl(upload);
Expand Down Expand Up @@ -350,9 +350,16 @@ class Texture {
}
}

_clearLevels() {
this._levels = this._cubemap ? [[null, null, null, null, null, null]] : [null];
}

/**
* Resizes the texture. Only supported for render target textures, as it does not resize the
* existing content of the texture, but only the allocated buffer for rendering into.
* Resizes the texture. This operation is supported for render target textures, and it resizes
* the allocated buffer used for rendering, not the existing content of the texture.
*
* It is also supported for textures with data provided via the {@link lock} method. After
* resizing, the appropriately sized data must be assigned by calling {@link lock} again.
*
* @param {number} width - The new width of the texture.
* @param {number} height - The new height of the texture.
Expand All @@ -365,6 +372,7 @@ class Texture {
const device = this.device;
this.adjustVramSizeTracking(device._vram, -this._gpuSize);
this.impl.destroy(device);
this._clearLevels();

this._width = Math.floor(width);
this._height = Math.floor(height);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/graphics/webgl/webgl-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ class WebglGraphicsDevice extends GraphicsDevice {

// missing generic texture
if (!samplerValue) {
Debug.errorOnce(`Shader ${shader.name} requires ${samplerName} texture which was not set. Rendering [${DebugGraphics.toString()}]`);
Debug.errorOnce(`Shader ${shader.name} requires ${samplerName} texture which was not set. Rendering [${DebugGraphics.toString()}]`, shader);
samplerValue = getBuiltInTexture(this, 'pink');
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/scene/materials/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ class Material {

Debug.call(() => {
if (data === undefined) {
Debug.warnOnce(`Material#setParameter: Attempting to set undefined data for parameter "${name}", this is likely not expected.`);
Debug.warnOnce(`Material#setParameter: Attempting to set undefined data for parameter "${name}", this is likely not expected.`, this);
}
});

Expand Down