aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2013-12-12 15:08:59 +0200
committerTapani Pälli <[email protected]>2013-12-12 17:28:11 +0200
commit447bb9029f7e03b03e507053b9f63536d8fc74ac (patch)
treecda0ab8ca2637995300aa4544e0cf733bfead1da /src/mesa
parent33ee2c67c0a4e8f2fefbf37dacabd14918060af5 (diff)
glsl: move variables in to ir_variable::data, part II
This patch moves following bitfields and variables to the data structure: explicit_location, explicit_index, explicit_binding, has_initializer, is_unmatched_generic_inout, location_frac, from_named_ifc_block_nonarray, from_named_ifc_block_array, depth_layout, location, index, binding, max_array_access, atomic Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_fp.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp28
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp16
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp2
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp8
-rw-r--r--src/mesa/main/shader_query.cpp24
-rw-r--r--src/mesa/program/ir_to_mesa.cpp14
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp13
9 files changed, 55 insertions, 54 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 281920324aa..63b005e33c0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1049,7 +1049,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
glsl_interp_qualifier interpolation_mode =
ir->determine_interpolation_mode(c->key.flat_shade);
- int location = ir->location;
+ int location = ir->data.location;
for (unsigned int i = 0; i < array_elements; i++) {
for (unsigned int j = 0; j < type->matrix_columns; j++) {
if (c->prog_data.urb_setup[location] == -1) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
index dbf201756a4..f8577c1f444 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
@@ -608,7 +608,7 @@ fs_visitor::setup_fp_regs()
ir_variable *ir = new(mem_ctx) ir_variable(glsl_type::vec4_type,
"fp_input",
ir_var_shader_in);
- ir->location = i;
+ ir->data.location = i;
this->current_annotation = ralloc_asprintf(ctx, "interpolate input %d",
i);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 763c0ae2eea..47cf71e3c53 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -70,24 +70,24 @@ fs_visitor::visit(ir_variable *ir)
} else if (ir->data.mode == ir_var_shader_out) {
reg = new(this->mem_ctx) fs_reg(this, ir->type);
- if (ir->index > 0) {
- assert(ir->location == FRAG_RESULT_DATA0);
- assert(ir->index == 1);
+ if (ir->data.index > 0) {
+ assert(ir->data.location == FRAG_RESULT_DATA0);
+ assert(ir->data.index == 1);
this->dual_src_output = *reg;
- } else if (ir->location == FRAG_RESULT_COLOR) {
+ } else if (ir->data.location == FRAG_RESULT_COLOR) {
/* Writing gl_FragColor outputs to all color regions. */
for (unsigned int i = 0; i < MAX2(c->key.nr_color_regions, 1); i++) {
this->outputs[i] = *reg;
this->output_components[i] = 4;
}
- } else if (ir->location == FRAG_RESULT_DEPTH) {
+ } else if (ir->data.location == FRAG_RESULT_DEPTH) {
this->frag_depth = *reg;
- } else if (ir->location == FRAG_RESULT_SAMPLE_MASK) {
+ } else if (ir->data.location == FRAG_RESULT_SAMPLE_MASK) {
this->sample_mask = *reg;
} else {
/* gl_FragData or a user-defined FS output */
- assert(ir->location >= FRAG_RESULT_DATA0 &&
- ir->location < FRAG_RESULT_DATA0 + BRW_MAX_DRAW_BUFFERS);
+ assert(ir->data.location >= FRAG_RESULT_DATA0 &&
+ ir->data.location < FRAG_RESULT_DATA0 + BRW_MAX_DRAW_BUFFERS);
int vector_elements =
ir->type->is_array() ? ir->type->fields.array->vector_elements
@@ -95,7 +95,7 @@ fs_visitor::visit(ir_variable *ir)
/* General color output. */
for (unsigned int i = 0; i < MAX2(1, ir->type->length); i++) {
- int output = ir->location - FRAG_RESULT_DATA0 + i;
+ int output = ir->data.location - FRAG_RESULT_DATA0 + i;
this->outputs[output] = *reg;
this->outputs[output].reg_offset += vector_elements * i;
this->output_components[output] = vector_elements;
@@ -132,9 +132,9 @@ fs_visitor::visit(ir_variable *ir)
reg->type = brw_type_for_base_type(ir->type);
} else if (ir->data.mode == ir_var_system_value) {
- if (ir->location == SYSTEM_VALUE_SAMPLE_POS) {
+ if (ir->data.location == SYSTEM_VALUE_SAMPLE_POS) {
reg = emit_samplepos_setup(ir);
- } else if (ir->location == SYSTEM_VALUE_SAMPLE_ID) {
+ } else if (ir->data.location == SYSTEM_VALUE_SAMPLE_ID) {
reg = emit_sampleid_setup(ir);
}
}
@@ -2219,7 +2219,7 @@ fs_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
ir->actual_parameters.get_head());
ir_variable *location = deref->variable_referenced();
unsigned surf_index = (c->prog_data.base.binding_table.abo_start +
- location->atomic.buffer_index);
+ location->data.atomic.buffer_index);
/* Calculate the surface offset */
fs_reg offset(this, glsl_type::uint_type);
@@ -2230,9 +2230,9 @@ fs_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
fs_reg tmp(this, glsl_type::uint_type);
emit(MUL(tmp, this->result, ATOMIC_COUNTER_SIZE));
- emit(ADD(offset, tmp, location->atomic.offset));
+ emit(ADD(offset, tmp, location->data.atomic.offset));
} else {
- offset = location->atomic.offset;
+ offset = location->data.atomic.offset;
}
/* Emit the appropriate machine instruction */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 0d8135c8d8f..3b8cef69a7e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -947,18 +947,18 @@ vec4_visitor::visit(ir_variable *ir)
switch (ir->data.mode) {
case ir_var_shader_in:
- reg = new(mem_ctx) dst_reg(ATTR, ir->location);
+ reg = new(mem_ctx) dst_reg(ATTR, ir->data.location);
break;
case ir_var_shader_out:
reg = new(mem_ctx) dst_reg(this, ir->type);
for (int i = 0; i < type_size(ir->type); i++) {
- output_reg[ir->location + i] = *reg;
- output_reg[ir->location + i].reg_offset = i;
- output_reg[ir->location + i].type =
+ output_reg[ir->data.location + i] = *reg;
+ output_reg[ir->data.location + i].reg_offset = i;
+ output_reg[ir->data.location + i].type =
brw_type_for_base_type(ir->type->get_scalar_type());
- output_reg_annotation[ir->location + i] = ir->name;
+ output_reg_annotation[ir->data.location + i] = ir->name;
}
break;
@@ -2163,7 +2163,7 @@ vec4_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
ir->actual_parameters.get_head());
ir_variable *location = deref->variable_referenced();
unsigned surf_index = (prog_data->base.binding_table.abo_start +
- location->atomic.buffer_index);
+ location->data.atomic.buffer_index);
/* Calculate the surface offset */
src_reg offset(this, glsl_type::uint_type);
@@ -2173,9 +2173,9 @@ vec4_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
src_reg tmp(this, glsl_type::uint_type);
emit(MUL(dst_reg(tmp), this->result, ATOMIC_COUNTER_SIZE));
- emit(ADD(dst_reg(offset), tmp, location->atomic.offset));
+ emit(ADD(dst_reg(offset), tmp, location->data.atomic.offset));
} else {
- offset = location->atomic.offset;
+ offset = location->data.atomic.offset;
}
/* Emit the appropriate machine instruction */
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 31c42c49082..0146cf9beab 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -153,7 +153,7 @@ vec4_vs_visitor::make_reg_for_system_value(ir_variable *ir)
dst_reg *reg = new(mem_ctx) dst_reg(ATTR, VERT_ATTRIB_MAX);
vs_prog_data->uses_vertexid = true;
- switch (ir->location) {
+ switch (ir->data.location) {
case SYSTEM_VALUE_VERTEX_ID:
reg->writemask = WRITEMASK_X;
break;
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 0d75702835e..ad004acb617 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -543,7 +543,7 @@ get_current_attrib(texenv_fragment_program *p, GLuint attrib)
ir_rvalue *val;
current = p->shader->symbols->get_variable("gl_CurrentAttribFragMESA");
- current->max_array_access = MAX2(current->max_array_access, attrib);
+ current->data.max_array_access = MAX2(current->data.max_array_access, attrib);
val = new(p->mem_ctx) ir_dereference_variable(current);
ir_rvalue *index = new(p->mem_ctx) ir_constant(attrib);
return new(p->mem_ctx) ir_dereference_array(val, index);
@@ -587,7 +587,7 @@ get_source(texenv_fragment_program *p,
var = p->shader->symbols->get_variable("gl_TextureEnvColor");
assert(var);
deref = new(p->mem_ctx) ir_dereference_variable(var);
- var->max_array_access = MAX2(var->max_array_access, unit);
+ var->data.max_array_access = MAX2(var->data.max_array_access, unit);
return new(p->mem_ctx) ir_dereference_array(deref,
new(p->mem_ctx) ir_constant(unit));
@@ -927,7 +927,7 @@ static void load_texture( texenv_fragment_program *p, GLuint unit )
texcoord = new(p->mem_ctx) ir_dereference_variable(tc_array);
ir_rvalue *index = new(p->mem_ctx) ir_constant(unit);
texcoord = new(p->mem_ctx) ir_dereference_array(texcoord, index);
- tc_array->max_array_access = MAX2(tc_array->max_array_access, unit);
+ tc_array->data.max_array_access = MAX2(tc_array->data.max_array_access, unit);
}
if (!p->state->unit[unit].enabled) {
@@ -1103,7 +1103,7 @@ load_texunit_bumpmap( texenv_fragment_program *p, GLuint unit )
texcoord = new(p->mem_ctx) ir_dereference_variable(tc_array);
ir_rvalue *index = new(p->mem_ctx) ir_constant(bumpedUnitNr);
texcoord = new(p->mem_ctx) ir_dereference_array(texcoord, index);
- tc_array->max_array_access = MAX2(tc_array->max_array_access, unit);
+ tc_array->data.max_array_access = MAX2(tc_array->data.max_array_access, unit);
load_texenv_source( p, unit + SRC_TEXTURE0, unit );
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 6db29d803ab..f14e1a562a7 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -107,7 +107,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
if (var == NULL
|| var->data.mode != ir_var_shader_in
- || var->location == -1)
+ || var->data.location == -1)
continue;
if (current_index == desired_index) {
@@ -170,12 +170,12 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
*/
if (var == NULL
|| var->data.mode != ir_var_shader_in
- || var->location == -1
- || var->location < VERT_ATTRIB_GENERIC0)
+ || var->data.location == -1
+ || var->data.location < VERT_ATTRIB_GENERIC0)
continue;
if (strcmp(var->name, name) == 0)
- return var->location - VERT_ATTRIB_GENERIC0;
+ return var->data.location - VERT_ATTRIB_GENERIC0;
}
return -1;
@@ -198,7 +198,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
if (var == NULL
|| var->data.mode != ir_var_shader_in
- || var->location == -1)
+ || var->data.location == -1)
continue;
i++;
@@ -224,7 +224,7 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
if (var == NULL
|| var->data.mode != ir_var_shader_in
- || var->location == -1)
+ || var->data.location == -1)
continue;
const size_t len = strlen(var->name);
@@ -334,12 +334,12 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar *name)
*/
if (var == NULL
|| var->data.mode != ir_var_shader_out
- || var->location == -1
- || var->location < FRAG_RESULT_DATA0)
+ || var->data.location == -1
+ || var->data.location < FRAG_RESULT_DATA0)
continue;
if (strcmp(var->name, name) == 0)
- return var->index;
+ return var->data.index;
}
return -1;
@@ -390,12 +390,12 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar *name)
*/
if (var == NULL
|| var->data.mode != ir_var_shader_out
- || var->location == -1
- || var->location < FRAG_RESULT_DATA0)
+ || var->data.location == -1
+ || var->data.location < FRAG_RESULT_DATA0)
continue;
if (strcmp(var->name, name) == 0)
- return var->location - FRAG_RESULT_DATA0;
+ return var->data.location - FRAG_RESULT_DATA0;
}
return -1;
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 1f841efd101..23d479c32d6 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1531,7 +1531,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
switch (var->data.mode) {
case ir_var_uniform:
entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM,
- var->location);
+ var->data.location);
this->variables.push_tail(entry);
break;
case ir_var_shader_in:
@@ -1540,21 +1540,21 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
* user-assigned generic attributes (glBindVertexLocation),
* and user-defined varyings.
*/
- assert(var->location != -1);
+ assert(var->data.location != -1);
entry = new(mem_ctx) variable_storage(var,
PROGRAM_INPUT,
- var->location);
+ var->data.location);
break;
case ir_var_shader_out:
- assert(var->location != -1);
+ assert(var->data.location != -1);
entry = new(mem_ctx) variable_storage(var,
PROGRAM_OUTPUT,
- var->location);
+ var->data.location);
break;
case ir_var_system_value:
entry = new(mem_ctx) variable_storage(var,
PROGRAM_SYSTEM_VALUE,
- var->location);
+ var->data.location);
break;
case ir_var_auto:
case ir_var_temporary:
@@ -2404,7 +2404,7 @@ public:
this->idx = -1;
this->program_resource_visitor::process(var);
- var->location = this->idx;
+ var->data.location = this->idx;
}
private:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index befa6d45e4b..1331c73dc30 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2023,7 +2023,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
switch (var->data.mode) {
case ir_var_uniform:
entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM,
- var->location);
+ var->data.location);
this->variables.push_tail(entry);
break;
case ir_var_shader_in:
@@ -2032,21 +2032,22 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
* generic attributes (glBindVertexLocation), and
* user-defined varyings.
*/
- assert(var->location != -1);
+ assert(var->data.location != -1);
entry = new(mem_ctx) variable_storage(var,
PROGRAM_INPUT,
- var->location);
+ var->data.location);
break;
case ir_var_shader_out:
- assert(var->location != -1);
+ assert(var->data.location != -1);
entry = new(mem_ctx) variable_storage(var,
PROGRAM_OUTPUT,
- var->location + var->index);
+ var->data.location
+ + var->data.index);
break;
case ir_var_system_value:
entry = new(mem_ctx) variable_storage(var,
PROGRAM_SYSTEM_VALUE,
- var->location);
+ var->data.location);
break;
case ir_var_auto:
case ir_var_temporary: