i965/vec4: Move c->last_scratch into vec4_visitor.

Nothing outside of vec4_visitor uses it, so we may as well keep it
internal.

Commit db9c915abc for the vec4 backend.

(The empty class will be going away soon.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
Kenneth Graunke
2015-06-28 21:02:15 -07:00
parent 8524deb8c8
commit 13372a0ce7
8 changed files with 15 additions and 22 deletions

View File

@@ -1846,9 +1846,9 @@ vec4_visitor::run(gl_clip_plane *clip_planes)
opt_set_dependency_control();
if (c->last_scratch > 0) {
if (last_scratch > 0) {
prog_data->base.total_scratch =
brw_get_scratch_size(c->last_scratch * REG_SIZE);
brw_get_scratch_size(last_scratch * REG_SIZE);
}
/* If any state parameters were appended, then ParameterValues could have

View File

@@ -47,10 +47,6 @@ extern "C" {
#include "glsl/ir.h"
struct brw_vec4_compile {
GLuint last_scratch; /**< measured in 32-byte (register size) units */
};
#ifdef __cplusplus
extern "C" {
#endif
@@ -78,7 +74,6 @@ class vec4_visitor : public backend_shader, public ir_visitor
public:
vec4_visitor(const struct brw_compiler *compiler,
void *log_data,
struct brw_vec4_compile *c,
struct gl_program *prog,
const struct brw_vue_prog_key *key,
struct brw_vue_prog_data *prog_data,
@@ -104,7 +99,6 @@ public:
return dst_reg(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
}
struct brw_vec4_compile * const c;
const struct brw_vue_prog_key * const key;
struct brw_vue_prog_data * const prog_data;
unsigned int sanity_param_count;
@@ -412,6 +406,8 @@ private:
const bool no_spills;
int shader_time_index;
unsigned last_scratch; /**< measured in 32-byte (register size) units */
};

View File

@@ -42,7 +42,7 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler *compiler,
bool no_spills,
int shader_time_index)
: vec4_visitor(compiler, log_data,
&c->base, &c->gp->program.Base, &c->key.base,
&c->gp->program.Base, &c->key.base,
&c->prog_data.base, prog, MESA_SHADER_GEOMETRY, mem_ctx,
no_spills, shader_time_index),
c(c)

View File

@@ -37,7 +37,6 @@
*/
struct brw_gs_compile
{
struct brw_vec4_compile base;
struct brw_gs_prog_key key;
struct brw_gs_prog_data prog_data;
struct brw_vue_map input_vue_map;

View File

@@ -339,7 +339,7 @@ void
vec4_visitor::spill_reg(int spill_reg_nr)
{
assert(alloc.sizes[spill_reg_nr] == 1);
unsigned int spill_offset = c->last_scratch++;
unsigned int spill_offset = last_scratch++;
/* Generate spill/unspill instructions for the objects being spilled. */
foreach_block_and_inst(block, vec4_instruction, inst, cfg) {

View File

@@ -3484,16 +3484,16 @@ vec4_visitor::move_grf_array_access_to_scratch()
foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
if (inst->dst.file == GRF && inst->dst.reladdr) {
if (scratch_loc[inst->dst.reg] == -1) {
scratch_loc[inst->dst.reg] = c->last_scratch;
c->last_scratch += this->alloc.sizes[inst->dst.reg];
scratch_loc[inst->dst.reg] = last_scratch;
last_scratch += this->alloc.sizes[inst->dst.reg];
}
for (src_reg *iter = inst->dst.reladdr;
iter->reladdr;
iter = iter->reladdr) {
if (iter->file == GRF && scratch_loc[iter->reg] == -1) {
scratch_loc[iter->reg] = c->last_scratch;
c->last_scratch += this->alloc.sizes[iter->reg];
scratch_loc[iter->reg] = last_scratch;
last_scratch += this->alloc.sizes[iter->reg];
}
}
}
@@ -3503,8 +3503,8 @@ vec4_visitor::move_grf_array_access_to_scratch()
iter->reladdr;
iter = iter->reladdr) {
if (iter->file == GRF && scratch_loc[iter->reg] == -1) {
scratch_loc[iter->reg] = c->last_scratch;
c->last_scratch += this->alloc.sizes[iter->reg];
scratch_loc[iter->reg] = last_scratch;
last_scratch += this->alloc.sizes[iter->reg];
}
}
}
@@ -3679,7 +3679,6 @@ vec4_visitor::resolve_bool_comparison(ir_rvalue *rvalue, src_reg *reg)
vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
void *log_data,
struct brw_vec4_compile *c,
struct gl_program *prog,
const struct brw_vue_prog_key *key,
struct brw_vue_prog_data *prog_data,
@@ -3690,7 +3689,6 @@ vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
int shader_time_index)
: backend_shader(compiler, log_data, mem_ctx,
shader_prog, prog, &prog_data->base, stage),
c(c),
key(key),
prog_data(prog_data),
sanity_param_count(0),
@@ -3698,7 +3696,8 @@ vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
first_non_payload_grf(0),
need_all_constants_in_pull_buffer(false),
no_spills(no_spills),
shader_time_index(shader_time_index)
shader_time_index(shader_time_index),
last_scratch(0)
{
this->failed = false;

View File

@@ -220,7 +220,7 @@ vec4_vs_visitor::vec4_vs_visitor(const struct brw_compiler *compiler,
int shader_time_index,
bool use_legacy_snorm_formula)
: vec4_visitor(compiler, log_data,
&vs_compile->base, &vs_compile->vp->program.Base,
&vs_compile->vp->program.Base,
&vs_compile->key.base, &vs_prog_data->base, prog,
MESA_SHADER_VERTEX,
mem_ctx, false /* no_spills */,

View File

@@ -51,7 +51,6 @@
#define BRW_ATTRIB_WA_SCALE 64 /* interpret as scaled in shader */
struct brw_vs_compile {
struct brw_vec4_compile base;
struct brw_vs_prog_key key;
struct brw_vertex_program *vp;