[Mesa-dev] [RFC PATCH 32/40] i965/fs: Pack a uniform register next to UBO uniforms
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Sun Jan 4 06:04:46 PST 2015
And vice versa. This allows us to combine UBOs and uniform registers
as push constants.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 1 +
src/mesa/drivers/dri/i965/brw_fs.h | 3 +++
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 3 ++-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0f2c2c4..d62050e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1114,6 +1114,7 @@ fs_visitor::import_uniforms(fs_visitor *v)
this->push_constant_loc = v->push_constant_loc;
this->pull_constant_loc = v->pull_constant_loc;
this->uniforms = v->uniforms;
+ this->ubo_uniforms = v->ubo_uniforms;
this->param_size = v->param_size;
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 06575a5..cec615e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -625,6 +625,9 @@ public:
/** Number of uniform variable components visited. */
unsigned uniforms;
+ /** Number of ubo uniform variable components visited. */
+ unsigned ubo_uniforms;
+
/** Byte-offset for the next available spot in the scratch space buffer. */
unsigned last_scratch;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 8e092fb..597e125 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -151,7 +151,7 @@ fs_visitor::visit(ir_variable *ir)
}
}
} else if (ir->data.mode == ir_var_uniform) {
- int param_index = uniforms;
+ int param_index = uniforms + ubo_uniforms;
/* Thanks to the lower_ubo_reference pass, we will see only
* ir_binop_ubo_load expressions and not ir_dereference_variable for UBO
@@ -3864,6 +3864,7 @@ fs_visitor::init()
this->regs_live_at_ip = NULL;
this->uniforms = 0;
+ this->ubo_uniforms = 0;
this->last_scratch = 0;
this->pull_constant_loc = NULL;
this->push_constant_loc = NULL;
--
1.9.1
More information about the mesa-dev
mailing list