This extension adds the ability to add an opacity micromap to geometry when building an acceleration structure. The opacity micromap compactly encodes opacity information which can be read by the implementation to mark parts of triangles as opaque or transparent. The format is externally visible to allow the application to compress its internal geometry and surface representations into the compressed format ahead of time. The compressed format subdivides each triangle into a set of subtriangles, each of which can be assigned either two or four opacity values. These opacity values can control if a ray hitting that subtriangle is treated as an opaque hit, complete miss, or possible hit, depending on the controls described in Ray Opacity Micromap.
This extension provides:
VkMicromapEXT structure to store the micromap,VkAccelerationStructureGeometryTrianglesDataKHR to attach a micromap to the geometry of the acceleration structure.
uint32_t BarycentricsToSpaceFillingCurveIndex(float u, float v, uint32_t level)
{
u = clamp(u, 0.0f, 1.0f);
v = clamp(v, 0.0f, 1.0f);
uint32_t iu, iv, iw;
// Quantize barycentric coordinates
float fu = u * (1u << level);
float fv = v * (1u << level);
iu = (uint32_t)fu;
iv = (uint32_t)fv;
float uf = fu - float(iu);
float vf = fv - float(iv);
if (iu >= (1u << level)) iu = (1u << level) - 1u;
if (iv >= (1u << level)) iv = (1u << level) - 1u;
uint32_t iuv = iu + iv;
if (iuv >= (1u << level))
iu -= iuv - (1u << level) + 1u;
iw = ~(iu + iv);
if (uf + vf >= 1.0f && iuv < (1u << level) - 1u) --iw;
uint32_t b0 = ~(iu ^ iw);
b0 &= ((1u << level) - 1u);
uint32_t t = (iu ^ iv) & b0;
uint32_t f = t;
f ^= f >> 1u;
f ^= f >> 2u;
f ^= f >> 4u;
f ^= f >> 8u;
uint32_t b1 = ((f ^ iu) & ~b0) | t;
// Interleave bits
b0 = (b0 | (b0 << 8u)) & 0x00ff00ffu;
b0 = (b0 | (b0 << 4u)) & 0x0f0f0f0fu;
b0 = (b0 | (b0 << 2u)) & 0x33333333u;
b0 = (b0 | (b0 << 1u)) & 0x55555555u;
b1 = (b1 | (b1 << 8u)) & 0x00ff00ffu;
b1 = (b1 | (b1 << 4u)) & 0x0f0f0f0fu;
b1 = (b1 | (b1 << 2u)) & 0x33333333u;
b1 = (b1 | (b1 << 1u)) & 0x55555555u;
return b0 | (b1 << 1u);
}
VK_EXT_opacity_micromapVK_KHR_acceleration_structure and VK_KHR_synchronization2SPV_EXT_opacity_micromapGLSL_EXT_opacity_micromap| Modifier and Type | Field and Description |
|---|---|
| public static final long | VK_ACCESS_2_MICROMAP_READ_BIT_EXT
Extends |
| public static final long | VK_ACCESS_2_MICROMAP_WRITE_BIT_EXT
Extends |
| public static final int | VK_BUFFER_USAGE_MICROMAP_BUILD_INPUT_READ_ONLY_BIT_EXT
Extends |
| public static final int | VK_BUFFER_USAGE_MICROMAP_STORAGE_BIT_EXT
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISABLE_OPACITY_MICROMAPS_EXT
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_DATA_UPDATE_EXT
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_UPDATE_EXT
Extends |
| public static final int | VK_BUILD_MICROMAP_ALLOW_COMPACTION_BIT_EXT
VkBuildMicromapFlagBitsEXT - Bitmask specifying additional parameters for micromap builds Description
|
| public static final int | VK_BUILD_MICROMAP_MODE_BUILD_EXT
VkBuildMicromapModeEXT - Enum specifying the type of build operation to perform Description
|
| public static final int | VK_BUILD_MICROMAP_PREFER_FAST_BUILD_BIT_EXT
VkBuildMicromapFlagBitsEXT - Bitmask specifying additional parameters for micromap builds Description
|
| public static final int | VK_BUILD_MICROMAP_PREFER_FAST_TRACE_BIT_EXT
VkBuildMicromapFlagBitsEXT - Bitmask specifying additional parameters for micromap builds Description
|
| public static final int | VK_COPY_MICROMAP_MODE_CLONE_EXT
VkCopyMicromapModeEXT - Micromap copy mode Description
|
| public static final int | VK_COPY_MICROMAP_MODE_COMPACT_EXT
VkCopyMicromapModeEXT - Micromap copy mode Description
|
| public static final int | VK_COPY_MICROMAP_MODE_DESERIALIZE_EXT
VkCopyMicromapModeEXT - Micromap copy mode Description
|
| public static final int | VK_COPY_MICROMAP_MODE_SERIALIZE_EXT
VkCopyMicromapModeEXT - Micromap copy mode Description
|
| public static final String | VK_EXT_OPACITY_MICROMAP_EXTENSION_NAME
The extension name. |
| public static final int | VK_EXT_OPACITY_MICROMAP_SPEC_VERSION
The extension specification version. |
| public static final int | VK_GEOMETRY_INSTANCE_DISABLE_OPACITY_MICROMAPS_EXT
Extends |
| public static final int | VK_GEOMETRY_INSTANCE_FORCE_OPACITY_MICROMAP_2_STATE_EXT
Extends |
| public static final int | VK_MICROMAP_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT
VkMicromapCreateFlagBitsEXT - Bitmask specifying additional creation parameters for micromap Description
|
| public static final int | VK_MICROMAP_TYPE_OPACITY_MICROMAP_EXT
VkMicromapTypeEXT - Type of micromap Description
|
| public static final int | VK_OBJECT_TYPE_MICROMAP_EXT
Extends |
| public static final int | VK_OPACITY_MICROMAP_FORMAT_2_STATE_EXT
VkOpacityMicromapFormatEXT - Format enum for opacity micromaps Description
|
| public static final int | VK_OPACITY_MICROMAP_FORMAT_4_STATE_EXT
VkOpacityMicromapFormatEXT - Format enum for opacity micromaps Description
|
| public static final int | VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_OPAQUE_EXT
VkOpacityMicromapSpecialIndexEXT - Enum for special indices in the opacity micromap Description
|
| public static final int | VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_TRANSPARENT_EXT
VkOpacityMicromapSpecialIndexEXT - Enum for special indices in the opacity micromap Description
|
| public static final int | VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_OPAQUE_EXT
VkOpacityMicromapSpecialIndexEXT - Enum for special indices in the opacity micromap Description
|
| public static final int | VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_TRANSPARENT_EXT
VkOpacityMicromapSpecialIndexEXT - Enum for special indices in the opacity micromap Description
|
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_OPACITY_MICROMAP_BIT_EXT
Extends |
| public static final long | VK_PIPELINE_STAGE_2_MICROMAP_BUILD_BIT_EXT
Extends |
| public static final int | VK_QUERY_TYPE_MICROMAP_COMPACTED_SIZE_EXT
Extends |
| public static final int | VK_QUERY_TYPE_MICROMAP_SERIALIZATION_SIZE_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_COPY_MEMORY_TO_MICROMAP_INFO_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_COPY_MICROMAP_INFO_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_COPY_MICROMAP_TO_MEMORY_INFO_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_MICROMAP_BUILD_INFO_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_MICROMAP_BUILD_SIZES_INFO_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_MICROMAP_CREATE_INFO_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_MICROMAP_VERSION_INFO_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT
Extends |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT
Extends |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static int | nvkBuildMicromapsEXT(VkDevice device, long deferredOperation, int
the number of micromaps to build. It specifies the number of the infoCount, long pInfos)pInfos that must be provided.Unsafe version of: |
| public static void | nvkCmdBuildMicromapsEXT(VkCommandBuffer commandBuffer, int
the number of micromaps to build. It specifies the number of the infoCount, long pInfos)pInfos structures that must be provided.Unsafe version of: |
| public static void | nvkCmdCopyMemoryToMicromapEXT(VkCommandBuffer commandBuffer, long pInfo)
Unsafe version of: |
| public static void | nvkCmdCopyMicromapEXT(VkCommandBuffer commandBuffer, long pInfo)
Unsafe version of: |
| public static void | nvkCmdCopyMicromapToMemoryEXT(VkCommandBuffer commandBuffer, long pInfo)
Unsafe version of: |
| public static void | nvkCmdWriteMicromapsPropertiesEXT(VkCommandBuffer commandBuffer, int
the count of micromaps for which to query the property. micromapCount, long pMicromaps, int queryType, long queryPool, int firstQuery)Unsafe version of: |
| public static int | nvkCopyMemoryToMicromapEXT(VkDevice device, long deferredOperation, long pInfo)
Unsafe version of: |
| public static int | nvkCopyMicromapEXT(VkDevice device, long deferredOperation, long pInfo)
Unsafe version of: |
| public static int | nvkCopyMicromapToMemoryEXT(VkDevice device, long deferredOperation, long pInfo)
Unsafe version of: |
| public static int | nvkCreateMicromapEXT(VkDevice device, long pCreateInfo, long pAllocator, long pMicromap)
Unsafe version of: |
| public static void | nvkDestroyMicromapEXT(VkDevice device, long micromap, long pAllocator)
Unsafe version of: |
| public static void | nvkGetDeviceMicromapCompatibilityEXT(VkDevice device, long pVersionInfo, long pCompatibility)
Unsafe version of: |
| public static void | nvkGetMicromapBuildSizesEXT(VkDevice device, int buildType, long pBuildInfo, long pSizeInfo)
Unsafe version of: |
| public static int | nvkWriteMicromapsPropertiesEXT(VkDevice device, int
the count of micromaps for which to query the property. micromapCount, long pMicromaps, int queryType, long the size in bytes of the buffer pointed to by dataSize, long pData, long stride)pData.Unsafe version of: |
| public static int | vkBuildMicromapsEXT(VkDevice
the device, long VkDevice for which the micromaps are being built.an optional deferredOperation, VkMicromapBuildInfoEXT.VkDeferredOperationKHR to request deferral for this command.a pointer to an array of pInfosinfoCount VkMicromapBuildInfoEXT structures defining the geometry used to build each micromap.Build a micromap on the host. |
| public static void | vkCmdBuildMicromapsEXT(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, VkMicromapBuildInfoEXT.a pointer to an array of pInfosinfoCount VkMicromapBuildInfoEXT structures defining the data used to build each micromap.Build a micromap. |
| public static void | vkCmdCopyMemoryToMicromapEXT(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, VkCopyMemoryToMicromapInfoEXT a pointer to a pInfo)VkCopyMicromapToMemoryInfoEXT structure defining the copy operation.Copy device memory to a micromap. |
| public static void | vkCmdCopyMicromapEXT(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, VkCopyMicromapInfoEXT a pointer to a pInfo)VkCopyMicromapInfoEXT structure defining the copy operation.Copy a micromap. |
| public static void | vkCmdCopyMicromapToMemoryEXT(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, VkCopyMicromapToMemoryInfoEXT an a pointer to a pInfo)VkCopyMicromapToMemoryInfoEXT structure defining the copy operation.Copy a micromap to device memory. |
| public static void | vkCmdWriteMicromapsPropertiesEXT(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, LongBuffer a pointer to an array of existing previously built micromaps. pMicromaps, int a queryType, long VkQueryType value specifying the type of queries managed by the pool.the query pool that will manage the results of the query. queryPool, int the first query index within the query pool that will contain the firstQuery)micromapCount number of results.Write micromap result parameters to query results. |
| public static void | vkCmdWriteMicromapsPropertiesEXT(VkCommandBuffer commandBuffer, long[] pMicromaps, int queryType, long queryPool, int firstQuery)
Array version of: |
| public static int | vkCopyMemoryToMicromapEXT(VkDevice
the device which owns device, long pInfo→dst.an optional deferredOperation, VkCopyMemoryToMicromapInfoEXT VkDeferredOperationKHR to request deferral for this command.a pointer to a pInfo)VkCopyMemoryToMicromapInfoEXT structure defining the copy operation.Deserialize a micromap on the host. |
| public static int | vkCopyMicromapEXT(VkDevice
the device which owns the micromaps. device, long an optional deferredOperation, VkCopyMicromapInfoEXT VkDeferredOperationKHR to request deferral for this command.a pointer to a pInfo)VkCopyMicromapInfoEXT structure defining the copy operation.Copy a micromap on the host. |
| public static int | vkCopyMicromapToMemoryEXT(VkDevice
the device which owns device, long pInfo→src.an optional deferredOperation, VkCopyMicromapToMemoryInfoEXT VkDeferredOperationKHR to request deferral for this command.a pointer to a pInfo)VkCopyMicromapToMemoryInfoEXT structure defining the copy operation.Serialize a micromap on the host. |
| public static int | vkCreateMicromapEXT(VkDevice
the logical device that creates the acceleration structure object. device, VkMicromapCreateInfoEXT a pointer to a pCreateInfo, VkAllocationCallbacks VkMicromapCreateInfoEXT structure containing parameters affecting creation of the micromap.controls host memory allocation as described in the Memory Allocation chapter. pAllocator, LongBuffer a pointer to a pMicromap)VkMicromapEXT handle in which the resulting micromap object is returned.Create a new micromap object. |
| public static int | vkCreateMicromapEXT(VkDevice device, VkMicromapCreateInfoEXT pCreateInfo, VkAllocationCallbacks pAllocator, long[] pMicromap)
Array version of: |
| public static void | vkDestroyMicromapEXT(VkDevice
the logical device that destroys the micromap. device, long the micromap to destroy. micromap, VkAllocationCallbacks controls host memory allocation as described in the Memory Allocation chapter. pAllocator)Destroy a micromap object. |
| public static void | vkGetDeviceMicromapCompatibilityEXT(VkDevice
the device to check the version against. device, VkMicromapVersionInfoEXT a pointer to a pVersionInfo, IntBuffer VkMicromapVersionInfoEXT structure specifying version information to check against the device.a pointer to a pCompatibility)VkAccelerationStructureCompatibilityKHR value in which compatibility information is returned.Check if a serialized micromap is compatible with the current device. |
| public static void | vkGetDeviceMicromapCompatibilityEXT(VkDevice device, VkMicromapVersionInfoEXT pVersionInfo, int[] pCompatibility)
Array version of: |
| public static void | vkGetMicromapBuildSizesEXT(VkDevice
the logical device that will be used for creating the micromap. device, int defines whether host or device operations (or both) are being queried for. buildType, VkMicromapBuildInfoEXT a pointer to a pBuildInfo, VkMicromapBuildSizesInfoEXT VkMicromapBuildInfoEXT structure describing parameters of a build operation.a pointer to a pSizeInfo)VkMicromapBuildSizesInfoEXT structure which returns the size required for a micromap and the sizes required for the scratch buffers, given the build parameters.Retrieve the required size for a micromap. |
| public static int | vkWriteMicromapsPropertiesEXT(VkDevice
the device which owns the micromaps in device, LongBuffer pMicromaps.a pointer to an array of existing previously built micromaps. pMicromaps, int a queryType, ByteBuffer VkQueryType value specifying the property to be queried.a pointer to a user-allocated buffer where the results will be written. pData, long the stride in bytes between results for individual queries within stride)pData.Query micromap meta-data on the host. |
| public static int | vkWriteMicromapsPropertiesEXT(VkDevice device, long[] pMicromaps, int queryType, ByteBuffer pData, long stride)
Array version of: |