nir: Add a pass for selectively lowering variables to scratch space

This commit adds new nir_load/store_scratch opcodes which read and write
a virtual scratch space.  It's up to the back-end to figure out what to
do with it and where to put the actual scratch data.

v2: Drop const_index comments (by anholt)

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Jason Ekstrand
2016-12-02 11:36:42 -08:00
committed by Eric Anholt
parent 8a2d91e124
commit 18ed82b084
9 changed files with 216 additions and 1 deletions

View File

@@ -2359,6 +2359,9 @@ typedef struct nir_shader {
*/
unsigned num_inputs, num_uniforms, num_outputs, num_shared;
/** Size in bytes of required scratch space */
unsigned scratch_size;
/** Constant data associated with this shader.
*
* Constant data is loaded through load_constant intrinsics. See also
@@ -3012,6 +3015,11 @@ void nir_lower_io_to_temporaries(nir_shader *shader,
nir_function_impl *entrypoint,
bool outputs, bool inputs);
bool nir_lower_vars_to_scratch(nir_shader *shader,
nir_variable_mode modes,
int size_threshold,
glsl_type_size_align_func size_align);
void nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint);
void nir_assign_var_locations(struct exec_list *var_list, unsigned *size,