Skip to content

clean up PIPE_SWIZZLE_NONE usage

Erik Faye-Lund requested to merge kusma/mesa:pan-swizzle-assert into main

PIPE_SWIZZLE_NONE is not like the other pipe_swizzle values; it can't be used in a swizzle operation. Instead, it's only used to describe a lacking channel in a format. This was a bit clearer before fb523cb6, but since these two enums were merged, the code has gotten increasingly confused about what PIPE_SWIZZLE_NONE means.

Some drivers has tried to interpret it as something along the lines of VK_COMPONENT_SWIZZLE_IDENTITY, but that was never what it was used for.

So let's do a few things:

  1. Add a comment to describe what it actually means.
  2. Make sure Lavapipe doesn't generate PIPE_SWIZZLE_NONE, which would later on trip up LLVMpipe if that code was ever reached.
  3. Remove handling of PIPE_SWIZZLE_NONE where it's not needed. We make sure we have asserts or similar debug mechanisms to catch if we ever trigger the code with the unexpected value.

I think this should make things as simple as it can be, while making it somewhat clearer what the actual rules are.

I've vetted all the code-paths using PIPE_SWIZZLE_NONE, and the rest looks correct to me.

Edited by Erik Faye-Lund

Merge request reports