
The pipeline state data captured in the PSV0 section of the DXContainer file encodes signature elements which are read by the runtime to map inputs and outputs from the GPU program. This change adds support for generating and parsing signature elements with testing driven through the ObjectYAML tooling. Reviewed By: bogner Differential Revision: https://reviews.llvm.org/D157671 Initially landed as 8c567e64f808f7a818965c6bc123fedf7db7336f, and reverted in 4d800633b2683304a5431d002d8ffc40a1815520. ../llvm/include/llvm/BinaryFormat/DXContainerConstants.def ../llvm/test/ObjectYAML/DXContainer/PSVv1-amplification.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-compute.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-domain.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-geometry.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-vertex.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-amplification.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-compute.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-domain.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-geometry.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-vertex.yaml
62 lines
2.0 KiB
C++
62 lines
2.0 KiB
C++
|
|
//===-- 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"
|
|
#include "llvm/Support/ScopedPrinter.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);
|
|
}
|
|
|
|
#define SEMANTIC_KIND(Val, Enum) {#Enum, PSV::SemanticKind::Enum},
|
|
|
|
static const EnumEntry<PSV::SemanticKind> SemanticKindNames[] = {
|
|
#include "llvm/BinaryFormat/DXContainerConstants.def"
|
|
};
|
|
|
|
ArrayRef<EnumEntry<PSV::SemanticKind>> PSV::getSemanticKinds() {
|
|
return ArrayRef(SemanticKindNames);
|
|
}
|
|
|
|
#define COMPONENT_TYPE(Val, Enum) {#Enum, PSV::ComponentType::Enum},
|
|
|
|
static const EnumEntry<PSV::ComponentType> ComponentTypeNames[] = {
|
|
#include "llvm/BinaryFormat/DXContainerConstants.def"
|
|
};
|
|
|
|
ArrayRef<EnumEntry<PSV::ComponentType>> PSV::getComponentTypes() {
|
|
return ArrayRef(ComponentTypeNames);
|
|
}
|
|
|
|
#define INTERPOLATION_MODE(Val, Enum) {#Enum, PSV::InterpolationMode::Enum},
|
|
|
|
static const EnumEntry<PSV::InterpolationMode> InterpolationModeNames[] = {
|
|
#include "llvm/BinaryFormat/DXContainerConstants.def"
|
|
};
|
|
|
|
ArrayRef<EnumEntry<PSV::InterpolationMode>> PSV::getInterpolationModes() {
|
|
return ArrayRef(InterpolationModeNames);
|
|
}
|