nir: Pass a type_size() function pointer into nir_lower_io().
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 12 Aug 2015 21:29:25 +0000 (14:29 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 25 Aug 2015 17:18:27 +0000 (10:18 -0700)
commit6c33d6bbf9b54784e4498a81c73b712dca5dd737
tree0aa1a052d8fabbf8f23f7818028b168937628a18
parenta23f82053d18c2f7d78e28551368437ded4c1a03
nir: Pass a type_size() function pointer into nir_lower_io().

Previously, there were four type_size() functions in play - the i965
compiler backend defined scalar and vec4 type_size() functions, and
nir_lower_io contained its own similar functions.

In fact, the i965 driver used nir_lower_io() and then looped over the
components using its own type_size - meaning both were in play.  The
two are /basically/ the same, but not exactly in obscure cases like
subroutines and images.

This patch removes nir_lower_io's functions, and instead makes the
driver supply a function pointer.  This gives the driver ultimate
flexibility in deciding how it wants to count things, reduces code
duplication, and improves consistency.

v2 (Jason Ekstrand):
 - One side-effect of passing in a function pointer is that nir_lower_io is
   now aware of and properly allocates space for image uniforms, allowing
   us to drop hacks in the backend

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
v2 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/nir.h
src/glsl/nir/nir_lower_io.c
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_nir.c