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