|
@@ -364,13 +364,13 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
|
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
|
// are midframe flushes and an external depth texture.
|
|
// are midframe flushes and an external depth texture.
|
|
|
- if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget.autoAllocateDepthBuffer === true && renderTarget.multiview === false ) {
|
|
|
|
|
|
|
+ if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget._autoAllocateDepthBuffer === true && renderTarget.multiview === false ) {
|
|
|
|
|
|
|
|
console.warn( 'THREE.WebGLBackend: Render-to-texture extension was disabled because an external texture was provided' );
|
|
console.warn( 'THREE.WebGLBackend: Render-to-texture extension was disabled because an external texture was provided' );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- renderTarget.autoAllocateDepthBuffer = false;
|
|
|
|
|
|
|
+ renderTarget._autoAllocateDepthBuffer = false;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2002,7 +2002,7 @@ class WebGLBackend extends Backend {
|
|
|
const isRenderTarget3D = renderTarget.isRenderTarget3D === true;
|
|
const isRenderTarget3D = renderTarget.isRenderTarget3D === true;
|
|
|
const isRenderTargetArray = renderTarget.depth > 1;
|
|
const isRenderTargetArray = renderTarget.depth > 1;
|
|
|
const isXRRenderTarget = renderTarget.isXRRenderTarget === true;
|
|
const isXRRenderTarget = renderTarget.isXRRenderTarget === true;
|
|
|
- const hasExternalTextures = ( isXRRenderTarget === true && renderTarget.hasExternalTextures === true );
|
|
|
|
|
|
|
+ const _hasExternalTextures = ( isXRRenderTarget === true && renderTarget._hasExternalTextures === true );
|
|
|
|
|
|
|
|
let msaaFb = renderTargetContextData.msaaFrameBuffer;
|
|
let msaaFb = renderTargetContextData.msaaFrameBuffer;
|
|
|
let depthRenderbuffer = renderTargetContextData.depthRenderbuffer;
|
|
let depthRenderbuffer = renderTargetContextData.depthRenderbuffer;
|
|
@@ -2019,7 +2019,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
|
|
fb = renderTargetContextData.cubeFramebuffers[ cacheKey ];
|
|
fb = renderTargetContextData.cubeFramebuffers[ cacheKey ];
|
|
|
|
|
|
|
|
- } else if ( isXRRenderTarget && hasExternalTextures === false ) {
|
|
|
|
|
|
|
+ } else if ( isXRRenderTarget && _hasExternalTextures === false ) {
|
|
|
|
|
|
|
|
fb = this._xrFramebuffer;
|
|
fb = this._xrFramebuffer;
|
|
|
|
|
|
|
@@ -2095,7 +2095,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
|
|
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
|
|
|
|
|
|
- if ( renderTarget.autoAllocateDepthBuffer === true ) {
|
|
|
|
|
|
|
+ if ( renderTarget._autoAllocateDepthBuffer === true ) {
|
|
|
|
|
|
|
|
const renderbuffer = gl.createRenderbuffer();
|
|
const renderbuffer = gl.createRenderbuffer();
|
|
|
this.textureUtils.setupRenderBufferStorage( renderbuffer, descriptor, 0, useMultisampledRTT );
|
|
this.textureUtils.setupRenderBufferStorage( renderbuffer, descriptor, 0, useMultisampledRTT );
|
|
@@ -2120,7 +2120,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
|
|
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, samples, 0, 2 );
|
|
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, samples, 0, 2 );
|
|
|
|
|
|
|
|
- } else if ( hasExternalTextures && useMultisampledRTT ) {
|
|
|
|
|
|
|
+ } else if ( _hasExternalTextures && useMultisampledRTT ) {
|
|
|
|
|
|
|
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
|
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
|
|
|
|
|
|
|
@@ -2171,7 +2171,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
|
|
// rebind external XR textures
|
|
// rebind external XR textures
|
|
|
|
|
|
|
|
- if ( isXRRenderTarget || useMultisampledRTT || renderTarget.multiview ) {
|
|
|
|
|
|
|
+ if ( ( isXRRenderTarget || useMultisampledRTT || renderTarget.multiview ) && ( renderTarget._isOpaqueFramebuffer !== true ) ) {
|
|
|
|
|
|
|
|
state.bindFramebuffer( gl.FRAMEBUFFER, fb );
|
|
state.bindFramebuffer( gl.FRAMEBUFFER, fb );
|
|
|
|
|
|
|
@@ -2197,7 +2197,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
|
|
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
|
|
|
|
|
|
- if ( renderTarget.autoAllocateDepthBuffer === true ) {
|
|
|
|
|
|
|
+ if ( renderTarget._autoAllocateDepthBuffer === true ) {
|
|
|
|
|
|
|
|
const renderbuffer = renderTargetContextData.xrDepthRenderbuffer;
|
|
const renderbuffer = renderTargetContextData.xrDepthRenderbuffer;
|
|
|
gl.bindRenderbuffer( gl.RENDERBUFFER, renderbuffer );
|
|
gl.bindRenderbuffer( gl.RENDERBUFFER, renderbuffer );
|
|
@@ -2528,7 +2528,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return renderTarget.samples > 0 && this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTarget.autoAllocateDepthBuffer !== false;
|
|
|
|
|
|
|
+ return renderTarget.samples > 0 && this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTarget._autoAllocateDepthBuffer !== false;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|