diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-04-14 21:41:27 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-06-22 18:20:56 +0000 |
commit | bdd1243df58e60e85101c09001d9812a789b6bc4 (patch) | |
tree | a1ce621c7301dd47ba2ddc3b8eaa63b441389481 /contrib/llvm-project/llvm/lib/BinaryFormat/DXContainer.cpp | |
parent | 781624ca2d054430052c828ba8d2c2eaf2d733e7 (diff) | |
parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/BinaryFormat/DXContainer.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/BinaryFormat/DXContainer.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/BinaryFormat/DXContainer.cpp b/contrib/llvm-project/llvm/lib/BinaryFormat/DXContainer.cpp new file mode 100644 index 000000000000..60a89c66d28c --- /dev/null +++ b/contrib/llvm-project/llvm/lib/BinaryFormat/DXContainer.cpp @@ -0,0 +1,30 @@ + +//===-- llvm/BinaryFormat/DXContainer.cpp - DXContainer Utils ----*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains utility functions for working with DXContainers. +// +//===----------------------------------------------------------------------===// + +#include "llvm/BinaryFormat/DXContainer.h" +#include "llvm/ADT/StringSwitch.h" + +using namespace llvm; +using namespace llvm::dxbc; + +dxbc::PartType dxbc::parsePartType(StringRef S) { +#define CONTAINER_PART(PartName) .Case(#PartName, PartType::PartName) + return StringSwitch<dxbc::PartType>(S) +#include "llvm/BinaryFormat/DXContainerConstants.def" + .Default(dxbc::PartType::Unknown); +} + +bool ShaderHash::isPopulated() { + static uint8_t Zeros[16] = {0}; + return Flags > 0 || 0 != memcmp(&Digest, &Zeros, 16); +} |