summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2014-05-14 19:47:28 -0700
committerIan Romanick <[email protected]>2014-09-30 13:34:42 -0700
commit5aa8d8194c4975876276a9c57cdd672978a491ad (patch)
tree700e5fdf988b1b1e0125c0ab2cc19da39e527db0 /src/mesa
parent21df0169028d600b17ab73795da2838e92ba9038 (diff)
glsl: Make ir_variable::num_state_slots and ir_variable::state_slots private
Also move num_state_slots inside ir_variable_data for better packing. The payoff for this will come in a few more patches. No change Valgrind massif results for a trimmed apitrace of dota2. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp6
-rw-r--r--src/mesa/program/ir_to_mesa.cpp14
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp14
5 files changed, 23 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 6ed3e95ef6e..ab4ee34b41c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1177,10 +1177,10 @@ fs_visitor::setup_uniform_values(ir_variable *ir)
void
fs_visitor::setup_builtin_uniform_values(ir_variable *ir)
{
- const ir_state_slot *const slots = ir->state_slots;
- assert(ir->state_slots != NULL);
+ const ir_state_slot *const slots = ir->get_state_slots();
+ assert(slots != NULL);
- for (unsigned int i = 0; i < ir->num_state_slots; i++) {
+ for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) {
/* This state reference has already been setup by ir_to_mesa, but we'll
* get the same index back here.
*/
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 4f58f2865e1..6e17beb16c4 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -220,10 +220,10 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
|| (strncmp(var->name, "gl_", 3) != 0))
continue;
- const ir_state_slot *const slots = var->state_slots;
- assert(var->state_slots != NULL);
+ const ir_state_slot *const slots = var->get_state_slots();
+ assert(slots != NULL);
- for (unsigned int i = 0; i < var->num_state_slots; i++) {
+ for (unsigned int i = 0; i < var->get_num_state_slots(); i++) {
_mesa_add_state_reference(prog->Parameters,
(gl_state_index *) slots[i].tokens);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index f03cf4f1f67..ef923ddcc03 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -745,10 +745,10 @@ vec4_visitor::setup_uniform_clipplane_values()
void
vec4_visitor::setup_builtin_uniform_values(ir_variable *ir)
{
- const ir_state_slot *const slots = ir->state_slots;
- assert(ir->state_slots != NULL);
+ const ir_state_slot *const slots = ir->get_state_slots();
+ assert(slots != NULL);
- for (unsigned int i = 0; i < ir->num_state_slots; i++) {
+ for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) {
/* This state reference has already been setup by ir_to_mesa,
* but we'll get the same index back here. We can reference
* ParameterValues directly, since unlike brw_fs.cpp, we never
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 293fe34b9e4..b3e04d7b605 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -682,8 +682,8 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
if (ir->data.mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
unsigned int i;
- const ir_state_slot *const slots = ir->state_slots;
- assert(ir->state_slots != NULL);
+ const ir_state_slot *const slots = ir->get_state_slots();
+ assert(slots != NULL);
/* Check if this statevar's setup in the STATE file exactly
* matches how we'll want to reference it as a
@@ -691,7 +691,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
* temporary storage and hope that it'll get copy-propagated
* out.
*/
- for (i = 0; i < ir->num_state_slots; i++) {
+ for (i = 0; i < ir->get_num_state_slots(); i++) {
if (slots[i].swizzle != SWIZZLE_XYZW) {
break;
}
@@ -699,7 +699,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
variable_storage *storage;
dst_reg dst;
- if (i == ir->num_state_slots) {
+ if (i == ir->get_num_state_slots()) {
/* We'll set the index later. */
storage = new(mem_ctx) variable_storage(ir, PROGRAM_STATE_VAR, -1);
this->variables.push_tail(storage);
@@ -710,7 +710,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
* of the type. However, this had better match the number of state
* elements that we're going to copy into the new temporary.
*/
- assert((int) ir->num_state_slots == type_size(ir->type));
+ assert((int) ir->get_num_state_slots() == type_size(ir->type));
storage = new(mem_ctx) variable_storage(ir, PROGRAM_TEMPORARY,
this->next_temp);
@@ -721,7 +721,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
}
- for (unsigned int i = 0; i < ir->num_state_slots; i++) {
+ for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) {
int index = _mesa_add_state_reference(this->prog->Parameters,
(gl_state_index *)slots[i].tokens);
@@ -741,7 +741,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
}
if (storage->file == PROGRAM_TEMPORARY &&
- dst.index != storage->index + (int) ir->num_state_slots) {
+ dst.index != storage->index + (int) ir->get_num_state_slots()) {
linker_error(this->shader_program,
"failed to load builtin uniform `%s' "
"(%d/%d regs loaded)\n",
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 57f43a67c5d..a0da9f6353c 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1072,8 +1072,8 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
if (ir->data.mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
unsigned int i;
- const ir_state_slot *const slots = ir->state_slots;
- assert(ir->state_slots != NULL);
+ const ir_state_slot *const slots = ir->get_state_slots();
+ assert(slots != NULL);
/* Check if this statevar's setup in the STATE file exactly
* matches how we'll want to reference it as a
@@ -1081,7 +1081,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
* temporary storage and hope that it'll get copy-propagated
* out.
*/
- for (i = 0; i < ir->num_state_slots; i++) {
+ for (i = 0; i < ir->get_num_state_slots(); i++) {
if (slots[i].swizzle != SWIZZLE_XYZW) {
break;
}
@@ -1089,7 +1089,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
variable_storage *storage;
st_dst_reg dst;
- if (i == ir->num_state_slots) {
+ if (i == ir->get_num_state_slots()) {
/* We'll set the index later. */
storage = new(mem_ctx) variable_storage(ir, PROGRAM_STATE_VAR, -1);
this->variables.push_tail(storage);
@@ -1100,7 +1100,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
* of the type. However, this had better match the number of state
* elements that we're going to copy into the new temporary.
*/
- assert((int) ir->num_state_slots == type_size(ir->type));
+ assert((int) ir->get_num_state_slots() == type_size(ir->type));
dst = st_dst_reg(get_temp(ir->type));
@@ -1110,7 +1110,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
}
- for (unsigned int i = 0; i < ir->num_state_slots; i++) {
+ for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) {
int index = _mesa_add_state_reference(this->prog->Parameters,
(gl_state_index *)slots[i].tokens);
@@ -1135,7 +1135,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
}
if (storage->file == PROGRAM_TEMPORARY &&
- dst.index != storage->index + (int) ir->num_state_slots) {
+ dst.index != storage->index + (int) ir->get_num_state_slots()) {
fail_link(this->shader_program,
"failed to load builtin uniform `%s' (%d/%d regs loaded)\n",
ir->name, dst.index - storage->index,