Closed kusma closed 2 months ago
There's some rendering issues going on, but I believe these to be driver issues, which we'll be debugging shortly.
Just to be clear, I've verified that the rendering issues does not occur on RADV when disabling the shaderClipDistance
-feature there. So I'm relatively confident that these issues aren't intrinsic to the approach.
In either case, this makes things run where it doesn't currently run, so it seems like a win regardless.
Not all Vulkan-drivers support the
shaderClipDistance
-feature, and it's relatively easy to emulate; just insert a conditional discard in the fragment shader.While a driver could also in theory do this emulation, it signals to applications that this is an actual HW feature, but discarding in the fragment shader has implications with spawning additional fragment shader instances, and complicates things like helper-invocations and centroid-interpolation.
So it's really better to implement this in the applications than the drivers.
In this case, it can be done fairly easily by using the specialization variables. It's trivial for drivers to eliminate the extra unused varyings, so it should be just as efficient.
In order to not have to specialize too many shader variants, I also used variants for the mul/add fragment shader variations first.
All in all, this makes VkQuake3 work for me on PanVK (the open source Vulkan driver for ARM Mali GPUs) on RK3588, which has a Mali-G610 GPU. There's some rendering issues going on, but I believe these to be driver issues, which we'll be debugging shortly.