浏览代码

[spirv] None (0x0) is an invalid Image Operand. (#1311)

Ehsan 7 年之前
父节点
当前提交
f28b030c74
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 2 1
      tools/clang/lib/SPIRV/InstBuilderManual.cpp
  2. 1 1
      tools/clang/test/CodeGenSPIRV/texture.sample.hlsl

+ 2 - 1
tools/clang/lib/SPIRV/InstBuilderManual.cpp

@@ -188,7 +188,8 @@ InstBuilder &InstBuilder::opImageSample(
   TheInst.emplace_back(coordinate);
   TheInst.emplace_back(coordinate);
   if (dref)
   if (dref)
     TheInst.emplace_back(dref);
     TheInst.emplace_back(dref);
-  if (image_operands.hasValue()) {
+  if (image_operands.hasValue() &&
+      image_operands.getValue() != spv::ImageOperandsMask::MaskNone) {
     const auto &val = image_operands.getValue();
     const auto &val = image_operands.getValue();
     encodeImageOperands(val);
     encodeImageOperands(val);
   }
   }

+ 1 - 1
tools/clang/test/CodeGenSPIRV/texture.sample.hlsl

@@ -98,7 +98,7 @@ float4 main(int2 offset: A) : SV_Target {
 // Make sure OpImageSparseSampleImplicitLod returns a struct, in which the second member is a vec4.
 // Make sure OpImageSparseSampleImplicitLod returns a struct, in which the second member is a vec4.
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
-// CHECK: [[v4result:%\d+]] = OpImageSampleImplicitLod %v4float {{%\d+}} %float_0_5 None
+// CHECK: [[v4result:%\d+]] = OpImageSampleImplicitLod %v4float {{%\d+}} %float_0_5
 // CHECK:          {{%\d+}} = OpCompositeExtract %float [[v4result]] 0
 // CHECK:          {{%\d+}} = OpCompositeExtract %float [[v4result]] 0
 	float  val9  = t5.Sample(gSampler, 0.5);
 	float  val9  = t5.Sample(gSampler, 0.5);