org.lwjgl.vulkan.VkPhysicalDeviceProperties Maven / Gradle / Ivy
Show all versions of lwjgl-vulkan Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
import javax.annotation.*;
import java.nio.*;
import org.lwjgl.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.vulkan.VK10.*;
/**
* Structure specifying physical device properties.
*
* Description
*
* The {@code vendorID} and {@code deviceID} fields are provided to allow applications to adapt to device characteristics that are not adequately exposed by other Vulkan queries. These may include performance profiles, hardware errata, or other characteristics. In PCI-based implementations, the low sixteen bits of {@code vendorID} and {@code deviceID} must contain (respectively) the PCI vendor and device IDs associated with the hardware device, and the remaining bits must be set to zero. In non-PCI implementations, the choice of what values to return may be dictated by operating system or platform policies. It is otherwise at the discretion of the implementer, subject to the following constraints and guidelines:
*
*
* - For purposes of physical device identification, the vendor of a physical device is the entity responsible for the most salient characteristics of the hardware represented by the physical device handle. In the case of a discrete GPU, this should be the GPU chipset vendor. In the case of a GPU or other accelerator integrated into a system-on-chip (SoC), this should be the supplier of the silicon IP used to create the GPU or other accelerator.
* - If the vendor of the physical device has a valid PCI vendor ID issued by PCI-SIG, that ID should be used to construct {@code vendorID} as described above for PCI-based implementations. Implementations that do not return a PCI vendor ID in {@code vendorID} must return a valid Khronos vendor ID, obtained as described in the Vulkan Documentation and Extensions document in the section “Registering a Vendor ID with Khronos”. Khronos vendor IDs are allocated starting at 0x10000, to distinguish them from the PCI vendor ID namespace.
* - The vendor of the physical device is responsible for selecting {@code deviceID}. The value selected should uniquely identify both the device version and any major configuration options (for example, core count in the case of multicore devices). The same device ID should be used for all physical implementations of that device version and configuration. For example, all uses of a specific silicon IP GPU version and configuration should use the same device ID, even if those uses occur in different SoCs.
*
*
* See Also
*
* {@link VkPhysicalDeviceLimits}, {@link VkPhysicalDeviceProperties2KHR}, {@link VkPhysicalDeviceSparseProperties}, {@link VK10#vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties}
*
* Member documentation
*
*
* - {@code apiVersion} – the version of Vulkan supported by the device, encoded as described in the API Version Numbers and Semantics section.
* - {@code driverVersion} – the vendor-specified version of the driver.
* - {@code vendorID} – a unique identifier for the vendor (see below) of the physical device.
* - {@code deviceID} – a unique identifier for the physical device among devices available from the vendor.
* - {@code deviceType} – a {@code VkPhysicalDeviceType} specifying the type of device.
* - {@code deviceName} – a null-terminated UTF-8 string containing the name of the device.
* - {@code pipelineCacheUUID} – an array of size {@link VK10#VK_UUID_SIZE UUID_SIZE}, containing 8-bit values that represent a universally unique identifier for the device.
* - {@code limits} – the {@link VkPhysicalDeviceLimits} structure which specifies device-specific limits of the physical device. See Limits for details.
* - {@code sparseProperties} – the {@link VkPhysicalDeviceSparseProperties} structure which specifies various sparse related properties of the physical device. See Sparse Properties for details.
*
*
* Layout
*
*
* struct VkPhysicalDeviceProperties {
* uint32_t apiVersion;
* uint32_t driverVersion;
* uint32_t vendorID;
* uint32_t deviceID;
* VkPhysicalDeviceType deviceType;
* char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
* uint8_t pipelineCacheUUID[VK_UUID_SIZE];
* {@link VkPhysicalDeviceLimits VkPhysicalDeviceLimits} limits;
* {@link VkPhysicalDeviceSparseProperties VkPhysicalDeviceSparseProperties} sparseProperties;
* }
*/
public class VkPhysicalDeviceProperties extends Struct implements NativeResource {
/** The struct size in bytes. */
public static final int SIZEOF;
public static final int ALIGNOF;
/** The struct member offsets. */
public static final int
APIVERSION,
DRIVERVERSION,
VENDORID,
DEVICEID,
DEVICETYPE,
DEVICENAME,
PIPELINECACHEUUID,
LIMITS,
SPARSEPROPERTIES;
static {
Layout layout = __struct(
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__array(1, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE),
__array(1, VK_UUID_SIZE),
__member(VkPhysicalDeviceLimits.SIZEOF, VkPhysicalDeviceLimits.ALIGNOF),
__member(VkPhysicalDeviceSparseProperties.SIZEOF, VkPhysicalDeviceSparseProperties.ALIGNOF)
);
SIZEOF = layout.getSize();
ALIGNOF = layout.getAlignment();
APIVERSION = layout.offsetof(0);
DRIVERVERSION = layout.offsetof(1);
VENDORID = layout.offsetof(2);
DEVICEID = layout.offsetof(3);
DEVICETYPE = layout.offsetof(4);
DEVICENAME = layout.offsetof(5);
PIPELINECACHEUUID = layout.offsetof(6);
LIMITS = layout.offsetof(7);
SPARSEPROPERTIES = layout.offsetof(8);
}
VkPhysicalDeviceProperties(long address, @Nullable ByteBuffer container) {
super(address, container);
}
/**
* Creates a {@link VkPhysicalDeviceProperties} instance at the current position of the specified {@link ByteBuffer} container. 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.
*/
public VkPhysicalDeviceProperties(ByteBuffer container) {
this(memAddress(container), __checkContainer(container, SIZEOF));
}
@Override
public int sizeof() { return SIZEOF; }
/** Returns the value of the {@code apiVersion} field. */
@NativeType("uint32_t")
public int apiVersion() { return napiVersion(address()); }
/** Returns the value of the {@code driverVersion} field. */
@NativeType("uint32_t")
public int driverVersion() { return ndriverVersion(address()); }
/** Returns the value of the {@code vendorID} field. */
@NativeType("uint32_t")
public int vendorID() { return nvendorID(address()); }
/** Returns the value of the {@code deviceID} field. */
@NativeType("uint32_t")
public int deviceID() { return ndeviceID(address()); }
/** Returns the value of the {@code deviceType} field. */
@NativeType("VkPhysicalDeviceType")
public int deviceType() { return ndeviceType(address()); }
/** Returns a {@link ByteBuffer} view of the {@code deviceName} field. */
@NativeType("char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]")
public ByteBuffer deviceName() { return ndeviceName(address()); }
/** Decodes the null-terminated string stored in the {@code deviceName} field. */
@NativeType("char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]")
public String deviceNameString() { return ndeviceNameString(address()); }
/** Returns a {@link ByteBuffer} view of the {@code pipelineCacheUUID} field. */
@NativeType("uint8_t[VK_UUID_SIZE]")
public ByteBuffer pipelineCacheUUID() { return npipelineCacheUUID(address()); }
/** Returns the value at the specified index of the {@code pipelineCacheUUID} field. */
@NativeType("uint8_t")
public byte pipelineCacheUUID(int index) { return npipelineCacheUUID(address(), index); }
/** Returns a {@link VkPhysicalDeviceLimits} view of the {@code limits} field. */
public VkPhysicalDeviceLimits limits() { return nlimits(address()); }
/** Returns a {@link VkPhysicalDeviceSparseProperties} view of the {@code sparseProperties} field. */
public VkPhysicalDeviceSparseProperties sparseProperties() { return nsparseProperties(address()); }
// -----------------------------------
/** Returns a new {@link VkPhysicalDeviceProperties} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
public static VkPhysicalDeviceProperties malloc() {
return create(nmemAllocChecked(SIZEOF));
}
/** Returns a new {@link VkPhysicalDeviceProperties} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
public static VkPhysicalDeviceProperties calloc() {
return create(nmemCallocChecked(1, SIZEOF));
}
/** Returns a new {@link VkPhysicalDeviceProperties} instance allocated with {@link BufferUtils}. */
public static VkPhysicalDeviceProperties create() {
return new VkPhysicalDeviceProperties(BufferUtils.createByteBuffer(SIZEOF));
}
/** Returns a new {@link VkPhysicalDeviceProperties} instance for the specified memory address. */
public static VkPhysicalDeviceProperties create(long address) {
return new VkPhysicalDeviceProperties(address, null);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static VkPhysicalDeviceProperties createSafe(long address) {
return address == NULL ? null : create(address);
}
/**
* Returns a new {@link VkPhysicalDeviceProperties.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer malloc(int capacity) {
return create(__malloc(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link VkPhysicalDeviceProperties.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer calloc(int capacity) {
return create(nmemCallocChecked(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link VkPhysicalDeviceProperties.Buffer} instance allocated with {@link BufferUtils}.
*
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer create(int capacity) {
return new Buffer(__create(capacity, SIZEOF));
}
/**
* Create a {@link VkPhysicalDeviceProperties.Buffer} instance at the specified memory.
*
* @param address the memory address
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer create(long address, int capacity) {
return new Buffer(address, capacity);
}
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static VkPhysicalDeviceProperties.Buffer createSafe(long address, int capacity) {
return address == NULL ? null : create(address, capacity);
}
// -----------------------------------
/** Returns a new {@link VkPhysicalDeviceProperties} instance allocated on the thread-local {@link MemoryStack}. */
public static VkPhysicalDeviceProperties mallocStack() {
return mallocStack(stackGet());
}
/** Returns a new {@link VkPhysicalDeviceProperties} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
public static VkPhysicalDeviceProperties callocStack() {
return callocStack(stackGet());
}
/**
* Returns a new {@link VkPhysicalDeviceProperties} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
*/
public static VkPhysicalDeviceProperties mallocStack(MemoryStack stack) {
return create(stack.nmalloc(ALIGNOF, SIZEOF));
}
/**
* Returns a new {@link VkPhysicalDeviceProperties} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
*/
public static VkPhysicalDeviceProperties callocStack(MemoryStack stack) {
return create(stack.ncalloc(ALIGNOF, 1, SIZEOF));
}
/**
* Returns a new {@link VkPhysicalDeviceProperties.Buffer} instance allocated on the thread-local {@link MemoryStack}.
*
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer mallocStack(int capacity) {
return mallocStack(capacity, stackGet());
}
/**
* Returns a new {@link VkPhysicalDeviceProperties.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
*
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer callocStack(int capacity) {
return callocStack(capacity, stackGet());
}
/**
* Returns a new {@link VkPhysicalDeviceProperties.Buffer} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer mallocStack(int capacity, MemoryStack stack) {
return create(stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
}
/**
* Returns a new {@link VkPhysicalDeviceProperties.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static VkPhysicalDeviceProperties.Buffer callocStack(int capacity, MemoryStack stack) {
return create(stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
}
// -----------------------------------
/** Unsafe version of {@link #apiVersion}. */
public static int napiVersion(long struct) { return memGetInt(struct + VkPhysicalDeviceProperties.APIVERSION); }
/** Unsafe version of {@link #driverVersion}. */
public static int ndriverVersion(long struct) { return memGetInt(struct + VkPhysicalDeviceProperties.DRIVERVERSION); }
/** Unsafe version of {@link #vendorID}. */
public static int nvendorID(long struct) { return memGetInt(struct + VkPhysicalDeviceProperties.VENDORID); }
/** Unsafe version of {@link #deviceID}. */
public static int ndeviceID(long struct) { return memGetInt(struct + VkPhysicalDeviceProperties.DEVICEID); }
/** Unsafe version of {@link #deviceType}. */
public static int ndeviceType(long struct) { return memGetInt(struct + VkPhysicalDeviceProperties.DEVICETYPE); }
/** Unsafe version of {@link #deviceName}. */
public static ByteBuffer ndeviceName(long struct) { return memByteBuffer(struct + VkPhysicalDeviceProperties.DEVICENAME, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE); }
/** Unsafe version of {@link #deviceNameString}. */
public static String ndeviceNameString(long struct) { return memUTF8(struct + VkPhysicalDeviceProperties.DEVICENAME); }
/** Unsafe version of {@link #pipelineCacheUUID}. */
public static ByteBuffer npipelineCacheUUID(long struct) { return memByteBuffer(struct + VkPhysicalDeviceProperties.PIPELINECACHEUUID, VK_UUID_SIZE); }
/** Unsafe version of {@link #pipelineCacheUUID(int) pipelineCacheUUID}. */
public static byte npipelineCacheUUID(long struct, int index) {
if (CHECKS) { check(index, VK_UUID_SIZE); }
return memGetByte(struct + VkPhysicalDeviceProperties.PIPELINECACHEUUID + index * 1);
}
/** Unsafe version of {@link #limits}. */
public static VkPhysicalDeviceLimits nlimits(long struct) { return VkPhysicalDeviceLimits.create(struct + VkPhysicalDeviceProperties.LIMITS); }
/** Unsafe version of {@link #sparseProperties}. */
public static VkPhysicalDeviceSparseProperties nsparseProperties(long struct) { return VkPhysicalDeviceSparseProperties.create(struct + VkPhysicalDeviceProperties.SPARSEPROPERTIES); }
// -----------------------------------
/** An array of {@link VkPhysicalDeviceProperties} structs. */
public static class Buffer extends StructBuffer implements NativeResource {
/**
* Creates a new {@link VkPhysicalDeviceProperties.Buffer} instance backed by the specified container.
*
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
* by {@link VkPhysicalDeviceProperties#SIZEOF}, and its mark will be undefined.
*
* The created buffer instance holds a strong reference to the container object.
*/
public Buffer(ByteBuffer container) {
super(container, container.remaining() / SIZEOF);
}
public Buffer(long address, int cap) {
super(address, null, -1, 0, cap, cap);
}
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
super(address, container, mark, pos, lim, cap);
}
@Override
protected Buffer self() {
return this;
}
@Override
protected Buffer newBufferInstance(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
return new Buffer(address, container, mark, pos, lim, cap);
}
@Override
protected VkPhysicalDeviceProperties newInstance(long address) {
return new VkPhysicalDeviceProperties(address, container);
}
@Override
public int sizeof() {
return SIZEOF;
}
/** Returns the value of the {@code apiVersion} field. */
@NativeType("uint32_t")
public int apiVersion() { return VkPhysicalDeviceProperties.napiVersion(address()); }
/** Returns the value of the {@code driverVersion} field. */
@NativeType("uint32_t")
public int driverVersion() { return VkPhysicalDeviceProperties.ndriverVersion(address()); }
/** Returns the value of the {@code vendorID} field. */
@NativeType("uint32_t")
public int vendorID() { return VkPhysicalDeviceProperties.nvendorID(address()); }
/** Returns the value of the {@code deviceID} field. */
@NativeType("uint32_t")
public int deviceID() { return VkPhysicalDeviceProperties.ndeviceID(address()); }
/** Returns the value of the {@code deviceType} field. */
@NativeType("VkPhysicalDeviceType")
public int deviceType() { return VkPhysicalDeviceProperties.ndeviceType(address()); }
/** Returns a {@link ByteBuffer} view of the {@code deviceName} field. */
@NativeType("char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]")
public ByteBuffer deviceName() { return VkPhysicalDeviceProperties.ndeviceName(address()); }
/** Decodes the null-terminated string stored in the {@code deviceName} field. */
@NativeType("char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]")
public String deviceNameString() { return VkPhysicalDeviceProperties.ndeviceNameString(address()); }
/** Returns a {@link ByteBuffer} view of the {@code pipelineCacheUUID} field. */
@NativeType("uint8_t[VK_UUID_SIZE]")
public ByteBuffer pipelineCacheUUID() { return VkPhysicalDeviceProperties.npipelineCacheUUID(address()); }
/** Returns the value at the specified index of the {@code pipelineCacheUUID} field. */
@NativeType("uint8_t")
public byte pipelineCacheUUID(int index) { return VkPhysicalDeviceProperties.npipelineCacheUUID(address(), index); }
/** Returns a {@link VkPhysicalDeviceLimits} view of the {@code limits} field. */
public VkPhysicalDeviceLimits limits() { return VkPhysicalDeviceProperties.nlimits(address()); }
/** Returns a {@link VkPhysicalDeviceSparseProperties} view of the {@code sparseProperties} field. */
public VkPhysicalDeviceSparseProperties sparseProperties() { return VkPhysicalDeviceProperties.nsparseProperties(address()); }
}
}