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
33
44// To test with the classic compiler, run
55// %sdxroot%\tools\x86\fxc.exe /T ps_5_1 attributes.hlsl
@@ -352,11 +352,8 @@ int uav() {
352352
353353[domain] int domain_fn_missing () { return 1 ; } // expected-error {{'domain' attribute takes one argument}} fxc-pass {{}}
354354[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}} */
356355[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}} */
358356[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}} */
360357[domain (1 )] int domain_fn_int () { return 1 ; } // expected-error {{attribute 'domain' must have a string literal argument}} fxc-pass {{}}
361358[domain ("quad" ,"quad" )] int domain_fn_mul () { return 1 ; } // expected-error {{'domain' attribute takes one argument}} fxc-pass {{}}
362359[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() {
367364[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}}
368365[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}}
369366
370- /* expected-warning@+1{{attribute 'partitioning' ignored without accompanying shader attribute}} */
371367[partitioning ("fractional_even" )] int partitioning_fn_ok () { return 1 ; }
372368
373369struct HSFoo
@@ -381,30 +377,22 @@ Texture2D<float4> tex1[10] : register( t20, space10 );
381377 `-RegisterAssignment <col:30> register(t20, space10)
382378*/
383379
384- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
385380[domain (123 )] // expected-error {{attribute 'domain' must have a string literal argument}} fxc-pass {{}}
386381[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}} */
388382[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}} */
390383[outputcontrolpoints (-1 )] // expected-warning {{attribute 'outputcontrolpoints' must have a uint literal argument}} fxc-pass {{}}
391384[patchconstantfunc ("PatchFoo" , "ExtraArgument" )] // expected-error {{'patchconstantfunc' attribute takes one argument}} fxc-pass {{}}
392385
393386void all_wrong () { }
394387
395- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
396388[domain ("quad" )]
397389/*verify-ast
398390 HLSLDomainAttr <col:2, col:15> "quad"
399391*/
400392
401- /* expected-warning@+1{{attribute 'partitioning' ignored without accompanying shader attribute}} */
402393[partitioning ("integer" )]
403- /* expected-warning@+1{{attribute 'outputtopology' ignored without accompanying shader attribute}} */
404394[outputtopology ("triangle_cw" )]
405- /* expected-warning@+1{{attribute 'outputcontrolpoints' ignored without accompanying shader attribute}} */
406395[outputcontrolpoints (16 )]
407- /* expected-warning@+1{{attribute 'patchconstantfunc' ignored without accompanying shader attribute}} */
408396[patchconstantfunc ("PatchFoo" )]
409397
410398HSFoo HSMain ( InputPatch <HSFoo, 16 > p,
@@ -638,7 +626,6 @@ float4 clipplanes_good_parens();
638626// place the errors in comments before the function, but not with the standard
639627// fxc error comments on the line.
640628struct GSVertex { float4 pos : SV_Position ; };
641- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
642629[maxvertexcount (12 )]
643630
644631/*verify-ast
@@ -648,15 +635,13 @@ void maxvertexcount_valid1(triangle GSVertex v[3], inout TriangleStream<GSVertex
648635{ stream.Append (v[0 ]); }
649636
650637static const int sc_count = 12 ;
651- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
652638[maxvertexcount (sc_count)]
653639
654640/*verify-ast
655641 HLSLMaxVertexCountAttr <col:2, col:26> 12
656642*/
657643void maxvertexcount_valid2 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
658644{ stream.Append (v[0 ]); }
659- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
660645[maxvertexcount (sc_count + 3 )]
661646
662647/*verify-ast
@@ -668,7 +653,6 @@ void maxvertexcount_valid3(triangle GSVertex v[3], inout TriangleStream<GSVertex
668653static const int4 sc_count4 = int4 (3 ,6 ,9 ,12 );
669654
670655// The following passes fxc, but fails clang.
671- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
672656[maxvertexcount (sc_count4.w)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
673657
674658/*verify-ast
@@ -679,7 +663,6 @@ void maxvertexcount_valid4(triangle GSVertex v[3], inout TriangleStream<GSVertex
679663
680664// fxc:
681665// error X3084: cannot match attribute maxvertexcount, non-uint parameters found
682- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
683666[maxvertexcount (-12 )] /* expected-warning {{attribute 'maxvertexcount' must have a uint literal argument}} fxc-pass {{}} */
684667
685668void negative_maxvertexcount (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -689,7 +672,6 @@ void negative_maxvertexcount(triangle GSVertex v[3], inout TriangleStream<GSVert
689672// warning X3554: cannot match attribute maxvertexcount, parameter 1 is expected to be of type int
690673// warning X3554: unknown attribute maxvertexcount, or attribute invalid for this statement, valid attributes are: maxvertexcount, MaxVertexCount, instance, RootSignature
691674// error X3514: 'float_maxvertexcount1' must have a max vertex count
692- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
693675[maxvertexcount (1.5 )] /* expected-warning {{attribute 'maxvertexcount' must have a uint literal argument}} fxc-pass {{}} */
694676
695677void float_maxvertexcount1 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -700,7 +682,6 @@ void float_maxvertexcount1(triangle GSVertex v[3], inout TriangleStream<GSVertex
700682// warning X3554: unknown attribute maxvertexcount, or attribute invalid for this statement, valid attributes are: maxvertexcount, MaxVertexCount, instance, RootSignature
701683// error X3514: 'float_maxvertexcount2' must have a max vertex count
702684static const float sc_float = 1.5 ;
703- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
704685[maxvertexcount (sc_float)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
705686
706687void float_maxvertexcount2 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -712,7 +693,6 @@ float f_count;
712693// fxc:
713694// error X3084: non-literal parameter(s) found for attribute maxvertexcount
714695// error X3514: 'uniform_maxvertexcount1' must have a max vertex count
715- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
716696[maxvertexcount (i_count)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
717697
718698void uniform_maxvertexcount1 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -722,7 +702,6 @@ void uniform_maxvertexcount1(triangle GSVertex v[3], inout TriangleStream<GSVert
722702// warning X3554: cannot match attribute maxvertexcount, parameter 1 is expected to be of type int
723703// warning X3554: unknown attribute maxvertexcount, or attribute invalid for this statement, valid attributes are: maxvertexcount, MaxVertexCount, instance, RootSignature
724704// error X3514: 'uniform_maxvertexcount2' must have a max vertex count
725- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
726705[maxvertexcount (f_count)] /* expected-error {{'maxvertexcount' attribute requires an integer constant}} fxc-pass {{}} */
727706
728707void uniform_maxvertexcount2 (triangle GSVertex v[3 ], inout TriangleStream <GSVertex> stream)
@@ -855,7 +834,6 @@ bool Test_Call() {
855834}
856835
857836// Test EarlyDepthStencil
858- /* expected-warning@+1{{attribute 'earlydepthstencil' ignored without accompanying shader attribute}} */
859837[EarlyDepthStencil]
860838
861839bool Test_EarlyDepthStencil () {
@@ -888,79 +866,69 @@ bool Test_Loop() {
888866
889867// Test ClipPlanes
890868float4 ClipPlanesVal;
891- /* expected-warning@+1{{attribute 'clipplanes' ignored without accompanying shader attribute}} */
892869[ClipPlanes (ClipPlanesVal)]
893870
894871bool Test_ClipPlanes () {
895872 return true ;
896873}
897874
898875// Test Domain
899- /* expected-warning@+1{{attribute 'domain' ignored without accompanying shader attribute}} */
900876[Domain ("tri" )]
901877
902878bool Test_Domain () {
903879 return true ;
904880}
905881
906882// Test Instance
907- /* expected-warning@+1{{attribute 'instance' ignored without accompanying shader attribute}} */
908883[Instance (1 )]
909884
910885bool Test_Instance () {
911886 return true ;
912887}
913888
914889// Test MaxTessFactor
915- /* expected-warning@+1{{attribute 'maxtessfactor' ignored without accompanying shader attribute}} */
916890[MaxTessFactor (1 )]
917891
918892bool Test_MaxTessFactor () {
919893 return true ;
920894}
921895
922896// Test MaxVertexCount
923- /* expected-warning@+1{{attribute 'maxvertexcount' ignored without accompanying shader attribute}} */
924897[MaxVertexCount (1 )]
925898
926899bool Test_MaxVertexCount () {
927900 return true ;
928901}
929902
930903// Test NumThreads
931- /* expected-warning@+1{{attribute 'numthreads' ignored without accompanying shader attribute}} */
932904[NumThreads (1 ,2 ,3 )]
933905
934906bool Test_NumThreads () {
935907 return true ;
936908}
937909
938910// Test OutputControlPoints
939- /* expected-warning@+1{{attribute 'outputcontrolpoints' ignored without accompanying shader attribute}} */
940911[OutputControlPoints (2 )]
941912
942913bool Test_OutputControlPoints () {
943914 return true ;
944915}
945916
946917// Test OutputTopology
947- /* expected-warning@+1{{attribute 'outputtopology' ignored without accompanying shader attribute}} */
948918[OutputTopology ("line" )]
949919
950920bool Test_OutputTopology () {
951921 return true ;
952922}
953923
954924// Test Partitioning
955- /* expected-warning@+1{{attribute 'partitioning' ignored without accompanying shader attribute}} */
956925[Partitioning ("integer" )]
957926
958927bool Test_Partitioning () {
959928 return true ;
960929}
961930
962931// Test PatchConstantFunc
963- /* expected-warning@+1{{attribute 'patchconstantfunc' ignored without accompanying shader attribute}} */
964932[PatchConstantFunc ("Test_Partitioning" )]
965933
966934bool Test_PatchConstantFunc () {
@@ -969,7 +937,6 @@ bool Test_PatchConstantFunc() {
969937
970938// Test RootSignature
971939// strange how RootSignature is the only attribute that is spelled with capitals.
972- /* expected-warning@+1{{attribute 'RootSignature' ignored without accompanying shader attribute}} */
973940[RootSignature ("" )]
974941
975942bool Test_RootSignature () {
0 commit comments