KhronosGroup / Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
Apache License 2.0
414 stars 172 forks source link

demos: Sort most vkinfo output alphanumerically #2617

Closed shannon-lunarg closed 6 years ago

shannon-lunarg commented 6 years ago

Changes consist of reordering print statements for all paths of output (human_readable, html, and json) and the addition of employing the qsort function (and new comparison functions) to reorder global layers and extension properties in the app instance.

Please let me know if you think I've sorted sections of output that maybe shouldn't be sorted.

Sections left unsorted because the current ordering seems to make the most sense: Presentable Surfaces, VkQueueFamilyProperties, and Format Properties

Change-Id: I075a6897c3070f70d7073c22e7100c49c19073a3

mikes-lunarg commented 6 years ago

I'm just curious what the motivation is here. It seems unintuitive to present struct members in a different order than they appear in the spec.

shannon-lunarg commented 6 years ago

Ah. I should mention this is in reference to LVL issue #2483.

@mikes-lunarg Some of the reordering of the larger structs, e.g., VkPhysicalDeviceLimits, was inspired by the alphanumerical ordering on gpuinfo.com but I could certainly keep it in struct-order if that makes more sense.

jeremyk-lunarg commented 6 years ago

The issue states:

Candidates for alphanumeric soft include:

  • List of instance extensions
  • List of device extensions

Things that need not be sorted alphanumerically include:

  • Dump of the values of fields of a struct. Printing them in the order in which they appear in the struct definition is both sensible and deterministic.
  • Dump of the bits that are set in a bitfield. Printing them in bit-position order is both sensible and deterministic.

Looks like some of these order changes violate the second part of this statement.

mikes-lunarg commented 6 years ago

Totally makes sense for the extension lists to be sorted.

I'm still not convinced on struct fields, the issue even specifically calls them out to be printed in struct order. I would argue that there are also places where sorting fields is worse, like splitting up min/max pairs or this:

features.sparseResidency16Samples
features.sparseResidency2Samples
features.sparseResidency4Samples
features.sparseResidency8Samples
shannon-lunarg commented 6 years ago

@jeremyk-lunarg @mikes-lunarg There was already conflicting ordering (that I introduced many commits ago) so I think I just made an unpopular decision to conform to that. I have since reordered to conform to the struct ordering and pushed changes to my branch.

NOTE: I used three online tools to validate new json output and one online tool to validate html output for good measure.

shannon-lunarg commented 6 years ago

Pushed to master.