Skip to content

compiler: Clean up mesa_prim usage

Faith Ekstrand requested to merge gfxstrand/mesa:shader-info-prim into main

What does this MR do and why?

There's a lot of history in our usage of primitive enums in the compiler. The GLSL compiler has historically used the GL enums for everything which was fine when we were just doing #include <GL/gl.h> everywhere. However, this isn't Vulkan driver friendly and so we started using SHADER_PRIM_* a bunch of places. This was later combined with PIPE_PRIM_* into MESA_PRIM_* in !23369 (merged). Unfortunately, we're still using uint16_t and GLenum for it a bunch of places and assuming that it matches the GL enums. A few back-end compilers are even using the old GL names due to history.

This MR attempts to clean up this mess. Afterwards, as far as I can tell the only compiler component using the GL enums is the GLSL compiler and only for the AST. Once we translate to shader info, everything is in terms of enum mesa_prim.

There's also some helpers kicking about to get the number of vertices for a primitive type. This MR combines three of them into one.

Merge request reports