Package org.lwjgl.vulkan
Class VkAccelerationStructureInstanceKHR
java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<VkAccelerationStructureInstanceKHR>
org.lwjgl.vulkan.VkAccelerationStructureInstanceKHR
- All Implemented Interfaces:
AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
- Direct Known Subclasses:
VkAccelerationStructureInstanceNV
public class VkAccelerationStructureInstanceKHR
extends org.lwjgl.system.Struct<VkAccelerationStructureInstanceKHR>
implements org.lwjgl.system.NativeResource
Structure specifying a single acceleration structure instance for building into an acceleration structure geometry.
Description
The C language specification does not define the ordering of bit-fields, but in practice, this struct produces the correct layout with existing compilers. The intended bit pattern is for the following:
instanceCustomIndexandmaskoccupy the same memory as if a singleuint32_twas specified in their placeinstanceCustomIndexoccupies the 24 least significant bits of that memorymaskoccupies the 8 most significant bits of that memory
instanceShaderBindingTableRecordOffsetandflagsoccupy the same memory as if a singleuint32_twas specified in their placeinstanceShaderBindingTableRecordOffsetoccupies the 24 least significant bits of that memoryflagsoccupies the 8 most significant bits of that memory
If a compiler produces code that diverges from that pattern, applications must employ another method to set values according to the correct bit pattern.
Valid Usage (Implicit)
flagsmust be a valid combination ofVkGeometryInstanceFlagBitsKHRvalues
See Also
VkAccelerationStructureMotionInstanceDataNV, VkTransformMatrixKHR
Layout
struct VkAccelerationStructureInstanceKHR {
VkTransformMatrixKHR transform();
uint32_t instanceCustomIndex() : 24;
uint32_t mask() : 8;
uint32_t instanceShaderBindingTableRecordOffset() : 24;
VkGeometryInstanceFlagsKHR flags() : 8;
uint64_t accelerationStructureReference();
}-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn array ofVkAccelerationStructureInstanceKHRstructs.Nested classes/interfaces inherited from class org.lwjgl.system.Struct
org.lwjgl.system.Struct.StructValidationNested classes/interfaces inherited from interface org.lwjgl.system.Pointer
org.lwjgl.system.Pointer.Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe struct member offsets.static final intThe struct alignment in bytes.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct size in bytes.static final intThe struct member offsets.Fields inherited from interface org.lwjgl.system.Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionVkAccelerationStructureInstanceKHR(ByteBuffer container) Creates aVkAccelerationStructureInstanceKHRinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionlongeither : a device address containing the value obtained fromGetAccelerationStructureDeviceAddressKHRorGetAccelerationStructureHandleNV(used by device operations which reference acceleration structures) or, aVkAccelerationStructureKHRobject (used by host operations which reference acceleration structures).accelerationStructureReference(long value) Sets the specified value to theaccelerationStructureReference()field.calloc()Returns a newVkAccelerationStructureInstanceKHRinstance allocated withmemCalloc.calloc(int capacity) Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated withmemCalloc.calloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.calloc(org.lwjgl.system.MemoryStack stack) Returns a newVkAccelerationStructureInstanceKHRinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.create()Returns a newVkAccelerationStructureInstanceKHRinstance allocated withBufferUtils.create(int capacity) Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated withBufferUtils.create(long address) Returns a newVkAccelerationStructureInstanceKHRinstance for the specified memory address.create(long address, int capacity) Create aVkAccelerationStructureInstanceKHR.Bufferinstance at the specified memory.static @Nullable VkAccelerationStructureInstanceKHRcreateSafe(long address) static @Nullable VkAccelerationStructureInstanceKHR.BuffercreateSafe(long address, int capacity) intflags()an 8-bit mask ofVkGeometryInstanceFlagBitsKHRvalues to apply to this instance.flags(int value) Sets the specified value to theflags()field.inta 24-bit application-specified index value accessible to ray shaders in theInstanceCustomIndexKHRbuilt-in.instanceCustomIndex(int value) Sets the specified value to theinstanceCustomIndex()field.inta 24-bit offset used in calculating the hit shader binding table index.instanceShaderBindingTableRecordOffset(int value) Sets the specified value to theinstanceShaderBindingTableRecordOffset()field.malloc()Returns a newVkAccelerationStructureInstanceKHRinstance allocated withmemAlloc.malloc(int capacity) Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated withmemAlloc.malloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated on the specifiedMemoryStack.malloc(org.lwjgl.system.MemoryStack stack) Returns a newVkAccelerationStructureInstanceKHRinstance allocated on the specifiedMemoryStack.intmask()an 8-bit visibility mask for the geometry.mask(int value) Sets the specified value to themask()field.static longnaccelerationStructureReference(long struct) Unsafe version ofaccelerationStructureReference().static voidnaccelerationStructureReference(long struct, long value) Unsafe version ofaccelerationStructureReference.static intnbitfield0(long struct) static voidnbitfield0(long struct, int value) static intnbitfield1(long struct) static voidnbitfield1(long struct, int value) static intnflags(long struct) Unsafe version offlags().static voidnflags(long struct, int value) Unsafe version offlags.static intninstanceCustomIndex(long struct) Unsafe version ofinstanceCustomIndex().static voidninstanceCustomIndex(long struct, int value) Unsafe version ofinstanceCustomIndex.static intninstanceShaderBindingTableRecordOffset(long struct) Unsafe version ofinstanceShaderBindingTableRecordOffset().static voidninstanceShaderBindingTableRecordOffset(long struct, int value) Unsafe version ofinstanceShaderBindingTableRecordOffset.static intnmask(long struct) Unsafe version ofmask().static voidnmask(long struct, int value) Unsafe version ofmask.static VkTransformMatrixKHRntransform(long struct) Unsafe version oftransform().static voidntransform(long struct, VkTransformMatrixKHR value) Unsafe version oftransform.Copies the specified struct data to this struct.set(VkTransformMatrixKHR transform, int instanceCustomIndex, int mask, int instanceShaderBindingTableRecordOffset, int flags, long accelerationStructureReference) Initializes this struct with the specified values.intsizeof()aVkTransformMatrixKHRstructure describing a transformation to be applied to the acceleration structure.transform(Consumer<VkTransformMatrixKHR> consumer) Passes thetransform()field to the specifiedConsumer.transform(VkTransformMatrixKHR value) Copies the specifiedVkTransformMatrixKHRto thetransform()field.Methods inherited from class org.lwjgl.system.Struct
clear, free, isNull, validate, validateMethods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toStringMethods inherited from interface org.lwjgl.system.NativeResource
close, free
-
Field Details
-
SIZEOF
public static final int SIZEOFThe struct size in bytes. -
ALIGNOF
public static final int ALIGNOFThe struct alignment in bytes. -
TRANSFORM
public static final int TRANSFORMThe struct member offsets. -
BITFIELD0
public static final int BITFIELD0The struct member offsets. -
BITFIELD1
public static final int BITFIELD1The struct member offsets. -
ACCELERATIONSTRUCTUREREFERENCE
public static final int ACCELERATIONSTRUCTUREREFERENCEThe struct member offsets.
-
-
Constructor Details
-
VkAccelerationStructureInstanceKHR
Creates aVkAccelerationStructureInstanceKHRinstance at the current position of the specifiedByteBuffercontainer. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Details
-
sizeof
public int sizeof()- Specified by:
sizeofin classorg.lwjgl.system.Struct<VkAccelerationStructureInstanceKHR>
-
transform
aVkTransformMatrixKHRstructure describing a transformation to be applied to the acceleration structure. -
instanceCustomIndex
public int instanceCustomIndex()a 24-bit application-specified index value accessible to ray shaders in theInstanceCustomIndexKHRbuilt-in. -
mask
public int mask()an 8-bit visibility mask for the geometry. The instance may only be hit ifCull Mask & instance.mask != 0 -
instanceShaderBindingTableRecordOffset
public int instanceShaderBindingTableRecordOffset()a 24-bit offset used in calculating the hit shader binding table index. -
flags
public int flags()an 8-bit mask ofVkGeometryInstanceFlagBitsKHRvalues to apply to this instance. -
accelerationStructureReference
public long accelerationStructureReference()either :- a device address containing the value obtained from
GetAccelerationStructureDeviceAddressKHRorGetAccelerationStructureHandleNV(used by device operations which reference acceleration structures) or, - a
VkAccelerationStructureKHRobject (used by host operations which reference acceleration structures).
- a device address containing the value obtained from
-
transform
Copies the specifiedVkTransformMatrixKHRto thetransform()field. -
transform
Passes thetransform()field to the specifiedConsumer. -
instanceCustomIndex
Sets the specified value to theinstanceCustomIndex()field. -
mask
Sets the specified value to themask()field. -
instanceShaderBindingTableRecordOffset
Sets the specified value to theinstanceShaderBindingTableRecordOffset()field. -
flags
Sets the specified value to theflags()field. -
accelerationStructureReference
Sets the specified value to theaccelerationStructureReference()field. -
set
public VkAccelerationStructureInstanceKHR set(VkTransformMatrixKHR transform, int instanceCustomIndex, int mask, int instanceShaderBindingTableRecordOffset, int flags, long accelerationStructureReference) Initializes this struct with the specified values. -
set
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
Returns a newVkAccelerationStructureInstanceKHRinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newVkAccelerationStructureInstanceKHRinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newVkAccelerationStructureInstanceKHRinstance allocated withBufferUtils. -
create
Returns a newVkAccelerationStructureInstanceKHRinstance for the specified memory address. -
createSafe
-
malloc
Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aVkAccelerationStructureInstanceKHR.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
public static @Nullable VkAccelerationStructureInstanceKHR.Buffer createSafe(long address, int capacity) -
malloc
Returns a newVkAccelerationStructureInstanceKHRinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newVkAccelerationStructureInstanceKHRinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
public static VkAccelerationStructureInstanceKHR.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
public static VkAccelerationStructureInstanceKHR.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkAccelerationStructureInstanceKHR.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
ntransform
Unsafe version oftransform(). -
nbitfield0
public static int nbitfield0(long struct) -
ninstanceCustomIndex
public static int ninstanceCustomIndex(long struct) Unsafe version ofinstanceCustomIndex(). -
nmask
public static int nmask(long struct) Unsafe version ofmask(). -
nbitfield1
public static int nbitfield1(long struct) -
ninstanceShaderBindingTableRecordOffset
public static int ninstanceShaderBindingTableRecordOffset(long struct) Unsafe version ofinstanceShaderBindingTableRecordOffset(). -
nflags
public static int nflags(long struct) Unsafe version offlags(). -
naccelerationStructureReference
public static long naccelerationStructureReference(long struct) Unsafe version ofaccelerationStructureReference(). -
ntransform
Unsafe version oftransform. -
nbitfield0
public static void nbitfield0(long struct, int value) -
ninstanceCustomIndex
public static void ninstanceCustomIndex(long struct, int value) Unsafe version ofinstanceCustomIndex. -
nmask
public static void nmask(long struct, int value) Unsafe version ofmask. -
nbitfield1
public static void nbitfield1(long struct, int value) -
ninstanceShaderBindingTableRecordOffset
public static void ninstanceShaderBindingTableRecordOffset(long struct, int value) Unsafe version ofinstanceShaderBindingTableRecordOffset. -
nflags
public static void nflags(long struct, int value) Unsafe version offlags. -
naccelerationStructureReference
public static void naccelerationStructureReference(long struct, long value) Unsafe version ofaccelerationStructureReference.
-