Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 3 additions & 21 deletions examples/jsm/renderers/webgl/utils/WebGLUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,33 +114,15 @@ class WebGLUtils {

}

// ETC1
// ETC

if ( p === RGB_ETC1_Format ) {

extension = extensions.get( 'WEBGL_compressed_texture_etc1' );

if ( extension !== null ) {

return extension.COMPRESSED_RGB_ETC1_WEBGL;

} else {

return null;

}

}

// ETC2

if ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {

extension = extensions.get( 'WEBGL_compressed_texture_etc' );

if ( extension !== null ) {

if ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
if ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;

} else {
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/webgl/WebGLTextures.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, RGBAFormat, RGB_ETC1_Format, DepthFormat, DepthStencilFormat, UnsignedIntType, UnsignedInt248Type, FloatType, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, UnsignedByteType, NoColorSpace, LinearSRGBColorSpace, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, SRGBTransfer, LinearTransfer } from '../../constants.js';
import { LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, RGBAFormat, DepthFormat, DepthStencilFormat, UnsignedIntType, UnsignedInt248Type, FloatType, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, UnsignedByteType, NoColorSpace, LinearSRGBColorSpace, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, SRGBTransfer, LinearTransfer } from '../../constants.js';
import { createElementNS } from '../../utils.js';
import { ColorManagement } from '../../math/ColorManagement.js';
import { Vector2 } from '../../math/Vector2.js';
Expand Down Expand Up @@ -703,7 +703,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
let mipmap;
const mipmaps = texture.mipmaps;

const useTexStorage = ( texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
Copy link
Collaborator Author

@Mugen87 Mugen87 Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify: This is the bit (the RGB_ETC1_Format check) I want to get rid of^^.

const useTexStorage = ( texture.isVideoTexture !== true );
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
const dataReady = source.dataReady;
const levels = getMipLevels( texture, image );
Expand Down
24 changes: 3 additions & 21 deletions src/renderers/webgl/WebGLUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,33 +101,15 @@ function WebGLUtils( gl, extensions ) {

}

// ETC1
// ETC

if ( p === RGB_ETC1_Format ) {

extension = extensions.get( 'WEBGL_compressed_texture_etc1' );

if ( extension !== null ) {

return extension.COMPRESSED_RGB_ETC1_WEBGL;

} else {

return null;

}

}

// ETC2

if ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {

extension = extensions.get( 'WEBGL_compressed_texture_etc' );

if ( extension !== null ) {

if ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;

} else {
Expand Down