i965/nir: Lower nir compute shader shared variables
authorJordan Justen <jordan.l.justen@intel.com>
Mon, 18 Jan 2016 17:45:46 +0000 (09:45 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 17 Mar 2016 08:23:40 +0000 (01:23 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_nir.c
src/mesa/drivers/dri/i965/brw_nir.h

index 86d2bd92726e68ee15648e20a9d0a574a31c5ac6..eaff9535c2286b859bd490dcd72467dcb76e9c91 100644 (file)
@@ -5739,6 +5739,8 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,
    nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
    shader = brw_nir_apply_sampler_key(shader, compiler->devinfo, &key->tex,
                                       true);
+   brw_nir_lower_cs_shared(shader);
+   prog_data->base.total_shared += shader->num_shared;
    shader = brw_postprocess_nir(shader, compiler->devinfo, true);
 
    prog_data->local_size[0] = shader->info.cs.local_size[0];
index a5949d5d6eb65d13907c1cb0a369f95af32c6233..24350460466e2c12fc03fee7bf474d0907cd4304 100644 (file)
@@ -377,6 +377,14 @@ brw_nir_lower_uniforms(nir_shader *nir, bool is_scalar)
    }
 }
 
+void
+brw_nir_lower_cs_shared(nir_shader *nir)
+{
+   nir_assign_var_locations(&nir->shared, &nir->num_shared,
+                            type_size_scalar_bytes);
+   nir_lower_io(nir, nir_var_shared, type_size_scalar_bytes);
+}
+
 #define OPT(pass, ...) ({                                  \
    bool this_progress = false;                             \
    NIR_PASS(this_progress, nir, pass, ##__VA_ARGS__);      \
index 2d8341fd40e175f45235e7819f89062fb975b986..440b4ceb6696d1a5cd1a5751635941325a8e4a73 100644 (file)
@@ -95,6 +95,7 @@ void brw_nir_lower_fs_inputs(nir_shader *nir);
 void brw_nir_lower_vue_outputs(nir_shader *nir, bool is_scalar);
 void brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue);
 void brw_nir_lower_fs_outputs(nir_shader *nir);
+void brw_nir_lower_cs_shared(nir_shader *nir);
 
 nir_shader *brw_postprocess_nir(nir_shader *nir,
                                 const struct brw_device_info *devinfo,