Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump root parameters, insted of descriptor heap #1862

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

locke-lunarg
Copy link
Contributor

@locke-lunarg locke-lunarg commented Nov 1, 2024

Ex:
new

    "graphics_root_parameters": [
      {
        "root_parameter_index": 2,
        "root_signature_type": "D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE",
        "cmd_bind_type": "D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE",
        "tables": [
          {
            "range_type": "D3D12_DESCRIPTOR_RANGE_TYPE_CBV",
            "num_descriptors": 14,
            "descs": [
              {
                "buffer_location": 13749356032,
                "heap_id": 65,
                "heap_index": 719156,
                "res_id": 6230,
                "dimension": "D3D12_RESOURCE_DIMENSION_BUFFER",
                "subs": [
                  {
                    "index": 0,
                    "offset": 165376,
                    "size": 256,
                    "before_file": "shadowtombraider-no-dxr_dr_cbv_res_id_6230_sub_0_before.bin",
                    "after_file": "shadowtombraider-no-dxr_dr_cbv_res_id_6230_sub_0_after.bin"
                  }

old

    "descriptor_heap": {
      "heap_id_80": {
        "constant_buffer_views": [
          {
            "res_id": 6368,
            "sub": [
              {
                "index": 0,
                "offset": 508416,
                "size": 256,
                "before_file": "shadowtombraider-no-dxr_draw_3803_0_0_0_dr_cbv_res_id_6368_sub_0_before.bin",
                "after_file": "shadowtombraider-no-dxr_draw_3803_0_0_0_dr_cbv_res_id_6368_sub_0_after.bin"
  1. Dump SetXXXRootDescriptorTable, SetXXXRootConstantBufferView, SetXXXRootShaderResourceView and SetXXXRootUnorderedAccessView from ID3D12GraphicsCommandList , instead of descriptor heaps. Root parameters are more straightforward since they are used by shaders.

  2. Find RootParameters info in dx12_browse_consumer.h and Dx12DumpResources::CreateRootSignature.

  3. Dump some infos about root parameters. Although root_signature_type and cmd_bind_type are the same thing, but they come from different places. I saw some titles that they were different, so I chose to write both. That's a mistake and should trigger validation log. Added a function Dx12DumpResourcesDelegate::WriteNote to write some help info into .json, like error log.

  4. Added two flags in dx12_dump_resources.cpp: TEST_WRITE_NOT_FOUND_VIEWS and TEST_WRITE_NULL_RESOURCE_VIEWS.

The NumDescriptors in root parameters could be large, but the index might not be found in cbv_srv_uav_infos of D3D12DescriptorHeapInfo. Set TEST_WRITE_NOT_FOUND_VIEWS: true to write the heap info even if the index isn't found. Set false to skip it.

BufferLocation in CreateConstantBufferView or pResource in CreateShaderResourceView or CreateUnorderedAccessView could be 0. Set TEST_WRITE_NULL_RESOURCE_VIEWS: true to write the heap info even if the value is 0. Set false to skip it.

  1. CreateConstantBufferView, CreateShaderResourceView and CreateUnorderedAccessView could set the same DestDescriptor. The newer view setting could override the older to get the DestDescriptor. In this case, changed these struct infos into one struct info.

  2. If the target draw call is dispatch, dump compute root parameters. If it's not, dump graphics. But if it's ExecuteIndirect, dump both graphics and compute root parameters, since we don't know what it's inside.

  3. CaptureGPUAddrMatchDescriptorHeap find the heap index for the address of root descriptor tables. Use the index to find the view in the map in the heap.

Not using MatchDescriptorCPUGPUHandle and "for loop" to find the view any longer. MatchDescriptorCPUGPUHandle has a bug to find a wrong view.

RelayCPUAddrMatchDescriptorHeap find the heap index for rtvs and dsv.

  1. Skip dump vertices, index, rtv and dsv if the target draw call is dispatch.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 293105.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5272 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 293145.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5273 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 293168.

@locke-lunarg locke-lunarg marked this pull request as ready for review November 2, 2024 00:00
@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5274 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5274 passed.

framework/decode/dx12_dump_resources.cpp Outdated Show resolved Hide resolved
framework/decode/dx12_dump_resources.cpp Outdated Show resolved Hide resolved
framework/decode/dx12_replay_consumer_base.cpp Outdated Show resolved Hide resolved
framework/decode/dx12_object_info.h Show resolved Hide resolved
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 305224.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5346 running.

1. Dump SetXXXRootDescriptorTable, SetXXXRootConstantBufferView, SetXXXRootShaderResourceView, SetXXXRootUnorderedAccessView, instead of descriptor heap. Root parameters are more straightforward since they are used by shaders.

2. Find RootParameters info in dx12_browse_consumer.h and Dx12DumpResources::CreateRootSignature, and then dump them.

3. Dump some infos about root parameters. Although root_signature_type and cmd_bind_type are the same thing, but I saw some titles that they were different, so I chose to write both. That's mistakes and should trigger validation log. Added a function Dx12DumpResourcesDelegate::WriteNote to write some help info into .json, like some mistakes are found.

4. Added two flags in dx12_dump_resources.cpp: TEST_WRITE_NOT_FOUND_VIEWS,TEST_WRITE_NULL_RESOURCE_VIEWS.

The NumDescriptors in RootParameters could be large, but the index might not be found in cbv_srv_uav_infos of D3D12DescriptorHeapInfo. Set TEST_WRITE_NOT_FOUND_VIEWS: true to write the heap index info even if the index isn't found. Set false to skip it.

BufferLocation in CreateConstantBufferView or pResource in CreateShaderResourceView or CreateUnorderedAccessView could be 0. Set TEST_WRITE_NULL_RESOURCE_VIEWS: true to write the heap index info even if the value is 0. Set false to skip it.

5. CreateConstantBufferView, CreateShaderResourceView and CreateUnorderedAccessView could set the same DestDescriptor. The newer view setting could override it to get the DestDescriptor. The older view setting is quit. In this case, changed these struct infos into one struct info.

6. If the target drawcall is dispatch, dump compute root parameters. If it's not, dump graphics. But if it's ExecuteIndirect, dump both graphics and compute root parameters, since we don't know what it's inside.

7. CaptureGPUAddrMatchDescriptorHeap find the index of the heap for the address of root descriptor tables. Use the index to find the view in the map in the heap.

Not using MatchDescriptorCPUGPUHandle and "for loop" to find the view any more. MatchDescriptorCPUGPUHandle has a bug to find a wrong view.

RelayCPUAddrMatchDescriptorHeap find the index of the heap for the address of rtvs and dsv. Use the index to find the view in the map in the heap.

8. Skip dump vertices, index, rtv and dsv if the taget drawcall is dispatch.
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 305241.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5347 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5347 passed.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 305353.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5348 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5348 passed.

Move GetDescriptorSubresourceIndices to Dx12DumpResources. And fix two "<=" to "<".
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 305653.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5349 running.

@locke-lunarg
Copy link
Contributor Author

I added a small change. The given parameter in GetDescriptorSubresourceIndices changed D3D12_RESOURCE_DESC to DxObjectInfo.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5349 passed.

Add WriteRootParameterInfo, WriteNotFoundView, WriteNULLResource,
WriteNULLBufferLocation in Dx12DumpResourcesDelegate to make writing
infos simpler.

Move checking TEST_WRITE_NULL_RESOURCE_VIEWS into
CopyDrawCallResourceByGPUVA and CopyDrawCallResourceBySubresource.
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 305973.

@locke-lunarg
Copy link
Contributor Author

Added one commit to move writing info code to functions to make it simpler. It doesn't change output data.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5351 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5351 passed.

@locke-lunarg locke-lunarg merged commit 0000a1e into LunarG:dev Nov 20, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants