This might help: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1714/diffs?commit_id=b991b7dd54a899d0df89c809c936401baa341d9d