Browse Source

Revert "Fix crash for vector smoothstep."

This reverts commit 3bfa9960a83e3dc156992e03bf0e4b668251da81.
Xiang Li 7 years ago
parent
commit
1c103bb062

+ 5 - 1
lib/HLSL/HLOperationLower.cpp

@@ -1939,7 +1939,11 @@ Value *TranslateSmoothStep(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode,
   // return s * s *(3-2*s).
   Constant *c2 = ConstantFP::get(CI->getType(),2);
   Constant *c3 = ConstantFP::get(CI->getType(),3);
-
+  if (s->getType()->isVectorTy()) {
+    unsigned vecSize = s->getType()->getVectorNumElements();
+    c2 = ConstantVector::getSplat(vecSize, c2);
+    c3 = ConstantVector::getSplat(vecSize, c3);
+  }
   Value *sMul2 = Builder.CreateFMul(s, c2);
   Value *result = Builder.CreateFSub(c3, sMul2);
   result = Builder.CreateFMul(s, result);

+ 0 - 9
tools/clang/test/CodeGenHLSL/quick-test/vec_smooth_step.hlsl

@@ -1,9 +0,0 @@
-// RUN: %dxc -T ps_6_0 -E main %s | FileCheck %s
-
-// Make sure use vector smoothstep works.
-// CHECK: Saturate
-
-float2 main(float2 a : A) : SV_TARGET
-{
-  return smoothstep(a, 1.2,1.6);
-}