@@ -534,20 +534,30 @@ class WGSLNodeBuilder extends NodeBuilder {
534
534
*/
535
535
generateTextureLoad ( texture , textureProperty , uvIndexSnippet , depthSnippet , levelSnippet = '0u' ) {
536
536
537
+ let snippet ;
538
+
537
539
if ( texture . isVideoTexture === true || texture . isStorageTexture === true ) {
538
540
539
- return `textureLoad( ${ textureProperty } , ${ uvIndexSnippet } )` ;
541
+ snippet = `textureLoad( ${ textureProperty } , ${ uvIndexSnippet } )` ;
540
542
541
543
} else if ( depthSnippet ) {
542
544
543
- return `textureLoad( ${ textureProperty } , ${ uvIndexSnippet } , ${ depthSnippet } , u32( ${ levelSnippet } ) )` ;
545
+ snippet = `textureLoad( ${ textureProperty } , ${ uvIndexSnippet } , ${ depthSnippet } , u32( ${ levelSnippet } ) )` ;
544
546
545
547
} else {
546
548
547
- return `textureLoad( ${ textureProperty } , ${ uvIndexSnippet } , u32( ${ levelSnippet } ) )` ;
549
+ snippet = `textureLoad( ${ textureProperty } , ${ uvIndexSnippet } , u32( ${ levelSnippet } ) )` ;
550
+
551
+ if ( this . renderer . backend . compatibilityMode && texture . isDepthTexture ) {
552
+
553
+ snippet += '.x' ;
554
+
555
+ }
548
556
549
557
}
550
558
559
+ return snippet ;
560
+
551
561
}
552
562
553
563
/**
@@ -1661,7 +1671,15 @@ ${ flowData.code }
1661
1671
1662
1672
} else if ( texture . isDepthTexture === true ) {
1663
1673
1664
- textureType = `texture_depth${ multisampled } _2d${ texture . isDepthArrayTexture === true ? '_array' : '' } ` ;
1674
+ if ( this . renderer . backend . compatibilityMode && texture . compareFunction === null ) {
1675
+
1676
+ textureType = `texture${ multisampled } _2d<f32>` ;
1677
+
1678
+ } else {
1679
+
1680
+ textureType = `texture_depth${ multisampled } _2d${ texture . isDepthArrayTexture === true ? '_array' : '' } ` ;
1681
+
1682
+ }
1665
1683
1666
1684
} else if ( texture . isVideoTexture === true ) {
1667
1685
0 commit comments