Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to obtain PhysicalDeviceIDProperties? #74

Open
onyn opened this issue Feb 27, 2025 · 7 comments
Open

How to obtain PhysicalDeviceIDProperties? #74

onyn opened this issue Feb 27, 2025 · 7 comments

Comments

@onyn
Copy link

onyn commented Feb 27, 2025

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?

@splace
Copy link

splace commented Mar 1, 2025

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

@onyn
Copy link
Author

onyn commented Mar 2, 2025

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

@splace
Copy link

splace commented Mar 7, 2025

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

@splace
Copy link

splace commented Mar 7, 2025

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

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

@onyn
Copy link
Author

onyn commented Mar 8, 2025

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?

@splace
Copy link

splace commented Mar 8, 2025

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.

@onyn
Copy link
Author

onyn commented Mar 8, 2025

you call funcs to get unsafe pointers

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants