Skip to content

Commit 19bf4fc

Browse files
author
Greg Roth
committed
clang-format
1 parent eb41794 commit 19bf4fc

3 files changed

Lines changed: 32 additions & 22 deletions

File tree

lib/DxilValidation/DxilValidation.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,8 @@ static void ValidateResourceDxilOp(CallInst *CI, DXIL::OpCode opcode,
14841484
}
14851485
LLVM_FALLTHROUGH;
14861486
case DXIL::OpCode::RawBufferVectorLoad: {
1487-
Value *handle = CI->getOperand(DXIL::OperandIndex::kRawBufferLoadHandleOpIdx);
1487+
Value *handle =
1488+
CI->getOperand(DXIL::OperandIndex::kRawBufferLoadHandleOpIdx);
14881489
DXIL::ComponentType compTy;
14891490
DXIL::ResourceClass resClass;
14901491
DXIL::ResourceKind resKind =
@@ -1500,7 +1501,8 @@ static void ValidateResourceDxilOp(CallInst *CI, DXIL::OpCode opcode,
15001501
if (!isa<ConstantInt>(CI->getOperand(alignIdx)))
15011502
ValCtx.EmitInstrError(CI, ValidationRule::InstrConstAlignForRawBuf);
15021503

1503-
Value *offset = CI->getOperand(DXIL::OperandIndex::kRawBufferLoadElementOffsetOpIdx);
1504+
Value *offset =
1505+
CI->getOperand(DXIL::OperandIndex::kRawBufferLoadElementOffsetOpIdx);
15041506
switch (resKind) {
15051507
case DXIL::ResourceKind::RawBuffer:
15061508
if (!isa<UndefValue>(offset)) {
@@ -1530,15 +1532,17 @@ static void ValidateResourceDxilOp(CallInst *CI, DXIL::OpCode opcode,
15301532
DxilInst_RawBufferStore bufSt(CI);
15311533
ConstantInt *mask = dyn_cast<ConstantInt>(bufSt.get_mask());
15321534
unsigned stValMask =
1533-
StoreValueToMask({bufSt.get_value0(), bufSt.get_value1(),
1534-
bufSt.get_value2(), bufSt.get_value3()});
1535+
StoreValueToMask({bufSt.get_value0(), bufSt.get_value1(),
1536+
bufSt.get_value2(), bufSt.get_value3()});
15351537

15361538
if (!ValidateStorageMasks(CI, opcode, mask, stValMask, false /*isTyped*/,
15371539
ValCtx))
15381540
return;
1539-
} LLVM_FALLTHROUGH;
1541+
}
1542+
LLVM_FALLTHROUGH;
15401543
case DXIL::OpCode::RawBufferVectorStore: {
1541-
Value *handle = CI->getOperand(DXIL::OperandIndex::kRawBufferStoreHandleOpIdx);
1544+
Value *handle =
1545+
CI->getOperand(DXIL::OperandIndex::kRawBufferStoreHandleOpIdx);
15421546
DXIL::ComponentType compTy;
15431547
DXIL::ResourceClass resClass;
15441548
DXIL::ResourceKind resKind =
@@ -1552,12 +1556,14 @@ static void ValidateResourceDxilOp(CallInst *CI, DXIL::OpCode opcode,
15521556
alignIdx = DXIL::OperandIndex::kRawBufferVectorStoreAlignmentOpIdx;
15531557
unsigned valueIx = DXIL::OperandIndex::kRawBufferVectorStoreValOpIdx;
15541558
if (isa<UndefValue>(CI->getOperand(valueIx)))
1555-
ValCtx.EmitInstrError(CI, ValidationRule::InstrUndefinedValueForUAVStore);
1559+
ValCtx.EmitInstrError(CI,
1560+
ValidationRule::InstrUndefinedValueForUAVStore);
15561561
}
15571562
if (!isa<ConstantInt>(CI->getOperand(alignIdx)))
15581563
ValCtx.EmitInstrError(CI, ValidationRule::InstrConstAlignForRawBuf);
15591564

1560-
Value *offset = CI->getOperand(DXIL::OperandIndex::kRawBufferStoreElementOffsetOpIdx);
1565+
Value *offset =
1566+
CI->getOperand(DXIL::OperandIndex::kRawBufferStoreElementOffsetOpIdx);
15611567
switch (resKind) {
15621568
case DXIL::ResourceKind::RawBuffer:
15631569
if (!isa<UndefValue>(offset)) {

lib/HLSL/DxilScalarizeVectorLoadStores.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class DxilScalarizeVectorLoadStores : public ModulePass {
4949
hlsl::OP *HlslOP = DM.GetOP();
5050
for (auto FIt : HlslOP->GetOpFuncList(DXIL::OpCode::RawBufferVectorLoad)) {
5151
Function *Func = FIt.second;
52-
if (!Func) continue;
52+
if (!Func)
53+
continue;
5354
for (auto U = Func->user_begin(), UE = Func->user_end(); U != UE;) {
5455
CallInst *CI = cast<CallInst>(*(U++));
5556
scalarizeVectorLoad(HlslOP, M.getDataLayout(), CI);
@@ -58,7 +59,8 @@ class DxilScalarizeVectorLoadStores : public ModulePass {
5859
}
5960
for (auto FIt : HlslOP->GetOpFuncList(DXIL::OpCode::RawBufferVectorStore)) {
6061
Function *Func = FIt.second;
61-
if (!Func) continue;
62+
if (!Func)
63+
continue;
6264
for (auto U = Func->user_begin(), UE = Func->user_end(); U != UE;) {
6365
CallInst *CI = cast<CallInst>(*(U++));
6466
scalarizeVectorStore(HlslOP, M.getDataLayout(), CI);

tools/clang/unittests/HLSL/ValidationTest.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,21 +1506,23 @@ TEST_F(ValidationTest, StructBufStrideOutOfBound) {
15061506
}
15071507

15081508
TEST_F(ValidationTest, StructBufLoadCoordinates) {
1509-
RewriteAssemblyCheckMsg(L"..\\DXILValidation\\struct_buf1.hlsl", "ps_6_0",
1510-
"bufferLoad.f32(i32 68, %dx.types.Handle "
1511-
"%buf1_texture_structbuf, i32 1, i32 8)",
1512-
"bufferLoad.f32(i32 68, %dx.types.Handle "
1513-
"%buf1_texture_structbuf, i32 1, i32 undef)",
1514-
"structured buffer requires defined index and offset coordinates");
1509+
RewriteAssemblyCheckMsg(
1510+
L"..\\DXILValidation\\struct_buf1.hlsl", "ps_6_0",
1511+
"bufferLoad.f32(i32 68, %dx.types.Handle "
1512+
"%buf1_texture_structbuf, i32 1, i32 8)",
1513+
"bufferLoad.f32(i32 68, %dx.types.Handle "
1514+
"%buf1_texture_structbuf, i32 1, i32 undef)",
1515+
"structured buffer requires defined index and offset coordinates");
15151516
}
15161517

15171518
TEST_F(ValidationTest, StructBufStoreCoordinates) {
1518-
RewriteAssemblyCheckMsg(L"..\\DXILValidation\\struct_buf1.hlsl", "ps_6_0",
1519-
"bufferStore.f32(i32 69, %dx.types.Handle "
1520-
"%buf2_UAV_structbuf, i32 0, i32 0",
1521-
"bufferStore.f32(i32 69, %dx.types.Handle "
1522-
"%buf2_UAV_structbuf, i32 0, i32 undef",
1523-
"structured buffer requires defined index and offset coordinates");
1519+
RewriteAssemblyCheckMsg(
1520+
L"..\\DXILValidation\\struct_buf1.hlsl", "ps_6_0",
1521+
"bufferStore.f32(i32 69, %dx.types.Handle "
1522+
"%buf2_UAV_structbuf, i32 0, i32 0",
1523+
"bufferStore.f32(i32 69, %dx.types.Handle "
1524+
"%buf2_UAV_structbuf, i32 0, i32 undef",
1525+
"structured buffer requires defined index and offset coordinates");
15241526
}
15251527

15261528
TEST_F(ValidationTest, TypedBufRetType) {

0 commit comments

Comments
 (0)