Skip to content
Merged
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/three/renderer/utils/MemoryUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { estimateBytesUsed as _estimateBytesUsed } from 'three/addons/utils/BufferGeometryUtils.js';
import { TextureUtils, ExternalTexture, CompressedTexture } from 'three';
import { TextureUtils } from 'three';

// Returned when a texture's size cannot be determined (missing image, unknown
// format, etc).
Expand Down Expand Up @@ -29,7 +29,7 @@ export function getTextureByteLength( tex ) {

// External textures track their own byte length via userData (eg. spark
// textures created from an ImageBitmap or uploaded by a third-party lib).
if ( tex instanceof ExternalTexture ) {
if ( tex.isExternalTexture ) {

return tex.userData?.byteLength ?? UNKNOWN_TEXTURE_BYTE_LENGTH;

Expand All @@ -40,7 +40,7 @@ export function getTextureByteLength( tex ) {
// Block-compressed 2D textures carry their mip chain as an array of
// { data, width, height } entries. Summing the existing data buffers is
// the most reliable size source.
if ( tex instanceof CompressedTexture && Array.isArray( mipmaps ) && mipmaps.length > 0 ) {
if ( tex.isCompressedTexture && Array.isArray( mipmaps ) && mipmaps.length > 0 ) {

let bytes = 0;
for ( const mip of mipmaps ) {
Expand Down
Loading