summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-09-12 17:30:53 +1000
committerTimothy Arceri <[email protected]>2017-09-26 22:37:02 +1000
commit348cf74792a394aae1efd541192d4a3c219584bb (patch)
tree101e884fa612977ed40edb1b8262feacbc9bcd4c /src/mesa/drivers
parent45ef10c06a3010a0710f9db3e980fde545157b6a (diff)
i965: create a brw_shader_gather_info() helper
This will help us call gather info at a later point and allow us to do some linking in nir. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c20
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.h3
2 files changed, 16 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index fa0ce838fa0..a1154d95e0d 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -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
diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h
index e62b7d366c8..c52193c691c 100644
--- a/src/mesa/drivers/dri/i965/brw_program.h
+++ b/src/mesa/drivers/dri/i965/brw_program.h
@@ -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);