|
@@ -6397,18 +6397,21 @@
|
|
channel = this._getCorrectTextureChannel(channel, internalTexture);
|
|
channel = this._getCorrectTextureChannel(channel, internalTexture);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let needToBind = true;
|
|
if (this._boundTexturesCache[channel] === internalTexture) {
|
|
if (this._boundTexturesCache[channel] === internalTexture) {
|
|
this._moveBoundTextureOnTop(internalTexture);
|
|
this._moveBoundTextureOnTop(internalTexture);
|
|
if (!isPartOfTextureArray) {
|
|
if (!isPartOfTextureArray) {
|
|
this._bindSamplerUniformToChannel(internalTexture._initialSlot, channel);
|
|
this._bindSamplerUniformToChannel(internalTexture._initialSlot, channel);
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
|
|
+ needToBind = false;
|
|
}
|
|
}
|
|
|
|
|
|
this._activeChannel = channel;
|
|
this._activeChannel = channel;
|
|
|
|
|
|
if (internalTexture && internalTexture.is3D) {
|
|
if (internalTexture && internalTexture.is3D) {
|
|
- this._bindTextureDirectly(this._gl.TEXTURE_3D, internalTexture, isPartOfTextureArray);
|
|
|
|
|
|
+ if (needToBind) {
|
|
|
|
+ this._bindTextureDirectly(this._gl.TEXTURE_3D, internalTexture, isPartOfTextureArray);
|
|
|
|
+ }
|
|
|
|
|
|
if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {
|
|
if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {
|
|
internalTexture._cachedWrapU = texture.wrapU;
|
|
internalTexture._cachedWrapU = texture.wrapU;
|
|
@@ -6459,7 +6462,9 @@
|
|
this._setAnisotropicLevel(this._gl.TEXTURE_3D, texture);
|
|
this._setAnisotropicLevel(this._gl.TEXTURE_3D, texture);
|
|
}
|
|
}
|
|
else if (internalTexture && internalTexture.isCube) {
|
|
else if (internalTexture && internalTexture.isCube) {
|
|
- this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, internalTexture, isPartOfTextureArray);
|
|
|
|
|
|
+ if (needToBind) {
|
|
|
|
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, internalTexture, isPartOfTextureArray);
|
|
|
|
+ }
|
|
|
|
|
|
if (internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {
|
|
if (internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {
|
|
internalTexture._cachedCoordinatesMode = texture.coordinatesMode;
|
|
internalTexture._cachedCoordinatesMode = texture.coordinatesMode;
|
|
@@ -6471,7 +6476,9 @@
|
|
|
|
|
|
this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, texture);
|
|
this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, texture);
|
|
} else {
|
|
} else {
|
|
- this._bindTextureDirectly(this._gl.TEXTURE_2D, internalTexture, isPartOfTextureArray);
|
|
|
|
|
|
+ if (needToBind) {
|
|
|
|
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, internalTexture, isPartOfTextureArray);
|
|
|
|
+ }
|
|
|
|
|
|
if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {
|
|
if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {
|
|
internalTexture._cachedWrapU = texture.wrapU;
|
|
internalTexture._cachedWrapU = texture.wrapU;
|