Util.cs 606 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Veldrid.SPIRV
  5. {
  6. internal static class Util
  7. {
  8. internal static unsafe string GetString(byte* data, uint length)
  9. {
  10. if (data == null) { return null; }
  11. return Encoding.UTF8.GetString(data, (int)length);
  12. }
  13. internal static bool HasSpirvHeader(byte[] bytes)
  14. {
  15. return bytes.Length > 4
  16. && bytes[0] == 0x03
  17. && bytes[1] == 0x02
  18. && bytes[2] == 0x23
  19. && bytes[3] == 0x07;
  20. }
  21. }
  22. }