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

Fix vulkan_struct_deep_copy edge-cases #1738

Merged

Conversation

fabian-lunarg
Copy link
Contributor

@fabian-lunarg fabian-lunarg commented Sep 13, 2024

part 1:

  • do not copy 'external'-object-handles, e.g. in VkSurfaceFullScreenExclusiveWin32InfoEXT
  • do not generate overload for VkPushDescriptorSetWithTemplateInfoKHR

When making deep copies of structures, avoid attempting to copy the values referenced by opaque handles and opaque pointers. These are generally pointers to a single value with the void* type, which cannot be safely copied because the size of the referenced value is unknown. For most cases, the referenced value is unneeded because capture treats the address stored in these handles/pointers as external object IDs that are encoded as 64-bit integer values.

Additionally omits VkPushDescriptorSetWithTemplateInfoKHR from code-gen, as it requires knowledge about the template's layout, which is not available in the routine's scope.

many thanks @dgraves for reporting and already providing this fix!

part 2:

  • correct handling of arrays-of-pointers (generally members starting with pp), only 6 cases total, e.g. in VkInstanceCreateInfo, VkDeviceCreateInfo, VkMicromapBuildInfoEXT
  • minor refactor, add static_asserts

- do not copy 'external'-object-handles
- do not generate overload for VkPushDescriptorSetWithTemplateInfoKHR
- based on fix provided by Dustin Graves

When making deep copies of structures, avoid attempting to copy the
values referenced by opaque handles and opaque pointers. These are
generally pointers to a single value with the void* type, which cannot
be safely copied because the size of the referenced value is unknown.
For most cases, the referenced value is unneeded because capture treats
the address stored in these handles/pointers as external object IDs
that are encoded as 64-bit integer values.

Additionally omit VkPushDescriptorSetWithTemplateInfoKHR from code-gen,
as it requires knowledge about the template's layout,
which is not available in the routine's scope.
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 255418.

@fabian-lunarg fabian-lunarg self-assigned this Sep 13, 2024
@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4823 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4823 passed.

- fixes cases like VkInstanceCreateInfo with array-of-pointer members
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 261979.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4882 running.

@fabian-lunarg fabian-lunarg changed the title Avoid opaque pointer copies in vulkan_struct_deep_copy routine Fix vulkan_struct_deep_copy edge-cases Sep 23, 2024
@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4882 passed.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 262090.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4883 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4883 passed.

@fabian-lunarg fabian-lunarg merged commit fb0417a into LunarG:dev Sep 25, 2024
8 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.

[capture] trimmed capture of VkSurfaceFullScreenExclusiveWin32InfoEXT crashes
3 participants