#74

How to obtain PhysicalDeviceIDProperties?

Openonynopened 1y ago

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?

Activity

7
splace1y ago
onyn1y ago

@splace could you point to exact function in "go doc", which provides PhysicalDeviceIDProperties?

splace1y ago
> 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.

splace1y ago

also just look at the packages online doc, which was generated by go doc.

https://pkg.go.dev/github.com/vulkan-go/vulkan#PhysicalDeviceIDProperties

onyn1y ago

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?

splace1y ago

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.

onyn1y ago

you call funcs to get unsafe pointers

What name of the function I need to call to obtain unsafe.Pointer for passing toNewPhysicalDeviceIDPropertiesRef?