@@ -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
/**
@@ -1668,7 +1678,15 @@ ${ flowData.code }
1668
1678
1669
1679
} else if ( texture . isDepthTexture === true ) {
1670
1680
1671
- textureType = `texture_depth${ multisampled } _2d${ texture . isDepthArrayTexture === true ? '_array' : '' } ` ;
1681
+ if ( this . renderer . backend . compatibilityMode && texture . compareFunction === null ) {
1682
+
1683
+ textureType = `texture${ multisampled } _2d<f32>` ;
1684
+
1685
+ } else {
1686
+
1687
+ textureType = `texture_depth${ multisampled } _2d${ texture . isDepthArrayTexture === true ? '_array' : '' } ` ;
1688
+
1689
+ }
1672
1690
1673
1691
} else if ( texture . isVideoTexture === true ) {
1674
1692
0 commit comments