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

Wrong parameter type in index.d.ts #38

Closed
norman784 opened this issue Jul 28, 2019 · 8 comments
Closed

Wrong parameter type in index.d.ts #38

norman784 opened this issue Jul 28, 2019 · 8 comments

Comments

@norman784
Copy link

There's an issue with the generated Typescript definitions, the function must take VkBool32 as pSupported parameter but it takes VkInout.

/**
   * Query if presentation is supported
   * @param physicalDevice is the physical device.
   * @param queueFamilyIndex is the queue family.
   * @param surface is the surface.
   * @param pSupported is a reference to a 'VkBool32', which is set to 'VK_TRUE' to indicate support, and 'VK_FALSE' otherwise.
   */
  function vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice: VkPhysicalDevice | null, queueFamilyIndex: number, surface: VkSurfaceKHR | null, pSupported: VkInout | null): VkResult;
@maierfelix
Copy link
Owner

maierfelix commented Jul 28, 2019

nvk's documentation is generated based on the original documentation and not finished yet - the documentation incorrectly states here that VkBool32 has to be used, but VkInout is the correct type.

Edit: Having a quick look at the type definition file, it seems that VkInout should also allow boolean values.

@norman784
Copy link
Author

But if you use VkInout it doesn't work, if I use this code

let surface_support = { $: 0 }
vkGetPhysicalDeviceSurfaceSupportKHR(this.physical_device, 0, this.surface, surface_support)

I get

vkGetPhysicalDeviceSurfaceSupportKHR(this.physical_device, 0, this.surface, surface_support)                                                              
    ^                                                                          
TypeError: Expected 'Boolean' for Object property '$' 4 'pSupported' in 'vkGetPhysicalDeviceSurfaceSupportKHR' 

And if use this

let surface_support = { $: false }
vkGetPhysicalDeviceSurfaceSupportKHR(this.physical_device, 0, this.surface, surface_support)

I get

Argument of type '{ $: boolean; }' is not assignable to parameter of type 'VkInout'.
  Types of property '$' are incompatible.
    Type 'boolean' is not assignable to type 'number'. 
vkGetPhysicalDeviceSurfaceSupportKHR(this.physical_device, 0, this.surface, surface_support)  
                                                                                                                           ~~~~~~~~~~~~~~~  

I'm not sure another way to solve this issue rather than change in the generated files the VkInout for VkBool32

@maierfelix
Copy link
Owner

Hey my comment edit above was a reminder for myself, not an actual answer :) - this is a bug in nvk

I'm busy this week, but if you can't wait for a fix, then (depending on your OS) you can try editing the two top lines of this file, by changing them from this:

declare var VkInout: { $: number; }
export interface VkInout { $: number; }

to this:

declare var VkInout: { $: number | boolean; }
export interface VkInout { $: number | boolean; }

@norman784
Copy link
Author

Cool, thanks!

@maierfelix
Copy link
Owner

This should be fixed in v0.6.3

@norman784
Copy link
Author

I don't know if is related, but the v0.6.3 points to the generated files v1.1.108 instead of the bundled one v1.1.114.

@maierfelix
Copy link
Owner

@norman784 sorry for that, is v0.6.4 working for you now?

@norman784
Copy link
Author

Thanks, now it works!

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