[Mesa-dev] [PATCH 03/17] i965/fs: Move c->last_scratch into fs_visitor.
Kenneth Graunke
kenneth at whitecape.org
Thu May 15 23:19:34 PDT 2014
Nothing outside of fs_visitor uses it, so we may as well keep it
internal.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++--
src/mesa/drivers/dri/i965/brw_fs.h | 3 +++
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 4 ++--
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 1 +
src/mesa/drivers/dri/i965/brw_wm.h | 2 --
5 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index ea3c8de..7db5a45 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3093,8 +3093,8 @@ fs_visitor::run()
if (!allocated_without_spills)
schedule_instructions(SCHEDULE_POST);
- if (c->last_scratch > 0) {
- c->prog_data.total_scratch = brw_get_scratch_size(c->last_scratch);
+ if (last_scratch > 0) {
+ c->prog_data.total_scratch = brw_get_scratch_size(last_scratch);
}
if (dispatch_width == 8)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 053046b..4c8ed72 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -511,6 +511,9 @@ public:
/** Number of uniform variable components visited. */
unsigned uniforms;
+ /** Byte-offset for the next available spot in the scratch space buffer. */
+ unsigned last_scratch;
+
/**
* Array mapping UNIFORM register numbers to the pull parameter index,
* or -1 if this uniform register isn't being uploaded as a pull constant.
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index f2f158e..f51f0b8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -647,7 +647,7 @@ fs_visitor::spill_reg(int spill_reg)
{
int reg_size = dispatch_width * sizeof(float);
int size = virtual_grf_sizes[spill_reg];
- unsigned int spill_offset = c->last_scratch;
+ unsigned int spill_offset = last_scratch;
assert(ALIGN(spill_offset, 16) == spill_offset); /* oword read/write req. */
int spill_base_mrf = dispatch_width > 8 ? 13 : 14;
@@ -672,7 +672,7 @@ fs_visitor::spill_reg(int spill_reg)
spilled_any_registers = true;
}
- c->last_scratch += size * reg_size;
+ last_scratch += size * reg_size;
/* Generate spill/unspill instructions for the objects being
* spilled. Right now, we spill or unspill the whole thing to a
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index d2dc5fa..307d07b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2986,6 +2986,7 @@ fs_visitor::fs_visitor(struct brw_context *brw,
this->regs_live_at_ip = NULL;
this->uniforms = 0;
+ this->last_scratch = 0;
this->pull_constant_loc = NULL;
this->push_constant_loc = NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index 9dfb23b..871e34e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -94,8 +94,6 @@ struct brw_wm_compile {
uint8_t nr_payload_regs;
GLuint source_depth_to_render_target:1;
GLuint runtime_check_aads_emit:1;
-
- GLuint last_scratch;
};
/**
--
1.9.2
More information about the mesa-dev
mailing list