vk.attribute.error.hlsl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Run: %dxc -T ps_6_0 -E main
  2. struct S {
  3. [[vk::binding(5)]] // error
  4. float4 f;
  5. [[vk::counter_binding(11)]] // error
  6. float4 g;
  7. };
  8. [[vk::counter_binding(3)]] // error
  9. SamplerState mySampler;
  10. [[vk::counter_binding(4)]] // error
  11. Texture2D myTexture;
  12. [[vk::counter_binding(5)]] // error
  13. StructuredBuffer<S> mySBuffer;
  14. [[vk::location(5)]] // error
  15. ConsumeStructuredBuffer<S> myCSBuffer;
  16. [[vk::location(12)]] // error
  17. cbuffer myCBuffer {
  18. float field;
  19. }
  20. [[vk::binding(10)]] // error
  21. float4 main([[vk::binding(15)]] float4 a: A // error
  22. ) : SV_Target {
  23. return 1.0;
  24. }
  25. struct T {
  26. [[vk::push_constant]] // error
  27. float4 f;
  28. };
  29. [[vk::push_constant]] // error
  30. float foo([[vk::push_constant]] int param) // error
  31. {
  32. return param;
  33. }
  34. [[vk::push_constant(5)]]
  35. T pcs;
  36. // CHECK: :4:7: error: 'binding' attribute only applies to global variables, cbuffers, and tbuffers
  37. // CHECK: :6:7: error: 'counter_binding' attribute only applies to RWStructuredBuffers, AppendStructuredBuffers, and ConsumeStructuredBuffers
  38. // CHECK: :10:3: error: 'counter_binding' attribute only applies to RWStructuredBuffers, AppendStructuredBuffers, and ConsumeStructuredBuffers
  39. // CHECK: :12:3: error: 'counter_binding' attribute only applies to RWStructuredBuffers, AppendStructuredBuffers, and ConsumeStructuredBuffers
  40. // CHECK: :14:3: error: 'counter_binding' attribute only applies to RWStructuredBuffers, AppendStructuredBuffers, and ConsumeStructuredBuffers
  41. // CHECK: :17:3: error: 'location' attribute only applies to functions, parameters, and fields
  42. // CHECK: :20:3: error: 'location' attribute only applies to functions, parameters, and fields
  43. // CHECK: :26:15: error: 'binding' attribute only applies to global variables, cbuffers, and tbuffers
  44. // CHECK: :25:3: error: 'binding' attribute only applies to global variables, cbuffers, and tbuffers
  45. // CHECK: :32:7: error: 'push_constant' attribute only applies to global variables of struct type
  46. // CHECK: :37:13: error: 'push_constant' attribute only applies to global variables of struct type
  47. // CHECK: :36:3: error: 'push_constant' attribute only applies to global variables of struct type
  48. // CHECK: :42:3: error: 'push_constant' attribute takes no arguments