Skip to content

Commit

Permalink
PIX: Preserve shader-access-tracking flag for descriptor-heap-indexed…
Browse files Browse the repository at this point in the history
… resources (#5053) (#5056)

(cherry picked from commit c89ac13)
  • Loading branch information
jeffnn authored Feb 24, 2023
1 parent 37e8fae commit e8c4673
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 0 additions & 4 deletions lib/DxilPIXPasses/DxilShaderAccessTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,6 @@ bool DxilShaderAccessTracking::EmitResourceAccess(DxilModule &DM,
auto* MultipliedOutOfBoundsValue = Builder.CreateMul(OneIfOutOfBounds, HlslOP->GetU32Const(EncodedInstructionNumber));
auto* CombinedFlagOrInstructionValue = Builder.CreateAdd(MultipliedEncodedFlags, MultipliedOutOfBoundsValue);

// If we failed to find an instruction value, just return the access flags:
if (InstructionNumber == 0) {
CombinedFlagOrInstructionValue = EncodedFlags;
}
Constant *ElementMask = HlslOP->GetI8Const(1);
Function *StoreFunc = HlslOP->GetOpFunc(OP::OpCode::BufferStore,
Type::getInt32Ty(Ctx));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void Main()
// The start of resource records has been passed in as 256. The limit of resource records is 272. 272-256 = 16.
// 8 bytes per record means we have one record for out-of-bounds (that comes first), and one record for resource index 0.
// The above HLSL references resource descriptor 1, so is out-of-bounds. Offset for out-of-bounds should thus be 256:
// The large integer is encoded flags for the ResourceAccessStyle (an enumerated type in lib\DxilPIXPasses\DxilShaderAccessTracking.cpp) for this access
// CHECK:i32 256, i32 undef, i32 1375731712
// The large integer is encoded flags for the ResourceAccessStyle (an enumerated type in lib\DxilPIXPasses\DxilShaderAccessTracking.cpp)
// for this access plus 0x80000000 to indicate descriptor-heap indexing.
// CHECK:i32 256, i32 undef, i32 1476395008
// CHECK:rawBufferLoad
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ float4 Main() : SV_Target

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

0 comments on commit e8c4673

Please sign in to comment.