Skip to content

Commit 21cbc02

Browse files
Revert "Textures: prevent always creating depth texture"
This reverts commit 92cfd28.
1 parent f3e59f7 commit 21cbc02

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

src/renderers/common/Textures.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,24 @@ class Textures extends DataMap {
7171
const mipWidth = size.width >> activeMipmapLevel;
7272
const mipHeight = size.height >> activeMipmapLevel;
7373

74+
let depthTexture = renderTarget.depthTexture || depthTextureMips[ activeMipmapLevel ];
7475
const useDepthTexture = renderTarget.depthBuffer === true || renderTarget.stencilBuffer === true;
75-
let depthTexture = null;
7676

7777
let textureNeedsUpdate = false;
7878

79-
if ( useDepthTexture ) {
79+
if ( depthTexture === undefined && useDepthTexture ) {
8080

81-
depthTexture = renderTarget.depthTexture || depthTextureMips[ activeMipmapLevel ];
81+
depthTexture = new DepthTexture();
8282

83-
if ( depthTexture === undefined ) {
83+
depthTexture.format = renderTarget.stencilBuffer ? DepthStencilFormat : DepthFormat;
84+
depthTexture.type = renderTarget.stencilBuffer ? UnsignedInt248Type : UnsignedIntType; // FloatType
85+
depthTexture.image.width = mipWidth;
86+
depthTexture.image.height = mipHeight;
87+
depthTexture.image.depth = size.depth;
88+
depthTexture.renderTarget = renderTarget;
89+
depthTexture.isArrayTexture = renderTarget.multiview === true && size.depth > 1;
8490

85-
depthTexture = new DepthTexture();
86-
87-
depthTexture.format = renderTarget.stencilBuffer ? DepthStencilFormat : DepthFormat;
88-
depthTexture.type = renderTarget.stencilBuffer ? UnsignedInt248Type : UnsignedIntType; // FloatType
89-
depthTexture.image.width = mipWidth;
90-
depthTexture.image.height = mipHeight;
91-
depthTexture.image.depth = size.depth;
92-
depthTexture.renderTarget = renderTarget;
93-
depthTexture.isArrayTexture = renderTarget.multiview === true && size.depth > 1;
94-
95-
depthTextureMips[ activeMipmapLevel ] = depthTexture;
96-
97-
}
91+
depthTextureMips[ activeMipmapLevel ] = depthTexture;
9892

9993
}
10094

0 commit comments

Comments
 (0)