Skip to content

Commit

Permalink
WinPIX: File-check test for new DXR invocations log pass (microsoft#5322
Browse files Browse the repository at this point in the history
)

A test for the DXR invocations log pass
  • Loading branch information
jeffnn authored Jun 25, 2023
1 parent d278bbe commit c9b50a5
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions tools/clang/test/HLSLFileCheck/pix/InvocationsLog_ClosestHit.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// RUN: %dxc -T lib_6_3 %s | %opt -S -hlsl-dxil-pix-dxr-invocations-log,maxNumEntriesInLog=24 | %FileCheck %s


// Check that handles for the two UAVs were created:
// CHECK: load %struct.RWByteAddressBuffer, %struct.RWByteAddressBuffer* @PIXUAV
// CHECK: createHandleForLib
// CHECK: load %struct.RWByteAddressBuffer, %struct.RWByteAddressBuffer* @PIXUAV
// CHECK: createHandleForLib

// Check that an increment was added (to the counter UAV):
// CHECK: dx.op.atomicBinOp.i32
// CHECK: i32 1

// Now check that at least three functions were modified (the hit group shaders):

// -------- one ----------
// Check for out-of-bounds clamp:
// CHECK: mul i32
// CHECK: 52

// Check for writes to the data UAV:
// CHECK: dx.op.bufferStore.i32
// CHECK: dx.op.bufferStore.f32
// CHECK: dx.op.bufferStore.f32
// CHECK: dx.op.bufferStore.i32
// Check that an increment was added (to the counter UAV):
// CHECK: dx.op.atomicBinOp.i32
// CHECK: i32 1

// -------- two ----------
// Check for out-of-bounds clamp:
// CHECK: mul i32
// CHECK: 52

// Check for writes to the data UAV:
// CHECK: dx.op.bufferStore.i32
// CHECK: dx.op.bufferStore.f32
// CHECK: dx.op.bufferStore.f32
// CHECK: dx.op.bufferStore.i32

// -------- three ----------
// Check that an increment was added (to the counter UAV):
// CHECK: dx.op.atomicBinOp.i32
// CHECK: i32 1

// Check for out-of-bounds clamp:
// CHECK: mul i32
// CHECK: 52

// Check for writes to the data UAV:
// CHECK: dx.op.bufferStore.i32
// CHECK: dx.op.bufferStore.f32
// CHECK: dx.op.bufferStore.f32
// CHECK: dx.op.bufferStore.i32

RWTexture2D<float4> RenderTarget : register(u0);
RWTexture3D<float4> TerrainTextures[2] : register(u1);

struct MyPayload {
float4 color;
};

typedef BuiltInTriangleIntersectionAttributes MyAttributes;

[shader("closesthit")]
void MyClosestHit(inout MyPayload payload, in BuiltInTriangleIntersectionAttributes attr)
{
}

[shader("anyhit")]
void MyAnyHit(inout MyPayload payload, in BuiltInTriangleIntersectionAttributes attr)
{
}

[shader("miss")]
void MyMiss(inout MyPayload payload)
{
}

0 comments on commit c9b50a5

Please sign in to comment.