function_declared_in_struct.azsl 442 B

1234567891011121314151617181920212223242526
  1. // Syntax error of function declaration 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. ShaderResourceGroup DemoSrg : slot1
  14. {
  15. SomeStruct m_data;
  16. };
  17. float4 MainPS() : SV_Target0
  18. {
  19. float4 color = DemoSrg::m_data.GetColor();
  20. return color;
  21. }