nir: Always create UBO variable when lowering uniforms to ubo
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
Fri, 14 Feb 2020 07:14:07 +0000 (02:14 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 5 May 2020 09:17:51 +0000 (09:17 +0000)
commit4777ee1a62f0620efa2a105215eb589fc44dfa0f
treeffbff00639a493a9453557a9e38cf6375b79b483
parent354474b9e5a9e9fdbba1b113f36d7d119d4187c0
nir: Always create UBO variable when lowering uniforms to ubo

Zink needs to know the sizes of UBOs, and for normal UBOs we get this
from the nir_var_mem_ubo variables. This allows us to treat all of these
the same way.

We're about to need the same information for the in-progress D3D12
driver, so let's do this in a central location instead of in the driver.

This version is also a bit more careful than the Zink version. In
particular, for two reasons:
1. We increase the variable bindings when we adjust the pre-existing
   UBOs.
2. We increase shader->info.num_ubos when we insert a new UBO variable.

Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4734>
src/compiler/nir/nir_lower_uniforms_to_ubo.c