aco: Use strong typing to model SW<->HW stage mappings
ACO currently uses a uint16_t
mask to encode the set of SW shader stages that run on a given HW stage. This patch refactors ACO to use a dedicated data type along with a more expressive API to check which stages are enabled.
Rational:
- This cleans up some of the stage checks significantly and has a more accessible interface overall (e.g.
ctx->stage & hw_vs
is turned into the semantically clearerctx->stage.hw == HWStage::VS
) - SWStage and HWStage flags are distinct types now and hence cannot accidentally be mixed up anymore
There is some nitpicking to be done:
- Should the name
SWStage
be changed to highlight that it's a mask? HWStage and SWStage sound symmetric but aren't, since HWStage is always one specific value whereas an SWStage object can hold multiple flags (or none). Perhaps the namesSWStages
orSWStageMask
are more appropriate? - Should SWStage/HWStage be renamed to something shorter? I'm leaning towards not changing them for lack of a good alternative, but @Venemo was averse to the redundancy in
stage.has(SWStage::VS)
.
Thanks to @Venemo for reviewing an early version of this patch set (neobrain/mesa@cfd25d87).