Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,17 @@ WexLogFileOutput/*
#==============================================================================#
bindings/go/llvm/llvm_config.go
bindings/go/llvm/workdir

# RTC ignores

# Premake generated files #
###########################
*.vcxproj*
*.sln
*.make
Makefile
*.xcworkspace
*.xcodeproj
compile_commands.json
*_single_file_build.cpp
*_unity_build.cpp
22 changes: 22 additions & 0 deletions conanfile_rtc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from conans import ConanFile

class DirectXShaderCompilerConan(ConanFile):
name = "DirectXShaderCompiler"
version = "0.0.1"
url = "https://github.com/Esri/DirectXShaderCompiler/blob/runtimecore"
license = "https://github.com/Esri/DirectXShaderCompiler/blob/runtimecore/LICENSE.TXT"
description = "A compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation"

# RTC specific triple
settings = "platform_architecture_target"

def package(self):
base = self.source_folder
relative = "3rdparty/DirectXShaderCompiler"

# headers
self.copy("*.h", src=base + "/include/dxc", dst=relative + "/include/dxc")
self.copy("*.hpp", src=base + "/include/dxc", dst=relative + "/include/dxc")

# libraries
# Only headers are required by RTC, at present: no library
27 changes: 23 additions & 4 deletions tools/clang/lib/SPIRV/AstTypeProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ clang::DiagnosticBuilder emitError(const clang::ASTContext &astContext,
clang::DiagnosticsEngine::Error, message);
return astContext.getDiagnostics().Report(srcLoc, diagId);
}

// Returns the attribute of the given type attached to the record declaration
// behind \p type, or nullptr if there is none. Attributes live on the
// declaration, so they cannot be retrieved with QualType::getAs (which only
// navigates the clang::Type hierarchy).
template <typename AttrType> AttrType *getAttr(clang::QualType type) {
type = type.getCanonicalType();
if (const clang::RecordType *RT = type->getAs<clang::RecordType>()) {
if (const auto *Spec =
clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(
RT->getDecl()))
if (const auto *Template = clang::dyn_cast<clang::ClassTemplateDecl>(
Spec->getSpecializedTemplate()))
return Template->getTemplatedDecl()->getAttr<AttrType>();
if (const auto *Decl = clang::dyn_cast<clang::CXXRecordDecl>(RT->getDecl()))
return Decl->getAttr<AttrType>();
}
return nullptr;
}
} // namespace

namespace clang {
Expand Down Expand Up @@ -1001,8 +1020,8 @@ bool isResourceDescriptorHeap(const Decl *D) {
}

bool isResourceDescriptorHeap(QualType T) {
const RecordType *RT = T->getAs<RecordType>();
return RT && RT->getDecl()->getName() == ".Resource";
const HLSLDynamicResourceAttr *Attr = getAttr<HLSLDynamicResourceAttr>(T);
return Attr && !Attr->getIsSampler();
}

bool isSamplerDescriptorHeap(const Decl *D) {
Expand All @@ -1011,8 +1030,8 @@ bool isSamplerDescriptorHeap(const Decl *D) {
}

bool isSamplerDescriptorHeap(QualType T) {
const RecordType *RT = T->getAs<RecordType>();
return RT && RT->getDecl()->getName() == ".Sampler";
const HLSLDynamicResourceAttr *Attr = getAttr<HLSLDynamicResourceAttr>(T);
return Attr && Attr->getIsSampler();
}

bool isAKindOfStructuredOrByteBuffer(QualType type) {
Expand Down
Loading