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 <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand 2015-09-30 17:01:03 -07:00
parent ea006c4cb5
commit 30c6357113
6 changed files with 26 additions and 17 deletions

View 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));

View 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())

View 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);

View 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())

View 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;

View 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,