Skip to content

Commit e8c4673

Browse files
authored
PIX: Preserve shader-access-tracking flag for descriptor-heap-indexed resources (#5053) (#5056)
(cherry picked from commit c89ac13)
1 parent 37e8fae commit e8c4673

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

lib/DxilPIXPasses/DxilShaderAccessTracking.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,6 @@ bool DxilShaderAccessTracking::EmitResourceAccess(DxilModule &DM,
552552
auto* MultipliedOutOfBoundsValue = Builder.CreateMul(OneIfOutOfBounds, HlslOP->GetU32Const(EncodedInstructionNumber));
553553
auto* CombinedFlagOrInstructionValue = Builder.CreateAdd(MultipliedEncodedFlags, MultipliedOutOfBoundsValue);
554554

555-
// If we failed to find an instruction value, just return the access flags:
556-
if (InstructionNumber == 0) {
557-
CombinedFlagOrInstructionValue = EncodedFlags;
558-
}
559555
Constant *ElementMask = HlslOP->GetI8Const(1);
560556
Function *StoreFunc = HlslOP->GetOpFunc(OP::OpCode::BufferStore,
561557
Type::getInt32Ty(Ctx));

tools/clang/test/HLSLFileCheck/pix/DynamicResourceOutOfBounds.hlsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ void Main()
1414
// The start of resource records has been passed in as 256. The limit of resource records is 272. 272-256 = 16.
1515
// 8 bytes per record means we have one record for out-of-bounds (that comes first), and one record for resource index 0.
1616
// The above HLSL references resource descriptor 1, so is out-of-bounds. Offset for out-of-bounds should thus be 256:
17-
// The large integer is encoded flags for the ResourceAccessStyle (an enumerated type in lib\DxilPIXPasses\DxilShaderAccessTracking.cpp) for this access
18-
// CHECK:i32 256, i32 undef, i32 1375731712
17+
// The large integer is encoded flags for the ResourceAccessStyle (an enumerated type in lib\DxilPIXPasses\DxilShaderAccessTracking.cpp)
18+
// for this access plus 0x80000000 to indicate descriptor-heap indexing.
19+
// CHECK:i32 256, i32 undef, i32 1476395008
1920
// CHECK:rawBufferLoad

tools/clang/test/HLSLFileCheck/pix/DynamicSamplerOutOfBounds.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ float4 Main() : SV_Target
2121

2222
// Out of bounds sampler access should be at offset 512
2323
// CHECK: call void @dx.op.bufferStore.i32(
24-
// CHECK:i32 512, i32 undef, i32 16777216
24+
// CHECK:i32 512, i32 undef, i32 134217728

0 commit comments

Comments
 (0)