Updated for openjdk-19-internal
[panamaz] / test-vulkan / src / zvk / VkPhysicalDeviceGroupProperties.java
1 package zvk;
2 import jdk.incubator.foreign.*;
3 import java.lang.invoke.*;
4 public final class VkPhysicalDeviceGroupProperties implements Memory.Addressable {
5         final MemorySegment segment;
6         final DispatchInstance instanceDispatch;
7
8         VkPhysicalDeviceGroupProperties(MemorySegment segment, DispatchInstance instanceDispatch) {
9                 this.segment = segment;
10                 this.instanceDispatch = instanceDispatch;
11                 segment.set(Memory.INT, 0, VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES);
12         }
13         public final MemoryAddress address() { return segment.address(); }
14         /*
15         public static VkPhysicalDeviceGroupProperties create(Frame frame) {
16                 return new VkPhysicalDeviceGroupProperties(frame.allocate(LAYOUT));
17         }
18
19         public static VkPhysicalDeviceGroupProperties create(ResourceScope scope) {
20                 return new VkPhysicalDeviceGroupProperties(MemorySegment.allocateNative(LAYOUT, scope));
21                 }*/
22
23         // len= altLen=
24         MemoryAddress getNext() {
25                 return (MemoryAddress)pNext$VH.get(segment);
26         }
27         MemoryAddress getNext(long index) {
28                 return (MemoryAddress)pNext$VH.get(segment.asSlice(index * LAYOUT.byteSize(), LAYOUT.byteSize()));
29         }
30
31         public long length() {
32                 return segment.byteSize() / LAYOUT.byteSize();
33         }
34
35         // len= altLen=
36         int getPhysicalDeviceCount() {
37                 return (int)physicalDeviceCount$VH.get(segment);
38         }
39         int getPhysicalDeviceCount(long index) {
40                 return (int)physicalDeviceCount$VH.get(segment.asSlice(index * LAYOUT.byteSize(), LAYOUT.byteSize()));
41         }
42         // len= altLen=
43         Memory.HandleArray<VkPhysicalDevice> getPhysicalDevices() {
44                 MemoryLayout.PathElement pe = MemoryLayout.PathElement.groupElement("physicalDevices");
45                 MemorySegment seg = segment.asSlice(LAYOUT.byteOffset(pe), LAYOUT.select(pe).byteSize());
46                 return new Memory.HandleArray<VkPhysicalDevice>((addr)->new VkPhysicalDevice(addr, instanceDispatch), seg);
47         }
48         Memory.HandleArray<VkPhysicalDevice> getPhysicalDevices(long index) {
49                 MemoryLayout.PathElement pe = MemoryLayout.PathElement.groupElement("physicalDevices");
50                 MemorySegment seg = segment.asSlice(index * LAYOUT.byteSize() + LAYOUT.byteOffset(pe), LAYOUT.select(pe).byteSize());
51                 return new Memory.HandleArray<VkPhysicalDevice>((addr)->new VkPhysicalDevice(addr, instanceDispatch), seg);
52         }
53         // len= altLen=
54         int getSubsetAllocation() {
55                 return (int)subsetAllocation$VH.get(segment);
56         }
57         int getSubsetAllocation(long index) {
58                 return (int)subsetAllocation$VH.get(segment.asSlice(index * LAYOUT.byteSize(), LAYOUT.byteSize()));
59         }
60         // VkStructureType sType
61         // void* pNext
62         // uint32_t physicalDeviceCount
63         // VkPhysicalDevice                 [VK_MAX_DEVICE_GROUP_SIZE] physicalDevices
64         // VkBool32 subsetAllocation
65         public static final GroupLayout LAYOUT = MemoryLayout.structLayout(
66         Memory.INT.withName("sType"),
67         MemoryLayout.paddingLayout(32),
68         Memory.POINTER.withName("pNext"),
69         Memory.INT.withName("physicalDeviceCount"),
70         MemoryLayout.paddingLayout(32),
71         MemoryLayout.sequenceLayout(32,
72                 Memory.POINTER).withName("physicalDevices"),
73         Memory.INT.withName("subsetAllocation"),
74         MemoryLayout.paddingLayout(32));
75         static final VarHandle sType$VH = LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("sType"));
76         static final VarHandle pNext$VH = LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("pNext"));
77         static final VarHandle physicalDeviceCount$VH = LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("physicalDeviceCount"));
78         static final VarHandle physicalDevices$VH = LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("physicalDevices"));
79         static final VarHandle subsetAllocation$VH = LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("subsetAllocation"));
80 }