2
0
Эх сурвалжийг харах

[spirv] Remove addStageBuiltinVar overloaded function.

Ehsan 6 жил өмнө
parent
commit
59fd684eeb

+ 0 - 3
tools/clang/include/clang/SPIRV/SpirvBuilder.h

@@ -468,9 +468,6 @@ public:
   ///
   /// Note: The corresponding pointer type of the given type will not be
   /// constructed in this method.
-  SpirvVariable *addStageBuiltinVar(const SpirvType *type,
-                                    spv::StorageClass storageClass,
-                                    spv::BuiltIn, SourceLocation loc = {});
   SpirvVariable *addStageBuiltinVar(QualType type,
                                     spv::StorageClass storageClass,
                                     spv::BuiltIn, SourceLocation loc = {});

+ 1 - 1
tools/clang/lib/SPIRV/DeclResultIdMapper.cpp

@@ -2189,7 +2189,7 @@ SpirvVariable *DeclResultIdMapper::getBuiltinVar(spv::BuiltIn builtIn,
 
   // Create a dummy StageVar for this builtin variable
   auto var = spvBuilder.addStageBuiltinVar(
-      spvContext.getUIntType(32), spv::StorageClass::Input, builtIn, loc);
+      astContext.UnsignedIntTy, spv::StorageClass::Input, builtIn, loc);
 
   const hlsl::SigPoint *sigPoint =
       hlsl::SigPoint::GetSigPoint(hlsl::SigPointFromInputQual(

+ 7 - 6
tools/clang/lib/SPIRV/GlPerVertex.cpp

@@ -308,15 +308,16 @@ void GlPerVertex::calculateClipCullDistanceArraySize() {
 
 SpirvVariable *GlPerVertex::createClipCullDistanceVar(bool asInput, bool isClip,
                                                       uint32_t arraySize) {
-  const ArrayType *type = spvContext.getArrayType(
-      spvContext.getFloatType(32), arraySize, /*ArrayStride*/ llvm::None);
+  QualType type = astContext.getConstantArrayType(astContext.FloatTy,
+                                                  llvm::APInt(32, arraySize),
+                                                  clang::ArrayType::Normal, 0);
 
   if (asInput && inArraySize != 0) {
-    type =
-        spvContext.getArrayType(type, inArraySize, /*ArrayStride*/ llvm::None);
+    type = astContext.getConstantArrayType(type, llvm::APInt(32, inArraySize),
+                                           clang::ArrayType::Normal, 0);
   } else if (!asInput && outArraySize != 0) {
-    type = spvContext.getArrayType(type, outArraySize,
-                                   /*ArrayStride*/ llvm::None);
+    type = astContext.getConstantArrayType(type, llvm::APInt(32, outArraySize),
+                                           clang::ArrayType::Normal, 0);
   }
 
   spv::StorageClass sc =

+ 0 - 32
tools/clang/lib/SPIRV/SpirvBuilder.cpp

@@ -847,38 +847,6 @@ SpirvVariable *SpirvBuilder::addStageIOVar(QualType type,
   return var;
 }
 
-SpirvVariable *SpirvBuilder::addStageBuiltinVar(const SpirvType *type,
-                                                spv::StorageClass storageClass,
-                                                spv::BuiltIn builtin,
-                                                SourceLocation loc) {
-  // If the built-in variable has already been added (via a built-in alias),
-  // return the existing variable.
-  auto found = std::find_if(
-      builtinVars.begin(), builtinVars.end(),
-      [storageClass, builtin](const BuiltInVarInfo &varInfo) {
-        return varInfo.sc == storageClass && varInfo.builtIn == builtin;
-      });
-  if (found != builtinVars.end()) {
-    return found->variable;
-  }
-
-  // Note: We store the underlying type in the variable, *not* the pointer type.
-  auto *var =
-      new (context) SpirvVariable(/*QualType*/ {}, /*id*/ 0, loc, storageClass);
-  var->setResultType(type);
-  module->addVariable(var);
-
-  // Decorate with the specified Builtin
-  auto *decor = new (context) SpirvDecoration(
-      loc, var, spv::Decoration::BuiltIn, {static_cast<uint32_t>(builtin)});
-  module->addDecoration(decor);
-
-  // Add variable to cache.
-  builtinVars.emplace_back(storageClass, builtin, var);
-
-  return var;
-}
-
 SpirvVariable *SpirvBuilder::addStageBuiltinVar(QualType type,
                                                 spv::StorageClass storageClass,
                                                 spv::BuiltIn builtin,