diff options
author | Jason Ekstrand <[email protected]> | 2015-09-30 17:01:03 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-10-02 14:22:53 -0700 |
commit | 30c63571133ed50907ec14172c2f3ef82ee8a34e (patch) | |
tree | e650f0c863422dd22d38cc37f6326c1f3be5214a | |
parent | ea006c4cb5eb2d98d6bfd5a6c32fcae10b636f17 (diff) |
i965: Move prog_data uniform setup to the codegen level
As of now, uniform setup is more-or-less unified between vec4 and fs and no
longer requires the fs_visitor. This makes uniform setup more of a
language/API thing than a backend compiler thing. This commit moves
setting up the stage_prog_data.params arrays to the same place as we set up
the rest of stage_prog_data.
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cs.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 10 |
6 files changed, 26 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c index 18579629b3d..6b64030a868 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -30,7 +30,7 @@ #include "intel_mipmap_tree.h" #include "brw_state.h" #include "intel_batchbuffer.h" -#include "glsl/nir/nir.h" +#include "brw_nir.h" static void assign_cs_binding_table_offsets(const struct brw_device_info *devinfo, @@ -89,6 +89,9 @@ brw_codegen_cs_prog(struct brw_context *brw, prog_data.base.nr_params = param_count; prog_data.base.nr_image_params = cs->base.NumImages; + brw_nir_setup_glsl_uniforms(cp->program.Base.nir, prog, &cp->program.Base, + &prog_data.base, true); + if (unlikely(brw->perf_debug)) { start_busy = (brw->batch.last_bo && drm_intel_bo_busy(brw->batch.last_bo)); diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index eb0fe7b2856..d70c672e20d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -182,13 +182,6 @@ fs_visitor::nir_setup_uniforms(nir_shader *shader) uniforms = shader->num_uniforms; - if (shader_prog) { - brw_nir_setup_glsl_uniforms(shader, shader_prog, prog, - stage_prog_data, true); - } else { - brw_nir_setup_arb_uniforms(shader, prog, stage_prog_data); - } - foreach_list_typed(nir_variable, var, node, &shader->uniforms) { /* UBO's and atomics don't take up space in the uniform file */ if (var->interface_type != NULL || var->type->contains_atomic()) diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index cfed35c56a5..f6b9874f78a 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -32,7 +32,7 @@ #include "brw_vec4_gs_visitor.h" #include "brw_state.h" #include "brw_ff_gs.h" -#include "glsl/nir/nir.h" +#include "brw_nir.h" static void assign_gs_binding_table_offsets(const struct brw_device_info *devinfo, @@ -91,6 +91,9 @@ brw_codegen_gs_prog(struct brw_context *brw, c.prog_data.base.base.nr_params = param_count; c.prog_data.base.base.nr_image_params = gs->NumImages; + brw_nir_setup_glsl_uniforms(gp->program.Base.nir, prog, &gp->program.Base, + &c.prog_data.base.base, false); + if (brw->gen >= 8) { c.prog_data.static_vertex_count = !gp->program.Base.nir ? -1 : nir_gs_count_vertices(gp->program.Base.nir); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 8274d4842e8..41667eb60bf 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -136,13 +136,6 @@ vec4_visitor::nir_setup_uniforms(nir_shader *shader) { uniforms = shader->num_uniforms; - if (shader_prog) { - brw_nir_setup_glsl_uniforms(shader, shader_prog, prog, - stage_prog_data, false); - } else { - brw_nir_setup_arb_uniforms(shader, prog, stage_prog_data); - } - foreach_list_typed(nir_variable, var, node, &shader->uniforms) { /* UBO's and atomics don't take up space in the uniform file */ if (var->interface_type != NULL || var->type->contains_atomic()) diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 86078256d63..3c6ee0a7a03 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -135,6 +135,15 @@ brw_codegen_vs_prog(struct brw_context *brw, stage_prog_data->nr_image_params); stage_prog_data->nr_params = param_count; + if (prog) { + brw_nir_setup_glsl_uniforms(vp->program.Base.nir, prog, &vp->program.Base, + &prog_data.base.base, + brw->intelScreen->compiler->scalar_vs); + } else { + brw_nir_setup_arb_uniforms(vp->program.Base.nir, &vp->program.Base, + &prog_data.base.base); + } + GLbitfield64 outputs_written = vp->program.Base.OutputsWritten; prog_data.inputs_read = vp->program.Base.InputsRead; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 69e4aecd2d2..13139144f89 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -35,7 +35,7 @@ #include "program/prog_parameter.h" #include "program/program.h" #include "intel_mipmap_tree.h" -#include "glsl/nir/nir.h" +#include "brw_nir.h" #include "util/ralloc.h" @@ -211,6 +211,14 @@ brw_codegen_wm_prog(struct brw_context *brw, prog_data.base.nr_image_params); prog_data.base.nr_params = param_count; + if (prog) { + brw_nir_setup_glsl_uniforms(fp->program.Base.nir, prog, &fp->program.Base, + &prog_data.base, true); + } else { + brw_nir_setup_arb_uniforms(fp->program.Base.nir, &fp->program.Base, + &prog_data.base); + } + prog_data.barycentric_interp_modes = brw_compute_barycentric_interp_modes(brw, key->flat_shade, key->persample_shading, |