# vkWriteAccelerationStructuresPropertiesKHR(3) Manual Page

## Name

vkWriteAccelerationStructuresPropertiesKHR - Query acceleration structure meta-data on the host

## C Specification

    VkResult vkWriteAccelerationStructuresPropertiesKHR(
        VkDevice                                    device,
        uint32_t                                    accelerationStructureCount,
        const VkAccelerationStructureKHR*           pAccelerationStructures,
        VkQueryType                                 queryType,
        size_t                                      dataSize,
        void*                                       pData,
        size_t                                      stride);

## Parameters

This command fulfills the same task as vkCmdWriteAccelerationStructuresPropertiesKHR but executed by the host.

## Description

- `device` is the device which owns the acceleration structures in `pAccelerationStructures`.

- `accelerationStructureCount` is the count of acceleration structures for which to query the property.

- `pAccelerationStructures` points to an array of existing previously built acceleration structures.

- `queryType` is a VkQueryType value specifying the property to be queried.

- `dataSize` is the size in bytes of the buffer pointed to by `pData`.

- `pData` is a pointer to a user-allocated buffer where the results will be written.

- `stride` is the stride in bytes between results for individual queries within `pData`.

Valid Usage

- If `queryType` is `VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR`, then `stride` must be a multiple of the size of `VkDeviceSize`

- If `queryType` is `VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR`, then `data` must point to a `VkDeviceSize`

- If `queryType` is `VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR`, then `stride` must be a multiple of the size of `VkDeviceSize`

- If `queryType` is `VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR`, then `data` must point to a `VkDeviceSize`

- `dataSize` must be greater than or equal to `accelerationStructureCount`*`stride`

- The acceleration structures referenced by `pAccelerationStructures` must be bound to host-visible memory

- [[VUID-{refpage}-accelerationStructures-03431]] All acceleration structures in `accelerationStructures` must have been built with `VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR` if `queryType` is `VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR`

- [[VUID-{refpage}-queryType-03432]] `queryType` must be `VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR` or `VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR`

- the `VkPhysicalDeviceRayTracingFeaturesKHR`→`rayTracingHostAccelerationStructureCommands` feature must be enabled

Valid Usage (Implicit)

- `device` must be a valid VkDevice handle

- `pAccelerationStructures` must be a valid pointer to an array of `accelerationStructureCount` valid VkAccelerationStructureKHR handles

- `queryType` must be a valid VkQueryType value

- `pData` must be a valid pointer to an array of `dataSize` bytes

- `accelerationStructureCount` must be greater than `0`

- `dataSize` must be greater than `0`

- Each element of `pAccelerationStructures` must have been created, allocated, or retrieved from `device`

Return Codes

On success, this command returns

  - `VK_SUCCESS`

On failure, this command returns

  - `VK_ERROR_OUT_OF_HOST_MEMORY`

  - `VK_ERROR_OUT_OF_DEVICE_MEMORY`

## See Also

VkAccelerationStructureKHR, VkDevice, VkQueryType

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.