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

logicOp not supported on MoltenVK / M2 Mini #141

Open
ar-visions opened this issue Jul 21, 2023 · 3 comments
Open

logicOp not supported on MoltenVK / M2 Mini #141

ar-visions opened this issue Jul 21, 2023 · 3 comments
Assignees
Labels

Comments

@ar-visions
Copy link

ar-visions commented Jul 21, 2023

validation layer: VK_ERROR_FEATURE_NOT_PRESENT: vkCreateDevice(): Requested physical device feature specified by the 9th flag in VkPhysicalDeviceFeatures is not available on this device.

deviceFeatures.logicOp = VK_TRUE; // <- 9th member on struct

I notice vkvg uses this. what does this break? how do you implement an alternate technique for what breaks?

This is a m2 mac mini pro

@ar-visions ar-visions changed the title logicOp not supported on MoltenVK logicOp not supported on MoltenVK / M2 Mini Jul 21, 2023
@ar-visions
Copy link
Author

ar-visions commented Jul 22, 2023

Looks like we would need to handle the blending ops for clip inside of fragment otherwise? This is just my best guess at the moment. Not quite sure if I can get it working without this. For each feature, I'm enabling based on device feature support and storing it for using alternate routines at runtime.

Would a fragment shader approach be much slower for the blending ops? We could support more devices.

@ar-visions
Copy link
Author

ar-visions commented Jul 23, 2023

VK_CHECK_RESULT(vkCreateGraphicsPipelines(dev->vkDev, dev->pipelineCache, 1, &pipelineCreateInfo, NULL, &dev->pipelinePolyFill)); // <-- i think it would be best to convert the topology rather than avoid painting the polygons lol.

When I get this working would you like a patch for Apple use-case? Appreciate it!

I think the logic Ops will be far more difficult for me to patch up with performance in mind on this hardware. But I really want to get it working. Topology conversion is nothing. On Apple hardware, basically 70-80% of it we are looking at no primitives for fans which is annoying but not hard to patch. The logic ops used in drawing system is the elephant in the room I think. Probably will use a different shader for that approach. At the same time I will attempt to render circles faster than skia.

@jpbruyere jpbruyere self-assigned this Jul 23, 2023
@jpbruyere
Copy link
Owner

jpbruyere commented Jul 23, 2023

validation layer: VK_ERROR_FEATURE_NOT_PRESENT: vkCreateDevice(): Requested physical device feature specified by the 9th flag in VkPhysicalDeviceFeatures is not available on this device.

deviceFeatures.logicOp = VK_TRUE; // <- 9th member on struct

I notice vkvg uses this. what does this break? how do you implement an alternate technique for what breaks?

This is a m2 mac mini pro

vkvg use it for the clear operator.

Looks like we would need to handle the blending ops for clip inside of fragment otherwise? This is just my best guess at the moment. Not quite sure if I can get it working without this. For each feature, I'm enabling based on device feature support and storing it for using alternate routines at runtime.

Would a fragment shader approach be much slower for the blending ops? We could support more devices.

The problem with in shader blending operations is that you need the current fragment color to compute resulting color. Vulkan introduced a new extension that gives to the hardware the opportunity to implement a fast path to do so. You may test it. I don't have the name of the extension in mind, I should look onto my work laptop, but I have a very strict non disclosure contract, so I hope you'll find that by yourself...There are older extensions in gl, maybe availaible to vulkan that allow reading the current fragment value, but they are known to be slow...
Vulkan logic_op with extended operations would allows to cover the full classic 2d compositing operations. I'm not hurry on that point hoping drivers will one day support the full range of operators with the best hardware side optimizations....

VK_CHECK_RESULT(vkCreateGraphicsPipelines(dev->vkDev, dev->pipelineCache, 1, &pipelineCreateInfo, NULL, &dev->pipelinePolyFill)); // <-- i think it would be best to convert the topology rather than avoid painting the polygons lol.

When I get this working would you like a patch for Apple use-case? Appreciate it!

I think the logic Ops will be far more difficult for me to patch up with performance in mind on this hardware. But I really want to get it working. Topology conversion is nothing. On Apple hardware, basically 70-80% of it we are looking at no primitives for fans which is annoying but not hard to patch. The logic ops used in drawing system is the elephant in the room I think. Probably will use a different shader for that approach. At the same time I will attempt to render circles faster than skia.

Having no support for Fan for apple, I've disabled the pipeline creation, but yes, that's half the solution. The best quick solution is to emit triangle indices in the existing but not binded Index buffer of the context and draw triangle list with the same vertex buffer. You may provide the patch, I'll be happy to merge it.

Thank you for your report.

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

No branches or pull requests

2 participants