DXContainer.cpp 1.0 KB

123456789101112131415161718192021222324252627282930
  1. //===-- llvm/BinaryFormat/DXContainer.cpp - DXContainer Utils ----*- C++-*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file contains utility functions for working with DXContainers.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "llvm/BinaryFormat/DXContainer.h"
  13. #include "llvm/ADT/StringSwitch.h"
  14. using namespace llvm;
  15. using namespace llvm::dxbc;
  16. dxbc::PartType dxbc::parsePartType(StringRef S) {
  17. #define CONTAINER_PART(PartName) .Case(#PartName, PartType::PartName)
  18. return StringSwitch<dxbc::PartType>(S)
  19. #include "llvm/BinaryFormat/DXContainerConstants.def"
  20. .Default(dxbc::PartType::Unknown);
  21. }
  22. bool ShaderHash::isPopulated() {
  23. static uint8_t Zeros[16] = {0};
  24. return Flags > 0 || 0 != memcmp(&Digest, &Zeros, 16);
  25. }