MacOS - Vulkan at runtime vkCreateDevice() fails when VkPhysicalDeviceFeatures wideLines = VK_TURE and doestn't support vkCmdSetLineWidth API as well

Hi All,

I am new to Vulkan, and recently started learning .

I am facing issue, at runtime in vkCreateDevice() fails, when VkPhysicalDeviceFeatures is enables with

VkPhysicalDeviceFeatures features {};
   features.wideLines                            = VK_TRUE;

Error – [mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCmdSetLineWidth(): The current device does not support wide lines

And when features.wideLines = VK_FALSE; vkCreateDevice() creations is successful, but I am not able to modify the LineWidth using - vkCmdSetLineWidth (command_buffer, line_width); this gives me

error- [mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCmdSetLineWidth(): The current device does not support wide lines.

here is some of details -

  • MacOS - 10.14 (Mojave)
  • Graphics card - Graphichs - Intel UHD Graphics 630 1536 MB
  • LunarG Vulkan Instance Version: 1.2.154

Note- Same version of “LunarG Vulkan Instance Version: 1.2.154” on windows is working fine when features.wideLines = VK_TRUE; and able to use vkCmdSetLineWidth (command_buffer, line_width);

Some of details of VulkanInfo mentioning here related to wideLines feature-

VkPhysicalDeviceFeatures:
--------------------------------------	
	geometryShader                   = false
	wideLines                               = false

lineWidthRange: count  =  2
		1
		1
lineWidthGranularity                            = 1
strictLines                                            = false

I did some searches in Vulkan Documentation/on google, but couldn’t find anyone reporting a similar issue. Any help would be appreciated.

Thanks,
Md Shamsh Alam

There are no native Vulkan drivers on MacOS nor iOS (Apple does not allow them) only emulation through MoltenVK which translates Vulkan API calls to Metal API calls. AFAIK Metal does not support wide lines, hence the features is reported as not supported in VkPhysicalDeviceFeatures.
If a feature is reported as not available by the hardware/driver you cannot enable it, that causes device creation to fail as you have observed. Similarly I’m pretty sure vkCmdSetLineWidth is specified to only be available if the device feature is enabled.

2 Likes

Thanks carsten_neumann.

As I understand feature is not supported by Vulkan SDK ( because if it’s Hardware(i.e GPU) issue ,then I shouldn’t able to achieve using other’s rendering libraries like OpenGL).

Is there any way to achieve wideLines feature on MacOs using Vulkan? (as I mentioned above I am using Lunarg SDK Version: 1.2.154)

1 Like

Depending on the GPU, MacOS’s OpenGL implementation may well be transforming any wide-line drawing commands into polygons. Vulkan implementations aren’t allowed to do that, as this would require an unauthorized CPU/GPU synchronization and round-trip (imagine trying to make that work when the GPU is generating the vertex data for an indirect line rendering command). The downside of being a low-level, explicit API is that if hardware can’t do a thing, the API often can’t fudge it for you.

But even if the hardware could allow you to do it, the Metal API doesn’t provide access to it. So there’s nothing you can do.

2 Likes

Does this mean wideLines in Mac cannot be achieved throw Vulkan / Metal? How game developers are able to port their games project in openGL to Metal/Vulkan? They will not be able to support such features in MAC yet all?

That’s been said several times in this thread.

I don’t think game developers use wide lines much.

1 Like

Thanks for info and confirming :). I have a one more query related to lines in MAC. Whether stipples lines are supported in MAC? Is it like widelines, stipple line are also not allowed? We tried to set VkPipelineRasterizationLineStateCreateInfoEXT. But we were not able to draw stippled lines. Can you please let us know about stippled lines also?

Line stipple is an extension. If it’s not in the list of extensions, then it’s not supported.

And stippling isn’t terribly difficult to implement ones-self (requiring little more than a custom fragment shader), depending on what kind of artifacts you’re willing to tolerate.