From dfd93963232c923f2ea331d7b30aa59bbfaa43ca Mon Sep 17 00:00:00 2001 From: SaeruHikari <39457738+SaeruHikari@users.noreply.github.com> Date: Wed, 22 May 2024 00:40:19 +0800 Subject: [PATCH 1/5] [ClangCXX] Add Swizzle Support --- src/clangcxx/src/llvm/ASTConsumer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/clangcxx/src/llvm/ASTConsumer.cpp b/src/clangcxx/src/llvm/ASTConsumer.cpp index b21e8d69b..5a721259f 100644 --- a/src/clangcxx/src/llvm/ASTConsumer.cpp +++ b/src/clangcxx/src/llvm/ASTConsumer.cpp @@ -876,6 +876,12 @@ struct ExprTranslator : public clang::RecursiveASTVisitor { if (*iter == 'y') swizzle_seq[swizzle_size] = 1u; if (*iter == 'z') swizzle_seq[swizzle_size] = 2u; if (*iter == 'w') swizzle_seq[swizzle_size] = 3u; + + if (*iter == 'r') swizzle_seq[swizzle_size] = 0u; + if (*iter == 'g') swizzle_seq[swizzle_size] = 1u; + if (*iter == 'b') swizzle_seq[swizzle_size] = 2u; + if (*iter == 'a') swizzle_seq[swizzle_size] = 3u; + swizzle_size += 1; } // encode swizzle code From 99f360becb66fa1814391a8fe199af1078a203b2 Mon Sep 17 00:00:00 2001 From: SaeruHikari <39457738+SaeruHikari@users.noreply.github.com> Date: Thu, 23 May 2024 00:24:02 +0800 Subject: [PATCH 2/5] [ClangCXX] Ignore Ctor Initializers for Builtin Types --- src/clangcxx/src/llvm/ASTConsumer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/clangcxx/src/llvm/ASTConsumer.cpp b/src/clangcxx/src/llvm/ASTConsumer.cpp index 5a721259f..e8bbe7bd8 100644 --- a/src/clangcxx/src/llvm/ASTConsumer.cpp +++ b/src/clangcxx/src/llvm/ASTConsumer.cpp @@ -1105,6 +1105,7 @@ struct ExprTranslator : public clang::RecursiveASTVisitor { auto FunctionBuilderBuilder::build(const clang::FunctionDecl *S, bool allowKernel) -> BuildResult { BuildResult result{ .dimension = 0}; + bool is_builtin_type_method = false; bool is_ignore = false; bool is_kernel = false; bool is_vertex = false; @@ -1147,7 +1148,10 @@ auto FunctionBuilderBuilder::build(const clang::FunctionDecl *S, bool allowKerne if (auto thisType = Method->getParent()) { is_ignore |= thisType->isUnion();// ignore union for (auto Anno : thisType->specific_attrs()) - is_ignore |= isBuiltinType(Anno); + { + is_builtin_type_method |= isBuiltinType(Anno); + is_ignore |= is_builtin_type_method; + } if (thisType->isLambda())// ignore global lambda declares, we deal them on stacks only is_lambda = true; @@ -1326,7 +1330,7 @@ auto FunctionBuilderBuilder::build(const clang::FunctionDecl *S, bool allowKerne } // ctor initializers - if (is_method) { + if (is_method && !is_builtin_type_method) { if (auto lcType = db->FindOrAddType(methodThisType, S->getBeginLoc())) { auto this_local = db->GetFunctionThis(builder); if (auto Ctor = llvm::dyn_cast(S)) { From d4a75275b368d26168eeb3f9cfad42531bb7a5b6 Mon Sep 17 00:00:00 2001 From: SaeruHikari <39457738+SaeruHikari@users.noreply.github.com> Date: Thu, 23 May 2024 00:53:19 +0800 Subject: [PATCH 3/5] [ClangCXX] Support Conditional Operator --- src/clangcxx/src/llvm/ASTConsumer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/clangcxx/src/llvm/ASTConsumer.cpp b/src/clangcxx/src/llvm/ASTConsumer.cpp index e8bbe7bd8..85fa15224 100644 --- a/src/clangcxx/src/llvm/ASTConsumer.cpp +++ b/src/clangcxx/src/llvm/ASTConsumer.cpp @@ -800,6 +800,12 @@ struct ExprTranslator : public clang::RecursiveASTVisitor { } current = fb->binary(lcType, TranslateBinaryOp(cxx_op), lhs, rhs); } + } else if (auto cxxCondOp = llvm::dyn_cast(x)) { + auto _cond = stack->GetExpr(cxxCondOp->getCond()); + auto _true = stack->GetExpr(cxxCondOp->getTrueExpr()); + auto _false = stack->GetExpr(cxxCondOp->getFalseExpr()); + const auto lcType = db->FindOrAddType(cxxCondOp->getType(), x->getBeginLoc()); + current = fb->call(lcType, CallOp::SELECT, {_false, _true, _cond}); } else if (auto dref = llvm::dyn_cast(x)) { auto str = luisa::string(dref->getNameInfo().getName().getAsString()); if (auto _current = stack->GetLocal(dref->getDecl())) { From 96da00ac3e7d88376d7eacdc75b1a1c5871c0f71 Mon Sep 17 00:00:00 2001 From: Yuefeng Geng Date: Thu, 23 May 2024 09:04:37 +0800 Subject: [PATCH 4/5] update ext --- src/ext/imgui | 2 +- src/ext/xxHash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ext/imgui b/src/ext/imgui index b39fc84f8..36ffdd69d 160000 --- a/src/ext/imgui +++ b/src/ext/imgui @@ -1 +1 @@ -Subproject commit b39fc84f8919b87c9d79f6ffaf43efb61d2beb3d +Subproject commit 36ffdd69d304659388ad3d3be487a467de65eaf6 diff --git a/src/ext/xxHash b/src/ext/xxHash index e9455b2c2..ac3a25da3 160000 --- a/src/ext/xxHash +++ b/src/ext/xxHash @@ -1 +1 @@ -Subproject commit e9455b2c204df00f31200392f96ac12197de8bf0 +Subproject commit ac3a25da3d957d9ef3e4114d9f8332d34ce83a46 From 3628f3fae9e1e4fb5e8d058f8312dabf15cb28f7 Mon Sep 17 00:00:00 2001 From: Yuefeng Geng Date: Thu, 23 May 2024 16:19:56 +0800 Subject: [PATCH 5/5] Update EASTL --- src/ext/EASTL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ext/EASTL b/src/ext/EASTL index 174086101..17d7f0aa5 160000 --- a/src/ext/EASTL +++ b/src/ext/EASTL @@ -1 +1 @@ -Subproject commit 174086101661c3616ee2dfebf8cf3bceb0938dae +Subproject commit 17d7f0aa5aed08a9a2c509915fbf84db0d362b04