From 089d6a9e654caa186ea34ad7fc156c7f1c43953b Mon Sep 17 00:00:00 2001 From: Duncan Thomson Date: Mon, 3 Jun 2024 21:12:35 +0100 Subject: [PATCH 1/4] Update .gitignore --- .gitignore | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 2c0c36de16..c38dfd9385 100644 --- a/.gitignore +++ b/.gitignore @@ -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 From 6f8f7fd263f5b8b68dab23763bdcbcb741fccf17 Mon Sep 17 00:00:00 2001 From: Duncan Thomson Date: Mon, 3 Jun 2024 21:12:56 +0100 Subject: [PATCH 2/4] Add conanfile_rtc.py --- conanfile_rtc.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 conanfile_rtc.py diff --git a/conanfile_rtc.py b/conanfile_rtc.py new file mode 100644 index 0000000000..2535987034 --- /dev/null +++ b/conanfile_rtc.py @@ -0,0 +1,22 @@ +from conans import ConanFile + +class DirectXShaderCompilerConan(ConanFile): + name = "DirectXShaderCompiler" + version = "0.0.1" + url = "https://github.com/duncanthomson/DirectXShaderCompiler" + license = "https://github.com/duncanthomson/DirectXShaderCompiler/blob/main/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 From 2d201656911ced7276cc59b23c9a90e6bdb80c91 Mon Sep 17 00:00:00 2001 From: Duncan Thomson Date: Fri, 27 Sep 2024 14:35:18 +0100 Subject: [PATCH 3/4] arch: Tidy conanfile_rtc.py --- conanfile_rtc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conanfile_rtc.py b/conanfile_rtc.py index 2535987034..c1d1096ab5 100644 --- a/conanfile_rtc.py +++ b/conanfile_rtc.py @@ -3,8 +3,8 @@ class DirectXShaderCompilerConan(ConanFile): name = "DirectXShaderCompiler" version = "0.0.1" - url = "https://github.com/duncanthomson/DirectXShaderCompiler" - license = "https://github.com/duncanthomson/DirectXShaderCompiler/blob/main/LICENSE.TXT" + 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 From 3a970300c6ebcc4ba4f53e2be8fc7046e70f1be1 Mon Sep 17 00:00:00 2001 From: joaosaffran Date: Mon, 1 Jun 2026 16:26:52 -0700 Subject: [PATCH 4/4] [NFC] Replacing .Resource and .Sampler with attribute check (#8487) This patch cleans up a few places that use a string check to use an attribute check. --- tools/clang/lib/SPIRV/AstTypeProbe.cpp | 27 ++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tools/clang/lib/SPIRV/AstTypeProbe.cpp b/tools/clang/lib/SPIRV/AstTypeProbe.cpp index fda9a3ab3e..f7914680d7 100644 --- a/tools/clang/lib/SPIRV/AstTypeProbe.cpp +++ b/tools/clang/lib/SPIRV/AstTypeProbe.cpp @@ -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 AttrType *getAttr(clang::QualType type) { + type = type.getCanonicalType(); + if (const clang::RecordType *RT = type->getAs()) { + if (const auto *Spec = + clang::dyn_cast( + RT->getDecl())) + if (const auto *Template = clang::dyn_cast( + Spec->getSpecializedTemplate())) + return Template->getTemplatedDecl()->getAttr(); + if (const auto *Decl = clang::dyn_cast(RT->getDecl())) + return Decl->getAttr(); + } + return nullptr; +} } // namespace namespace clang { @@ -1001,8 +1020,8 @@ bool isResourceDescriptorHeap(const Decl *D) { } bool isResourceDescriptorHeap(QualType T) { - const RecordType *RT = T->getAs(); - return RT && RT->getDecl()->getName() == ".Resource"; + const HLSLDynamicResourceAttr *Attr = getAttr(T); + return Attr && !Attr->getIsSampler(); } bool isSamplerDescriptorHeap(const Decl *D) { @@ -1011,8 +1030,8 @@ bool isSamplerDescriptorHeap(const Decl *D) { } bool isSamplerDescriptorHeap(QualType T) { - const RecordType *RT = T->getAs(); - return RT && RT->getDecl()->getName() == ".Sampler"; + const HLSLDynamicResourceAttr *Attr = getAttr(T); + return Attr && Attr->getIsSampler(); } bool isAKindOfStructuredOrByteBuffer(QualType type) {