LunarG / gfxreconstruct

Graphics API Capture and Replay Tools for Reconstructing Graphics Application Behavior
https://vulkan.lunarg.com/doc/sdk/latest/linux/capture_tools.html
MIT License
414 stars 122 forks source link

Inconsistency In Pointer Array Bit #1032

Open andrew-lunarg opened 1 year ago

andrew-lunarg commented 1 year ago

This is shown up by Export but I believe Export is correctly following the pointer attribute bits that it is passed. The problem (if there is one) is in decode or all the way back in encode at capture. The statements about bits below were confirmed by debugging a trace going through Export.

{
  "index": 56,
  "function": {
    "name": "vkQueueSubmit",
    "thread": 1,
    "submit_index": 1,
    "return": "VK_SUCCESS",
    "args": {
      "queue": 15,
      "submitCount": 1,
      // The following function argument does not have its array bit set and so is rendered as a non-array pointer even though there can be any number of submit structs passed.
      "pSubmits": {
        "sType": "VK_STRUCTURE_TYPE_SUBMIT_INFO",
        "waitSemaphoreCount": 0,
        "pWaitSemaphores": null,
        "pWaitDstStageMask": null,
        "commandBufferCount": 0,
        "pCommandBuffers": null,
        "signalSemaphoreCount": 1,
        // There is only one semaphore handle passed in the following pointer but its array bit is set and so it is rendered as an array with a single element.
        "pSignalSemaphores": [
          987334
        ],
        "pNext": null
      },
      "fence": 0
    }
  }
}

If the array bit is set for one, it should be set for the other.

For Export / Convert's use case, I think it makes sense to have set the array bit even for zero length or single element arrays so that downstream processing scripts only have one case to handle, not if None, then ..l if(is_object), then ...; if(is_array) then.... For other tools, maybe it makes sense to not set the bit when the pointer happens to not point at more than one element🤷.

bradgrantham-lunarg commented 1 year ago

My preference would be for consistency, so that zero-element and single-element arrays are still dumped as arrays.