i965: Move prog_data uniform setup to the codegen level
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 1 Oct 2015 00:01:03 +0000 (17:01 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 2 Oct 2015 21:22:53 +0000 (14:22 -0700)
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 <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_cs.c
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_wm.c

index 18579629b3d5400432deba17a17e2ce1224e0594..6b64030a8689e7a00ffa369b036549176be53565 100644 (file)
@@ -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));
index eb0fe7b285656d299ff85d30f4674e2f7de06b08..d70c672e20d9e75e559176ba264af91720dd2c3b 100644 (file)
@@ -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())
index cfed35c56a57cab50d07196d231ca7abe1d5cacd..f6b9874f78a25c194306ece11097f3a83c537470 100644 (file)
@@ -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);
index 8274d4842e81fba24a8f45b747644042fdba7ab3..41667eb60bff4ba1046b039c7eb53875bf8b7ff1 100644 (file)
@@ -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())
index 86078256d63c8bd56e0487f41443570536e06b67..3c6ee0a7a03ba6e4ff611ac996bfb84ac42a5bb7 100644 (file)
@@ -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;
 
index 69e4aecd2d24f8988b216683fa140449ef081b70..13139144f891db7a07ee9cc38ed1c0c62c2ea2be 100644 (file)
@@ -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,