1
- // RUN: %dxc -Tlib_6_3 -HV 2018 -verify %s
2
- // RUN: %dxc -Tps_6_0 -HV 2018 -verify %s
1
+ // RUN: %dxc -Tlib_6_3 -Wno-misplaced-attributes -HV 2018 -verify %s
2
+ // RUN: %dxc -Tps_6_0 -HV 2018 -verify %s
3
3
4
4
// To test with the classic compiler, run
5
5
// %sdxroot%\tools\x86\fxc.exe /T ps_5_1 attributes.hlsl
@@ -352,11 +352,8 @@ int uav() {
352
352
353
353
[domain] int domain_fn_missing () { return 1 ; } // expected-error {{'domain' attribute takes one argument}} fxc-pass {{}}
354
354
[domain ()] int domain_fn_empty () { return 1 ; } // expected-error {{'domain' attribute takes one argument}} fxc-error {{X3000: syntax error: unexpected token ')'}}
355
- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
356
355
[domain ("blerch" )] int domain_fn_bad () { return 1 ; } // expected-error {{attribute 'domain' must have one of these values: tri,quad,isoline}} fxc-pass {{}}
357
- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
358
356
[domain ("quad" )] int domain_fn () { return 1 ; } /* fxc-warning {{X3554: unknown attribute domain, or attribute invalid for this statement}} */
359
- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
360
357
[domain (1 )] int domain_fn_int () { return 1 ; } // expected-error {{attribute 'domain' must have a string literal argument}} fxc-pass {{}}
361
358
[domain ("quad" ,"quad" )] int domain_fn_mul () { return 1 ; } // expected-error {{'domain' attribute takes one argument}} fxc-pass {{}}
362
359
[instance] int instance_fn () { return 1 ; } // expected-error {{'instance' attribute takes one argument}} fxc-warning {{X3554: unknown attribute instance, or attribute invalid for this statement}}
@@ -367,7 +364,6 @@ int uav() {
367
364
[partitioning] int partitioning_fn () { return 1 ; } // expected-error {{'partitioning' attribute takes one argument}} fxc-warning {{X3554: unknown attribute partitioning, or attribute invalid for this statement}}
368
365
[patchconstantfunc] int patchconstantfunc_fn () { return 1 ; } // expected-error {{'patchconstantfunc' attribute takes one argument}} fxc-warning {{X3554: unknown attribute patchconstantfunc, or attribute invalid for this statement}}
369
366
370
- /* expected-warning@+1{{attribute 'partitioning' ignored without accompanying shader attribute}} */
371
367
[partitioning ("fractional_even" )] int partitioning_fn_ok () { return 1 ; }
372
368
373
369
struct HSFoo
@@ -381,30 +377,22 @@ Texture2D<float4> tex1[10] : register( t20, space10 );
381
377
`-RegisterAssignment <col:30> register(t20, space10)
382
378
*/
383
379
384
- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
385
380
[domain (123 )] // expected-error {{attribute 'domain' must have a string literal argument}} fxc-pass {{}}
386
381
[partitioning ()] // expected-error {{'partitioning' attribute takes one argument}} fxc-error {{X3000: syntax error: unexpected token ')'}}
387
- /* expected-warning@+1{{attribute 'outputtopology' ignored without accompanying shader attribute}} */
388
382
[outputtopology ("not_triangle_cw" )] // expected-error {{attribute 'outputtopology' must have one of these values: point,line,triangle,triangle_cw,triangle_ccw}} fxc-pass {{}}
389
- /* expected-warning@+1{{attribute 'outputcontrolpoints' ignored without accompanying shader attribute}} */
390
383
[outputcontrolpoints (-1 )] // expected-warning {{attribute 'outputcontrolpoints' must have a uint literal argument}} fxc-pass {{}}
391
384
[patchconstantfunc ("PatchFoo" , "ExtraArgument" )] // expected-error {{'patchconstantfunc' attribute takes one argument}} fxc-pass {{}}
392
385
393
386
void all_wrong () { }
394
387
395
- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
396
388
[domain ("quad" )]
397
389
/*verify-ast
398
390
HLSLDomainAttr <col:2, col:15> "quad"
399
391
*/
400
392
401
- /* expected-warning@+1{{attribute 'partitioning' ignored without accompanying shader attribute}} */
402
393
[partitioning ("integer" )]
403
- /* expected-warning@+1{{attribute 'outputtopology' ignored without accompanying shader attribute}} */
404
394
[outputtopology ("triangle_cw" )]
405
- /* expected-warning@+1{{attribute 'outputcontrolpoints' ignored without accompanying shader attribute}} */
406
395
[outputcontrolpoints (16 )]
407
- /* expected-warning@+1{{attribute 'patchconstantfunc' ignored without accompanying shader attribute}} */
408
396
[patchconstantfunc ("PatchFoo" )]
409
397
410
398
HSFoo HSMain ( InputPatch <HSFoo, 16 > p,
@@ -638,7 +626,6 @@ float4 clipplanes_good_parens();
638
626
// place the errors in comments before the function, but not with the standard
639
627
// fxc error comments on the line.
640
628
struct GSVertex { float4 pos : SV_Position ; };
641
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
642
629
[maxvertexcount (12 )]
643
630
644
631
/*verify-ast
@@ -648,15 +635,13 @@ void maxvertexcount_valid1(triangle GSVertex v[3], inout TriangleStream<GSVertex
648
635
{ stream.Append (v[0 ]); }
649
636
650
637
static const int sc_count = 12 ;
651
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
652
638
[maxvertexcount (sc_count)]
653
639
654
640
/*verify-ast
655
641
HLSLMaxVertexCountAttr <col:2, col:26> 12
656
642
*/
657
643
void maxvertexcount_valid2 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
658
644
{ stream.Append (v[0 ]); }
659
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
660
645
[maxvertexcount (sc_count + 3 )]
661
646
662
647
/*verify-ast
@@ -668,7 +653,6 @@ void maxvertexcount_valid3(triangle GSVertex v[3], inout TriangleStream<GSVertex
668
653
static const int4 sc_count4 = int4 (3 ,6 ,9 ,12 );
669
654
670
655
// The following passes fxc, but fails clang.
671
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
672
656
[maxvertexcount (sc_count4.w)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
673
657
674
658
/*verify-ast
@@ -679,7 +663,6 @@ void maxvertexcount_valid4(triangle GSVertex v[3], inout TriangleStream<GSVertex
679
663
680
664
// fxc:
681
665
// error X3084: cannot match attribute maxvertexcount, non-uint parameters found
682
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
683
666
[maxvertexcount (-12 )] /* expected-warning {{attribute 'maxvertexcount' must have a uint literal argument}} fxc-pass {{}} */
684
667
685
668
void negative_maxvertexcount (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -689,7 +672,6 @@ void negative_maxvertexcount(triangle GSVertex v[3], inout TriangleStream<GSVert
689
672
// warning X3554: cannot match attribute maxvertexcount, parameter 1 is expected to be of type int
690
673
// warning X3554: unknown attribute maxvertexcount, or attribute invalid for this statement, valid attributes are: maxvertexcount, MaxVertexCount, instance, RootSignature
691
674
// error X3514: 'float_maxvertexcount1' must have a max vertex count
692
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
693
675
[maxvertexcount (1.5 )] /* expected-warning {{attribute 'maxvertexcount' must have a uint literal argument}} fxc-pass {{}} */
694
676
695
677
void float_maxvertexcount1 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -700,7 +682,6 @@ void float_maxvertexcount1(triangle GSVertex v[3], inout TriangleStream<GSVertex
700
682
// warning X3554: unknown attribute maxvertexcount, or attribute invalid for this statement, valid attributes are: maxvertexcount, MaxVertexCount, instance, RootSignature
701
683
// error X3514: 'float_maxvertexcount2' must have a max vertex count
702
684
static const float sc_float = 1.5 ;
703
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
704
685
[maxvertexcount (sc_float)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
705
686
706
687
void float_maxvertexcount2 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -712,7 +693,6 @@ float f_count;
712
693
// fxc:
713
694
// error X3084: non-literal parameter(s) found for attribute maxvertexcount
714
695
// error X3514: 'uniform_maxvertexcount1' must have a max vertex count
715
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
716
696
[maxvertexcount (i_count)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
717
697
718
698
void uniform_maxvertexcount1 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -722,7 +702,6 @@ void uniform_maxvertexcount1(triangle GSVertex v[3], inout TriangleStream<GSVert
722
702
// warning X3554: cannot match attribute maxvertexcount, parameter 1 is expected to be of type int
723
703
// warning X3554: unknown attribute maxvertexcount, or attribute invalid for this statement, valid attributes are: maxvertexcount, MaxVertexCount, instance, RootSignature
724
704
// error X3514: 'uniform_maxvertexcount2' must have a max vertex count
725
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
726
705
[maxvertexcount (f_count)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
727
706
728
707
void uniform_maxvertexcount2 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -855,7 +834,6 @@ bool Test_Call() {
855
834
}
856
835
857
836
// Test EarlyDepthStencil
858
- /* expected-warning@+1{{attribute 'earlydepthstencil' ignored without accompanying shader attribute}} */
859
837
[EarlyDepthStencil]
860
838
861
839
bool Test_EarlyDepthStencil () {
@@ -888,79 +866,69 @@ bool Test_Loop() {
888
866
889
867
// Test ClipPlanes
890
868
float4 ClipPlanesVal;
891
- /* expected-warning@+1{{attribute 'clipplanes' ignored without accompanying shader attribute}} */
892
869
[ClipPlanes (ClipPlanesVal)]
893
870
894
871
bool Test_ClipPlanes () {
895
872
return true ;
896
873
}
897
874
898
875
// Test Domain
899
- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
900
876
[Domain ("tri" )]
901
877
902
878
bool Test_Domain () {
903
879
return true ;
904
880
}
905
881
906
882
// Test Instance
907
- /* expected-warning@+1{{attribute 'instance' ignored without accompanying shader attribute}} */
908
883
[Instance (1 )]
909
884
910
885
bool Test_Instance () {
911
886
return true ;
912
887
}
913
888
914
889
// Test MaxTessFactor
915
- /* expected-warning@+1{{attribute 'maxtessfactor' ignored without accompanying shader attribute}} */
916
890
[MaxTessFactor (1 )]
917
891
918
892
bool Test_MaxTessFactor () {
919
893
return true ;
920
894
}
921
895
922
896
// Test MaxVertexCount
923
- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
924
897
[MaxVertexCount (1 )]
925
898
926
899
bool Test_MaxVertexCount () {
927
900
return true ;
928
901
}
929
902
930
903
// Test NumThreads
931
- /* expected-warning@+1{{attribute 'numthreads' ignored without accompanying shader attribute}} */
932
904
[NumThreads (1 ,2 ,3 )]
933
905
934
906
bool Test_NumThreads () {
935
907
return true ;
936
908
}
937
909
938
910
// Test OutputControlPoints
939
- /* expected-warning@+1{{attribute 'outputcontrolpoints' ignored without accompanying shader attribute}} */
940
911
[OutputControlPoints (2 )]
941
912
942
913
bool Test_OutputControlPoints () {
943
914
return true ;
944
915
}
945
916
946
917
// Test OutputTopology
947
- /* expected-warning@+1{{attribute 'outputtopology' ignored without accompanying shader attribute}} */
948
918
[OutputTopology ("line" )]
949
919
950
920
bool Test_OutputTopology () {
951
921
return true ;
952
922
}
953
923
954
924
// Test Partitioning
955
- /* expected-warning@+1{{attribute 'partitioning' ignored without accompanying shader attribute}} */
956
925
[Partitioning ("integer" )]
957
926
958
927
bool Test_Partitioning () {
959
928
return true ;
960
929
}
961
930
962
931
// Test PatchConstantFunc
963
- /* expected-warning@+1{{attribute 'patchconstantfunc' ignored without accompanying shader attribute}} */
964
932
[PatchConstantFunc ("Test_Partitioning" )]
965
933
966
934
bool Test_PatchConstantFunc () {
@@ -969,7 +937,6 @@ bool Test_PatchConstantFunc() {
969
937
970
938
// Test RootSignature
971
939
// strange how RootSignature is the only attribute that is spelled with capitals.
972
- /* expected-warning@+1{{attribute 'RootSignature' ignored without accompanying shader attribute}} */
973
940
[RootSignature ("" )]
974
941
975
942
bool Test_RootSignature () {
0 commit comments