Top Description Fields Constructors Methods
org.lwjgl.vulkan

public Class EXTOpacityMicromap

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.system.*

When adding adding transparency to a ray traced scene, an application can choose between further tessellating the geometry or using an any hit shader to allow the ray through specific parts of the geometry. These options have the downside of either significantly increasing memory consumption or adding runtime overhead to run shader code in the middle of traversal, respectively.

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:

Reference Code

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_micromap
Name String
VK_EXT_opacity_micromap
Extension Type
Device extension
Registered Extension Number
397
Revision
2
Extension and Version Dependencies
VK_KHR_acceleration_structure and VK_KHR_synchronization2
Contact
Extension Proposal
VK_EXT_opacity_micromap
Other Extension Metadata
Last Modified Date
2022-08-24
Interactions and External Dependencies
Contributors
  • Christoph Kubisch, NVIDIA
  • Eric Werness, NVIDIA
  • Josh Barczak, Intel
  • Stu Smith, AMD

Field Summary

Modifier and TypeField and Description
public static final long
VK_ACCESS_2_MICROMAP_READ_BIT_EXT

Extends VkAccessFlagBits2.

public static final long
VK_ACCESS_2_MICROMAP_WRITE_BIT_EXT

Extends VkAccessFlagBits2.

public static final int
public static final int
VK_BUFFER_USAGE_MICROMAP_STORAGE_BIT_EXT

Extends VkBufferUsageFlagBits.

public static final int
VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISABLE_OPACITY_MICROMAPS_EXT

Extends VkBuildAccelerationStructureFlagBitsKHR.

public static final int
VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_DATA_UPDATE_EXT

Extends VkBuildAccelerationStructureFlagBitsKHR.

public static final int
VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_UPDATE_EXT

Extends VkBuildAccelerationStructureFlagBitsKHR.

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
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 VkGeometryInstanceFlagBitsKHR.

public static final int
VK_GEOMETRY_INSTANCE_FORCE_OPACITY_MICROMAP_2_STATE_EXT

Extends VkGeometryInstanceFlagBitsKHR.

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 VkObjectType.

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
public static final long
VK_PIPELINE_STAGE_2_MICROMAP_BUILD_BIT_EXT

Extends VkPipelineStageFlagBits2.

public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static int
nvkBuildMicromapsEXT(VkDevice device, long deferredOperation, int
the number of micromaps to build. It specifies the number of the pInfos that must be provided.
infoCount
,
long pInfos)

Unsafe version of: BuildMicromapsEXT

public static void
nvkCmdBuildMicromapsEXT(VkCommandBuffer commandBuffer, int
the number of micromaps to build. It specifies the number of the pInfos structures that must be provided.
infoCount
,
long pInfos)

Unsafe version of: CmdBuildMicromapsEXT

public static void
nvkCmdCopyMemoryToMicromapEXT(VkCommandBuffer commandBuffer, long pInfo)

Unsafe version of: CmdCopyMemoryToMicromapEXT

public static void
nvkCmdCopyMicromapEXT(VkCommandBuffer commandBuffer, long pInfo)

Unsafe version of: CmdCopyMicromapEXT

public static void
nvkCmdCopyMicromapToMemoryEXT(VkCommandBuffer commandBuffer, long pInfo)

Unsafe version of: CmdCopyMicromapToMemoryEXT

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: CmdWriteMicromapsPropertiesEXT

public static int
nvkCopyMemoryToMicromapEXT(VkDevice device, long deferredOperation, long pInfo)

Unsafe version of: CopyMemoryToMicromapEXT

public static int
nvkCopyMicromapEXT(VkDevice device, long deferredOperation, long pInfo)

Unsafe version of: CopyMicromapEXT

public static int
nvkCopyMicromapToMemoryEXT(VkDevice device, long deferredOperation, long pInfo)

Unsafe version of: CopyMicromapToMemoryEXT

public static int
nvkCreateMicromapEXT(VkDevice device, long pCreateInfo, long pAllocator, long pMicromap)

Unsafe version of: CreateMicromapEXT

public static void
nvkDestroyMicromapEXT(VkDevice device, long micromap, long pAllocator)

Unsafe version of: DestroyMicromapEXT

public static void
nvkGetDeviceMicromapCompatibilityEXT(VkDevice device, long pVersionInfo, long pCompatibility)

Unsafe version of: GetDeviceMicromapCompatibilityEXT

public static void
nvkGetMicromapBuildSizesEXT(VkDevice device, int buildType, long pBuildInfo, long pSizeInfo)

Unsafe version of: GetMicromapBuildSizesEXT

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 pData.
dataSize
,
long pData, long stride)

