[naga spv-out] Bounds check generation could be cleaner and smarter #6345
Labels
area: naga back-end
Outputs of naga shader conversion
kind: refactor
Making existing function faster or nicer
lang: SPIR-V
Vulkan's Shading Language
naga
Shader Translator
naga::back::spv::index::BoundsCheckResult
doesn't really cover all the outcomes that it could, and as a result the code is less clear than it ought to be.When the backend encounters an indexing operation that needs a bounds check applied, logically there are four possible outcomes:
i
...At the moment, the "statically known to be out of bounds" case is absent from
BoundsCheckResult
and the code that produces it, which makes it look weird. If the code simply took each of the above cases in turn, I think it would be easier to follow, and produce (marginally) better code.The text was updated successfully, but these errors were encountered: