@@ -13,8 +13,7 @@ import {
13
13
RGBAFormat , RGBFormat , RedFormat , RGFormat , RGBA_S3TC_DXT1_Format , RGBA_S3TC_DXT3_Format , RGBA_S3TC_DXT5_Format , UnsignedByteType , FloatType , HalfFloatType , SRGBTransfer , DepthFormat , DepthStencilFormat ,
14
14
RGBA_ASTC_4x4_Format , RGBA_ASTC_5x4_Format , RGBA_ASTC_5x5_Format , RGBA_ASTC_6x5_Format , RGBA_ASTC_6x6_Format , RGBA_ASTC_8x5_Format , RGBA_ASTC_8x6_Format , RGBA_ASTC_8x8_Format , RGBA_ASTC_10x5_Format ,
15
15
RGBA_ASTC_10x6_Format , RGBA_ASTC_10x8_Format , RGBA_ASTC_10x10_Format , RGBA_ASTC_12x10_Format , RGBA_ASTC_12x12_Format , UnsignedIntType , UnsignedShortType , UnsignedInt248Type , UnsignedInt5999Type ,
16
- NeverCompare , AlwaysCompare , LessCompare , LessEqualCompare , EqualCompare , GreaterEqualCompare , GreaterCompare , NotEqualCompare , IntType , RedIntegerFormat , RGIntegerFormat , RGBAIntegerFormat ,
17
- CubeReflectionMapping , CubeRefractionMapping , EquirectangularReflectionMapping , EquirectangularRefractionMapping
16
+ NeverCompare , AlwaysCompare , LessCompare , LessEqualCompare , EqualCompare , GreaterEqualCompare , GreaterCompare , NotEqualCompare , IntType , RedIntegerFormat , RGIntegerFormat , RGBAIntegerFormat
18
17
} from '../../../constants.js' ;
19
18
import { CubeTexture } from '../../../textures/CubeTexture.js' ;
20
19
import { DepthTexture } from '../../../textures/DepthTexture.js' ;
@@ -479,7 +478,7 @@ class WebGPUTextureUtils {
479
478
480
479
} else if ( texture . isCubeTexture ) {
481
480
482
- this . _copyCubeMapToTexture ( options . images , textureData . texture , textureDescriptorGPU , texture . flipY ) ;
481
+ this . _copyCubeMapToTexture ( options . images , textureData . texture , textureDescriptorGPU , texture . flipY , texture . premultiplyAlpha ) ;
483
482
484
483
} else if ( texture . isVideoTexture ) {
485
484
@@ -489,7 +488,7 @@ class WebGPUTextureUtils {
489
488
490
489
} else {
491
490
492
- this . _copyImageToTexture ( options . image , textureData . texture , textureDescriptorGPU , 0 , texture . flipY ) ;
491
+ this . _copyImageToTexture ( options . image , textureData . texture , textureDescriptorGPU , 0 , texture . flipY , texture . premultiplyAlpha ) ;
493
492
494
493
}
495
494
@@ -562,21 +561,6 @@ class WebGPUTextureUtils {
562
561
563
562
}
564
563
565
- /**
566
- * Returns `true` if the given texture is an environment map.
567
- *
568
- * @private
569
- * @param {Texture } texture - The texture.
570
- * @return {boolean } Whether the given texture is an environment map or not.
571
- */
572
- _isEnvironmentTexture ( texture ) {
573
-
574
- const mapping = texture . mapping ;
575
-
576
- return ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) || ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping ) ;
577
-
578
- }
579
-
580
564
/**
581
565
* Returns the default GPU texture for the given format.
582
566
*
@@ -666,8 +650,9 @@ class WebGPUTextureUtils {
666
650
* @param {GPUTexture } textureGPU - The GPU texture.
667
651
* @param {Object } textureDescriptorGPU - The GPU texture descriptor.
668
652
* @param {boolean } flipY - Whether to flip texture data along their vertical axis or not.
653
+ * @param {boolean } premultiplyAlpha - Whether the texture should have its RGB channels premultiplied by the alpha channel or not.
669
654
*/
670
- _copyCubeMapToTexture ( images , textureGPU , textureDescriptorGPU , flipY ) {
655
+ _copyCubeMapToTexture ( images , textureGPU , textureDescriptorGPU , flipY , premultiplyAlpha ) {
671
656
672
657
for ( let i = 0 ; i < 6 ; i ++ ) {
673
658
@@ -681,7 +666,7 @@ class WebGPUTextureUtils {
681
666
682
667
} else {
683
668
684
- this . _copyImageToTexture ( image , textureGPU , textureDescriptorGPU , flipIndex , flipY ) ;
669
+ this . _copyImageToTexture ( image , textureGPU , textureDescriptorGPU , flipIndex , flipY , premultiplyAlpha ) ;
685
670
686
671
}
687
672
@@ -698,8 +683,9 @@ class WebGPUTextureUtils {
698
683
* @param {Object } textureDescriptorGPU - The GPU texture descriptor.
699
684
* @param {number } originDepth - The origin depth.
700
685
* @param {boolean } flipY - Whether to flip texture data along their vertical axis or not.
686
+ * @param {boolean } premultiplyAlpha - Whether the texture should have its RGB channels premultiplied by the alpha channel or not.
701
687
*/
702
- _copyImageToTexture ( image , textureGPU , textureDescriptorGPU , originDepth , flipY ) {
688
+ _copyImageToTexture ( image , textureGPU , textureDescriptorGPU , originDepth , flipY , premultiplyAlpha ) {
703
689
704
690
const device = this . backend . device ;
705
691
@@ -710,7 +696,8 @@ class WebGPUTextureUtils {
710
696
} , {
711
697
texture : textureGPU ,
712
698
mipLevel : 0 ,
713
- origin : { x : 0 , y : 0 , z : originDepth }
699
+ origin : { x : 0 , y : 0 , z : originDepth } ,
700
+ premultipliedAlpha : premultiplyAlpha
714
701
} , {
715
702
width : image . width ,
716
703
height : image . height ,
0 commit comments