Skip to content

Commit

Permalink
WebGLRenderer: Remove unnecessary __hasExternalTextures check. (#27684
Browse files Browse the repository at this point in the history
)

* fix: remove unnecessasy if statement

* lint: fix lint

* lint: fix lint

* fix: revert `vaoAvailable`
  • Loading branch information
susiwen8 authored Feb 5, 2024
1 parent c0764e9 commit 86a94fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
18 changes: 7 additions & 11 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2171,20 +2171,16 @@ class WebGLRenderer {
const renderTargetProperties = properties.get( renderTarget );
renderTargetProperties.__hasExternalTextures = true;

if ( renderTargetProperties.__hasExternalTextures ) {
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;

renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {

if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
// The multisample_render_to_texture extension doesn't work properly if there
// are midframe flushes and an external depth buffer. Disable use of the extension.
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {

// The multisample_render_to_texture extension doesn't work properly if there
// are midframe flushes and an external depth buffer. Disable use of the extension.
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {

console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
renderTargetProperties.__useRenderToTexture = false;

}
console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
renderTargetProperties.__useRenderToTexture = false;

}

Expand Down
3 changes: 1 addition & 2 deletions src/renderers/webgl/WebGLTextures.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,15 +626,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,

if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {

const extension = extensions.get( 'EXT_texture_filter_anisotropic' );

if ( texture.magFilter === NearestFilter ) return;
if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2
if ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only

if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {

const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );
properties.get( texture ).__currentAnisotropy = texture.anisotropy;

Expand Down

0 comments on commit 86a94fd

Please sign in to comment.