Unsafe version of: WriteMicromapsPropertiesEXT

public static int
vkBuildMicromapsEXT(VkDevice
the VkDevice for which the micromaps are being built.
device
,
long
an optional VkDeferredOperationKHR to request deferral for this command.
deferredOperation
,
VkMicromapBuildInfoEXT.Buffer
a pointer to an array of infoCount VkMicromapBuildInfoEXT structures defining the geometry used to build each micromap.
pInfos
)

Build a micromap on the host.

public static void
vkCmdBuildMicromapsEXT(VkCommandBuffer
the command buffer into which the command will be recorded.
commandBuffer
,
VkMicromapBuildInfoEXT.Buffer
a pointer to an array of infoCount VkMicromapBuildInfoEXT structures defining the data used to build each micromap.
pInfos
)

Build a micromap.

public static void
vkCmdCopyMemoryToMicromapEXT(VkCommandBuffer
the command buffer into which the command will be recorded.
commandBuffer
,
VkCopyMemoryToMicromapInfoEXT
a pointer to a VkCopyMicromapToMemoryInfoEXT structure defining the copy operation.
pInfo
)

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 VkCopyMicromapInfoEXT structure defining the copy operation.
pInfo
)

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 VkCopyMicromapToMemoryInfoEXT structure defining the copy operation.
pInfo
)

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 VkQueryType value specifying the type of queries managed by the pool.
queryType
,
long
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 micromapCount number of results.
firstQuery
)

Write micromap result parameters to query results.

public static void
vkCmdWriteMicromapsPropertiesEXT(VkCommandBuffer commandBuffer, long[] pMicromaps, int queryType, long queryPool, int firstQuery)

Array version of: CmdWriteMicromapsPropertiesEXT

public static int
vkCopyMemoryToMicromapEXT(VkDevice
the device which owns pInfo→dst.
device
,
long
an optional VkDeferredOperationKHR to request deferral for this command.
deferredOperation
,
VkCopyMemoryToMicromapInfoEXT
a pointer to a VkCopyMemoryToMicromapInfoEXT structure defining the copy operation.
pInfo
)

Deserialize a micromap on the host.

public static int
vkCopyMicromapEXT(VkDevice
the device which owns the micromaps.
device
,
long
an optional VkDeferredOperationKHR to request deferral for this command.
deferredOperation
,
VkCopyMicromapInfoEXT
a pointer to a VkCopyMicromapInfoEXT structure defining the copy operation.
pInfo
)

Copy a micromap on the host.

public static int
vkCopyMicromapToMemoryEXT(VkDevice
the device which owns pInfo→src.
device
,
long
an optional VkDeferredOperationKHR to request deferral for this command.
deferredOperation
,
VkCopyMicromapToMemoryInfoEXT
a pointer to a VkCopyMicromapToMemoryInfoEXT structure defining the copy operation.
pInfo
)

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 VkMicromapCreateInfoEXT structure containing parameters affecting creation of the micromap.
pCreateInfo
,
VkAllocationCallbacks
controls host memory allocation as described in the Memory Allocation chapter.
pAllocator
,
LongBuffer
a pointer to a VkMicromapEXT handle in which the resulting micromap object is returned.
pMicromap
)

Create a new micromap object.

public static int
vkCreateMicromapEXT(VkDevice device, VkMicromapCreateInfoEXT pCreateInfo, VkAllocationCallbacks pAllocator, long[] pMicromap)

Array version of: CreateMicromapEXT

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 VkMicromapVersionInfoEXT structure specifying version information to check against the device.
pVersionInfo
,
IntBuffer
a pointer to a VkAccelerationStructureCompatibilityKHR value in which compatibility information is returned.
pCompatibility
)

Check if a serialized micromap is compatible with the current device.

public static void
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 VkMicromapBuildInfoEXT structure describing parameters of a build operation.
pBuildInfo
,
VkMicromapBuildSizesInfoEXT
a pointer to a VkMicromapBuildSizesInfoEXT structure which returns the size required for a micromap and the sizes required for the scratch buffers, given the build parameters.
pSizeInfo
)

Retrieve the required size for a micromap.

public static int
vkWriteMicromapsPropertiesEXT(VkDevice
the device which owns the micromaps in pMicromaps.
device
,
LongBuffer
a pointer to an array of existing previously built micromaps.
pMicromaps
,
int
a VkQueryType value specifying the property to be queried.
queryType
,
ByteBuffer
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 pData.
stride
)

Query micromap meta-data on the host.

public static int
vkWriteMicromapsPropertiesEXT(VkDevice device, long[] pMicromaps, int queryType, ByteBuffer pData, long stride)

Array version of: WriteMicromapsPropertiesEXT

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait