How to obtain PhysicalDeviceIDProperties?
Hello.
How can I get PhysicalDeviceIDProperties struct for my device? I've found func NewPhysicalDeviceIDPropertiesRef(ref unsafe.Pointer) function, but I have no idea where to find this pointer.
Could someone provide example?
for type info use "go doc", see; https://pkg.go.dev/cmd/go#hdr-Show_documentation_for_package_or_symbol
and
for vilkan-go examples; https://github.com/vulkan-go/demos
@splace could you point to exact function in "go doc", which provides PhysicalDeviceIDProperties?
> go doc PhysicalDeviceIDProperties
package vulkan
type PhysicalDeviceIDProperties struct {
SType StructureType
PNext unsafe.Pointer
DeviceUUID [16]byte
DriverUUID [16]byte
DeviceLUID [8]byte
DeviceNodeMask uint32
DeviceLUIDValid Bool32
// Has unexported fields.
}
PhysicalDeviceIDProperties as declared in
https://www.khronos.org/registry/vulkan/specs/1.0/man/html/VkPhysicalDeviceIDProperties.html
func NewPhysicalDeviceIDPropertiesRef(ref unsafe.Pointer) *PhysicalDeviceIDProperties
func (x *PhysicalDeviceIDProperties) Deref()
func (x *PhysicalDeviceIDProperties) Free()
func (x *PhysicalDeviceIDProperties) PassRef() (*C.VkPhysicalDeviceIDProperties, *cgoAllocMap)
func (x PhysicalDeviceIDProperties) PassValue() (C.VkPhysicalDeviceIDProperties, *cgoAllocMap)
func (x *PhysicalDeviceIDProperties) Ref() *C.VkPhysicalDeviceIDProperties
obviously vulkan has to be installed and this only works this simply when you're in its folder.
much help can be obtained using go doc.
also just look at the packages online doc, which was generated by go doc.
https://pkg.go.dev/github.com/vulkan-go/vulkan#PhysicalDeviceIDProperties
Ok. Let's return to my first message:
I've found func NewPhysicalDeviceIDPropertiesRef(ref unsafe.Pointer) function, but I have no idea where to find this pointer.
What your go doc say about ref unsafe.Pointer? How to find valid pointer for this function?
OK, this package calls into vulkan, which is compiled c, the unsafe pointer is 'unsafe' due to this, the demos show you this working.
you call funcs to get unsafe pointers, then call on these to get an unpopulated struct that you call another func to populate, you also get a cleanup func because go garbage collecter cant see the c, c doesn't have one anyway, but vulkan has its own way off cleaning up.
i got this from looking at the demos.
you call funcs to get unsafe pointers
What name of the function I need to call to obtain unsafe.Pointer for passing toNewPhysicalDeviceIDPropertiesRef?