1
1
export const description = `
2
2
Tests the behavior of different filtering modes in minFilter/magFilter/mipmapFilter.
3
+
4
+ Note: It's possible these tests duplicated tests under shader/execution/expression/call/builtin/textureXXX.
5
+ Further, these tests only test encodable/filterable/renderable color formats. Depth, sint, uint,
6
+ and compressed formats are not tested.
3
7
` ;
4
8
5
9
import { makeTestGroup } from '../../../../common/framework/test_group.js' ;
6
10
import { kAddressModes , kMipmapFilterModes } from '../../../capability_info.js' ;
7
11
import {
8
12
EncodableTextureFormat ,
9
- kRenderableColorTextureFormats ,
10
- kTextureFormatInfo ,
13
+ getTextureFormatType ,
14
+ kPossiblyRenderableColorTextureFormats ,
11
15
} from '../../../format_info.js' ;
12
- import { GPUTest , TextureTestMixin } from '../../../gpu_test.js' ;
16
+ import { AllFeaturesMaxLimitsGPUTest , TextureTestMixin } from '../../../gpu_test.js' ;
13
17
import { getTextureCopyLayout } from '../../../util/texture/layout.js' ;
14
18
import { TexelView } from '../../../util/texture/texel_view.js' ;
15
19
@@ -22,7 +26,18 @@ const kCheckerTextureData = [
22
26
{ R : 1.0 , G : 1.0 , B : 1.0 , A : 1.0 } ,
23
27
] ;
24
28
25
- class FilterModeTest extends TextureTestMixin ( GPUTest ) {
29
+ /**
30
+ * These formats are possibly renderable and possibly filterable.
31
+ * One more both may required certain features to be enabled.
32
+ */
33
+ const kPossiblyRenderablePossiblyFilterableColorTextureFormats =
34
+ kPossiblyRenderableColorTextureFormats . filter (
35
+ format =>
36
+ getTextureFormatType ( format ) === 'float' ||
37
+ getTextureFormatType ( format ) === 'unfilterable-float'
38
+ ) ;
39
+
40
+ class FilterModeTest extends TextureTestMixin ( AllFeaturesMaxLimitsGPUTest ) {
26
41
runFilterRenderPipeline (
27
42
sampler : GPUSampler ,
28
43
module : GPUShaderModule ,
@@ -468,25 +483,15 @@ g.test('magFilter,nearest')
468
483
)
469
484
. params ( u =>
470
485
u
471
- . combine ( 'format' , kRenderableColorTextureFormats )
472
- . filter ( t => {
473
- return (
474
- kTextureFormatInfo [ t . format ] . color . type === 'float' ||
475
- kTextureFormatInfo [ t . format ] . color . type === 'unfilterable-float'
476
- ) ;
477
- } )
486
+ . combine ( 'format' , kPossiblyRenderablePossiblyFilterableColorTextureFormats )
478
487
. beginSubcases ( )
479
488
. combine ( 'addressModeU' , kAddressModes )
480
489
. combine ( 'addressModeV' , kAddressModes )
481
490
)
482
- . beforeAllSubcases ( t => {
483
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
484
- if ( kTextureFormatInfo [ t . params . format ] . color . type === 'unfilterable-float' ) {
485
- t . selectDeviceOrSkipTestCase ( 'float32-filterable' ) ;
486
- }
487
- } )
488
491
. fn ( t => {
489
492
const { format, addressModeU, addressModeV } = t . params ;
493
+ t . skipIfTextureFormatNotSupported ( format ) ;
494
+ t . skipIfTextureFormatNotFilterable ( format ) ;
490
495
const sampler = t . device . createSampler ( {
491
496
addressModeU,
492
497
addressModeV,
@@ -591,25 +596,15 @@ g.test('magFilter,linear')
591
596
)
592
597
. params ( u =>
593
598
u
594
- . combine ( 'format' , kRenderableColorTextureFormats )
595
- . filter ( t => {
596
- return (
597
- kTextureFormatInfo [ t . format ] . color . type === 'float' ||
598
- kTextureFormatInfo [ t . format ] . color . type === 'unfilterable-float'
599
- ) ;
600
- } )
599
+ . combine ( 'format' , kPossiblyRenderablePossiblyFilterableColorTextureFormats )
601
600
. beginSubcases ( )
602
601
. combine ( 'addressModeU' , kAddressModes )
603
602
. combine ( 'addressModeV' , kAddressModes )
604
603
)
605
- . beforeAllSubcases ( t => {
606
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
607
- if ( kTextureFormatInfo [ t . params . format ] . color . type === 'unfilterable-float' ) {
608
- t . selectDeviceOrSkipTestCase ( 'float32-filterable' ) ;
609
- }
610
- } )
611
604
. fn ( t => {
612
605
const { format, addressModeU, addressModeV } = t . params ;
606
+ t . skipIfTextureFormatNotSupported ( format ) ;
607
+ t . skipIfTextureFormatNotFilterable ( format ) ;
613
608
const sampler = t . device . createSampler ( {
614
609
addressModeU,
615
610
addressModeV,
@@ -726,25 +721,15 @@ g.test('minFilter,nearest')
726
721
)
727
722
. params ( u =>
728
723
u
729
- . combine ( 'format' , kRenderableColorTextureFormats )
730
- . filter ( t => {
731
- return (
732
- kTextureFormatInfo [ t . format ] . color . type === 'float' ||
733
- kTextureFormatInfo [ t . format ] . color . type === 'unfilterable-float'
734
- ) ;
735
- } )
724
+ . combine ( 'format' , kPossiblyRenderablePossiblyFilterableColorTextureFormats )
736
725
. beginSubcases ( )
737
726
. combine ( 'addressModeU' , kAddressModes )
738
727
. combine ( 'addressModeV' , kAddressModes )
739
728
)
740
- . beforeAllSubcases ( t => {
741
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
742
- if ( kTextureFormatInfo [ t . params . format ] . color . type === 'unfilterable-float' ) {
743
- t . selectDeviceOrSkipTestCase ( 'float32-filterable' ) ;
744
- }
745
- } )
746
729
. fn ( t => {
747
730
const { format, addressModeU, addressModeV } = t . params ;
731
+ t . skipIfTextureFormatNotSupported ( format ) ;
732
+ t . skipIfTextureFormatNotFilterable ( format ) ;
748
733
const sampler = t . device . createSampler ( {
749
734
addressModeU,
750
735
addressModeV,
@@ -859,25 +844,15 @@ g.test('minFilter,linear')
859
844
)
860
845
. params ( u =>
861
846
u
862
- . combine ( 'format' , kRenderableColorTextureFormats )
863
- . filter ( t => {
864
- return (
865
- kTextureFormatInfo [ t . format ] . color . type === 'float' ||
866
- kTextureFormatInfo [ t . format ] . color . type === 'unfilterable-float'
867
- ) ;
868
- } )
847
+ . combine ( 'format' , kPossiblyRenderablePossiblyFilterableColorTextureFormats )
869
848
. beginSubcases ( )
870
849
. combine ( 'addressModeU' , kAddressModes )
871
850
. combine ( 'addressModeV' , kAddressModes )
872
851
)
873
- . beforeAllSubcases ( t => {
874
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
875
- if ( kTextureFormatInfo [ t . params . format ] . color . type === 'unfilterable-float' ) {
876
- t . selectDeviceOrSkipTestCase ( 'float32-filterable' ) ;
877
- }
878
- } )
879
852
. fn ( t => {
880
853
const { format, addressModeU, addressModeV } = t . params ;
854
+ t . skipIfTextureFormatNotSupported ( format ) ;
855
+ t . skipIfTextureFormatNotFilterable ( format ) ;
881
856
const sampler = t . device . createSampler ( {
882
857
addressModeU,
883
858
addressModeV,
@@ -956,24 +931,14 @@ g.test('mipmapFilter')
956
931
)
957
932
. params ( u =>
958
933
u
959
- . combine ( 'format' , kRenderableColorTextureFormats )
960
- . filter ( t => {
961
- return (
962
- kTextureFormatInfo [ t . format ] . color . type === 'float' ||
963
- kTextureFormatInfo [ t . format ] . color . type === 'unfilterable-float'
964
- ) ;
965
- } )
934
+ . combine ( 'format' , kPossiblyRenderablePossiblyFilterableColorTextureFormats )
966
935
. beginSubcases ( )
967
936
. combine ( 'filterMode' , kMipmapFilterModes )
968
937
)
969
- . beforeAllSubcases ( t => {
970
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
971
- if ( kTextureFormatInfo [ t . params . format ] . color . type === 'unfilterable-float' ) {
972
- t . selectDeviceOrSkipTestCase ( 'float32-filterable' ) ;
973
- }
974
- } )
975
938
. fn ( t => {
976
939
const { format, filterMode } = t . params ;
940
+ t . skipIfTextureFormatNotSupported ( format ) ;
941
+ t . skipIfTextureFormatNotFilterable ( format ) ;
977
942
// Takes a 8x8/4x4 mipmapped texture and renders it on multiple quads with different UVs such
978
943
// that each instanced quad from left to right emulates moving the quad further and further from
979
944
// the camera. Each quad is then rendered to a single pixel in a 1-dimensional texture. Since
@@ -1126,7 +1091,7 @@ g.test('mipmapFilter')
1126
1091
}
1127
1092
if ( changes !== 1 ) {
1128
1093
return Error (
1129
- `Nearest filtering on mipmaps should change exacly once but found (${ changes } ):\n` +
1094
+ `Nearest filtering on mipmaps should change exactly once but found (${ changes } ):\n` +
1130
1095
view . toString (
1131
1096
{ x : 0 , y : 0 , z : 0 } ,
1132
1097
{ width : kRenderSize , height : 1 , depthOrArrayLayers : 1 }
0 commit comments