function_defined_in_struct.azsl 476 B

1234567891011121314151617181920212223242526272829
  1. // Syntax error of function definition inside struct.
  2. // Syntax error #516: structs cannot have member functions; consider using a class.
  3. // #EC 516
  4. ShaderResourceGroupSemantic slot1
  5. {
  6. FrequencyId = 1;
  7. };
  8. struct SomeStruct
  9. {
  10. float4 m_color;
  11. float4 GetColor()
  12. {
  13. return m_color;
  14. }
  15. };
  16. ShaderResourceGroup DemoSrg : slot1
  17. {
  18. SomeStruct m_data;
  19. };
  20. float4 MainPS() : SV_Target0
  21. {
  22. float4 color = DemoSrg::m_data.GetColor();
  23. return color;
  24. }