[Mesa-dev] [RFC PATCH 30/40] i965/fs: Append ir_binop_ubo_load entries to the gather table
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Sun Jan 4 06:04:44 PST 2015
At the moment, this is only possible if the const block and offset are
immediate values (constants). Otherwise just fall-back to the previous
method of uploading the UBO constant data to GRF using pull constants.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
src/mesa/drivers/dri/i965/brw_context.h | 3 +++
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 24 ++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 8eddc54..9877126 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -347,6 +347,7 @@ struct brw_stage_prog_data {
GLuint nr_params; /**< number of float params/constants */
GLuint nr_pull_params;
+ GLuint nr_ubo_params;
GLuint nr_gather_table;
unsigned curb_read_length;
@@ -371,6 +372,8 @@ struct brw_stage_prog_data {
struct {
int reg;
unsigned channel_mask;
+ unsigned const_block;
+ unsigned const_offset;
} gather_table[128]; /** equal to max_push_components */
};
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 2f592c9..c0499b6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1077,6 +1077,30 @@ fs_visitor::visit(ir_expression *ir)
*/
ir_constant *const_uniform_block = ir->operands[0]->as_constant();
ir_constant *const_offset = ir->operands[1]->as_constant();
+
+ /* Use gather push constants if at all possible, otherwise just
+ * fall back to pull constants for UBOs
+ */
+ bool use_gather = (brw->has_resource_streamer && brw->use_gather_constants);
+ int param_index = uniforms + ubo_uniforms;
+ if (use_gather && const_uniform_block && const_offset) {
+
+ fs_reg reg(UNIFORM, param_index);
+ reg.type = brw_type_for_base_type(ir->type);
+
+ result = reg;
+ ubo_uniforms += ir->type->vector_elements;
+
+ int gather = stage_prog_data->nr_gather_table++;
+ stage_prog_data->gather_table[gather].reg = reg.reg;
+ stage_prog_data->gather_table[gather].const_block =
+ const_uniform_block->value.u[0];
+ stage_prog_data->gather_table[gather].const_offset =
+ const_offset->value.u[0];
+
+ break;
+ }
+
fs_reg surf_index;
if (const_uniform_block) {
--
1.9.1
More information about the mesa-dev
mailing list