Skip to content

Commit 539374d

Browse files
authored
[SPIR-V] Fix OpSpecConstant for composite (#8278)
Updates SPIRV-Tools and fixes bad test. spirv-val got updated and now requries an OpSpecConstantComposite if one operand if an OpSpecConstant*. Should fix SPIRV-Tools smoke test.
1 parent 997e2f4 commit 539374d

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

external/SPIRV-Tools

Submodule SPIRV-Tools updated 113 files

tools/clang/lib/SPIRV/SpirvEmitter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8045,7 +8045,10 @@ SpirvInstruction *SpirvEmitter::createVectorSplat(const Expr *scalarExpr,
80458045
// Should find a more meaningful one.
80468046
if (auto *constVal = dyn_cast<SpirvConstant>(scalarVal)) {
80478047
llvm::SmallVector<SpirvConstant *, 4> elements(size_t(size), constVal);
8048-
const bool isSpecConst = constVal->getopcode() == spv::Op::OpSpecConstant;
8048+
const bool isSpecConst =
8049+
constVal->getopcode() == spv::Op::OpSpecConstant ||
8050+
constVal->getopcode() == spv::Op::OpSpecConstantFalse ||
8051+
constVal->getopcode() == spv::Op::OpSpecConstantTrue;
80498052
auto *value =
80508053
spvBuilder.getConstantComposite(vecType, elements, isSpecConst);
80518054
if (!value)
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// RUN: %dxc -T ps_6_0 -HV 2018 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK: OpDecorate %y SpecId 0
4+
// CHECK: %y = OpSpecConstantFalse %bool
45
[[vk::constant_id(0)]] const bool y = false;
56

7+
68
[shader("pixel")]
79
float4 main(float4 position : SV_Position) : SV_Target0 {
8-
// CHECK: OpConstantComposite %v4bool %y %y %y %y
10+
// CHECK: OpSpecConstantComposite %v4bool %y %y %y %y
911
return y ? position : 1.0;
1012
}

0 commit comments

Comments
 (0)