i965: create a brw_shader_gather_info() helper
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 12 Sep 2017 07:30:53 +0000 (17:30 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 26 Sep 2017 12:37:02 +0000 (22:37 +1000)
This will help us call gather info at a later point and allow us
to do some linking in nir.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_program.h

index fa0ce838fa06943ed6ff8ddbda3e8f91b2bdcd58..a1154d95e0dd60476b2eefdee74f2671365e0407 100644 (file)
@@ -107,6 +107,19 @@ brw_create_nir(struct brw_context *brw,
    NIR_PASS(progress, nir, nir_lower_system_values);
    NIR_PASS_V(nir, brw_nir_lower_uniforms, is_scalar);
 
+   brw_shader_gather_info(nir, prog);
+
+   if (shader_prog) {
+      NIR_PASS_V(nir, nir_lower_samplers, shader_prog);
+      NIR_PASS_V(nir, nir_lower_atomics, shader_prog);
+   }
+
+   return nir;
+}
+
+void
+brw_shader_gather_info(nir_shader *nir, struct gl_program *prog)
+{
    nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
 
    /* Copy the info we just generated back into the gl_program */
@@ -115,13 +128,6 @@ brw_create_nir(struct brw_context *brw,
    prog->info = nir->info;
    prog->info.name = prog_name;
    prog->info.label = prog_label;
-
-   if (shader_prog) {
-      NIR_PASS_V(nir, nir_lower_samplers, shader_prog);
-      NIR_PASS_V(nir, nir_lower_atomics, shader_prog);
-   }
-
-   return nir;
 }
 
 static unsigned
index e62b7d366c805f07fcb6c37766713db421493cba..c52193c691c37b74dc61e2101dcfdc370c66aa40 100644 (file)
@@ -25,6 +25,7 @@
 #define BRW_PROGRAM_H
 
 #include "compiler/brw_compiler.h"
+#include "nir.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -38,6 +39,8 @@ struct nir_shader *brw_create_nir(struct brw_context *brw,
                                   gl_shader_stage stage,
                                   bool is_scalar);
 
+void brw_shader_gather_info(nir_shader *nir, struct gl_program *prog);
+
 void brw_setup_tex_for_precompile(struct brw_context *brw,
                                   struct brw_sampler_prog_key_data *tex,
                                   struct gl_program *prog);