[Mesa-dev] [PATCH 4/6] i965/vec4: Move c->last_scratch into vec4_visitor.
Kenneth Graunke
kenneth at whitecape.org
Wed Jul 1 15:03:34 PDT 2015
Nothing outside of vec4_visitor uses it, so we may as well keep it
internal.
Commit db9c915abcc5ad78d2d11d0e732f04cc94631350 for the vec4 backend.
(The empty class will be going away soon.)
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_vec4.cpp | 4 ++--
src/mesa/drivers/dri/i965/brw_vec4.h | 8 ++------
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h | 1 -
src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 17 ++++++++---------
src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_vs.h | 1 -
8 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 7b367ec..e5db268 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -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
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 043557b..3643651 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -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 */
};
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 80c59af..2f948ee 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -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)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index e48d861..e51399d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
index 555c42e..cd89edd 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
@@ -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) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 21d9b01..c9c2661 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
index eed4d6d..35b601a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -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 */,
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index a15cba0..3a131b0 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -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;
--
2.4.4
More information about the mesa-dev
mailing list