Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix texture caching. #12652

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix texture caching.
  • Loading branch information
carolhmj committed Jun 14, 2022
commit 0d39705e1aa7c0d95deaa24b68ce06d03bc05a3b
9 changes: 6 additions & 3 deletions packages/dev/core/src/Materials/Textures/baseTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,10 @@ export class BaseTexture extends ThinTexture implements IAnimatable {
* @param sampling
* @param invertY
* @param useSRGBBuffer
* @param isCube
* @hidden
*/
public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean): Nullable<InternalTexture> {
public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean, isCube?: boolean): Nullable<InternalTexture> {
const engine = this._getEngine();
if (!engine) {
return null;
Expand All @@ -617,8 +618,10 @@ export class BaseTexture extends ThinTexture implements IAnimatable {
if (invertY === undefined || invertY === texturesCacheEntry.invertY) {
if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {
if (!sampling || sampling === texturesCacheEntry.samplingMode) {
texturesCacheEntry.incrementReferences();
return texturesCacheEntry;
if (isCube === undefined || isCube === texturesCacheEntry.isCube) {
texturesCacheEntry.incrementReferences();
return texturesCacheEntry;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class EquiRectangularCubeTexture extends BaseTexture {
this.hasAlpha = false;
this.isCube = true;

this._texture = this._getFromCache(url, this._noMipmap);
this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);

if (!this._texture) {
if (!scene.useDelayedTextureLoading) {
Expand Down