Browse Source

[spirv] OpImageTexelPointer's return type is pointer type.

Ehsan Nasiri 6 years ago
parent
commit
922dbf111f

+ 8 - 0
tools/clang/lib/SPIRV/LowerTypeVisitor.cpp

@@ -82,6 +82,14 @@ bool LowerTypeVisitor::visitInstruction(SpirvInstruction *instr) {
     instr->setResultType(pointerType);
     break;
   }
+  // OpImageTexelPointer's result type must be a pointer with image storage
+  // class.
+  case spv::Op::OpImageTexelPointer: {
+    const SpirvType *pointerType =
+        spvContext.getPointerType(resultType, spv::StorageClass::Image);
+    instr->setResultType(pointerType);
+    break;
+  }
   // Sparse image operations return a sparse residency struct.
   case spv::Op::OpImageSparseSampleImplicitLod:
   case spv::Op::OpImageSparseSampleExplicitLod:

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

@@ -309,7 +309,7 @@ SpirvAtomic::SpirvAtomic(spv::Op op, QualType resultType, uint32_t resultId,
       pointer(pointerInst), scope(s), memorySemantic(semanticsEqual),
       memorySemanticUnequal(semanticsUnequal), value(valueInst),
       comparator(comparatorInst) {
-  assert(op == spv::Op::OpAtomicExchange);
+  assert(op == spv::Op::OpAtomicCompareExchange);
 }
 
 SpirvBarrier::SpirvBarrier(SourceLocation loc, spv::Scope memScope,