diff options
author | Tapani Pälli <[email protected]> | 2013-12-12 13:51:01 +0200 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2013-12-12 17:28:08 +0200 |
commit | 33ee2c67c0a4e8f2fefbf37dacabd14918060af5 (patch) | |
tree | 4432c7acd7722bb635e1f34074278d669a0b74da /src/mesa | |
parent | c1d3080ee86cd3d914712ffe0bb533c5d6a6b271 (diff) |
glsl: move variables in to ir_variable::data, part I
This patch moves following bitfields in to the data structure:
used, assigned, how_declared, mode, interpolation,
origin_upper_left, pixel_center_integer
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.cpp | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 | ||||
-rw-r--r-- | src/mesa/main/shader_query.cpp | 12 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 10 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 18 |
10 files changed, 35 insertions, 35 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 374801fab20..281920324aa 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -952,10 +952,10 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) { fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); fs_reg wpos = *reg; - bool flip = !ir->origin_upper_left ^ c->key.render_to_fbo; + bool flip = !ir->data.origin_upper_left ^ c->key.render_to_fbo; /* gl_FragCoord.x */ - if (ir->pixel_center_integer) { + if (ir->data.pixel_center_integer) { emit(MOV(wpos, this->pixel_x)); } else { emit(ADD(wpos, this->pixel_x, fs_reg(0.5f))); @@ -963,11 +963,11 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) wpos.reg_offset++; /* gl_FragCoord.y */ - if (!flip && ir->pixel_center_integer) { + if (!flip && ir->data.pixel_center_integer) { emit(MOV(wpos, this->pixel_y)); } else { fs_reg pixel_y = this->pixel_y; - float offset = (ir->pixel_center_integer ? 0.0 : 0.5); + float offset = (ir->data.pixel_center_integer ? 0.0 : 0.5); if (flip) { pixel_y.negate = true; diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index 5aec757a9b1..dbf201756a4 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -615,8 +615,8 @@ fs_visitor::setup_fp_regs() switch (i) { case VARYING_SLOT_POS: - ir->pixel_center_integer = fp->PixelCenterInteger; - ir->origin_upper_left = fp->OriginUpperLeft; + ir->data.pixel_center_integer = fp->PixelCenterInteger; + ir->data.origin_upper_left = fp->OriginUpperLeft; fp_input_regs[i] = *emit_fragcoord_interpolation(ir); break; case VARYING_SLOT_FACE: diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index 6284b590234..ff7aa805512 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -107,7 +107,7 @@ ir_vector_reference_visitor::get_variable_entry(ir_variable *var) if (!var->type->is_vector()) return NULL; - switch (var->mode) { + switch (var->data.mode) { case ir_var_uniform: case ir_var_shader_in: case ir_var_shader_out: diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 64ff8998f7e..763c0ae2eea 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -56,7 +56,7 @@ fs_visitor::visit(ir_variable *ir) if (variable_storage(ir)) return; - if (ir->mode == ir_var_shader_in) { + if (ir->data.mode == ir_var_shader_in) { if (!strcmp(ir->name, "gl_FragCoord")) { reg = emit_fragcoord_interpolation(ir); } else if (!strcmp(ir->name, "gl_FrontFacing")) { @@ -67,7 +67,7 @@ fs_visitor::visit(ir_variable *ir) assert(reg); hash_table_insert(this->variable_ht, reg, ir); return; - } else if (ir->mode == ir_var_shader_out) { + } else if (ir->data.mode == ir_var_shader_out) { reg = new(this->mem_ctx) fs_reg(this, ir->type); if (ir->index > 0) { @@ -101,7 +101,7 @@ fs_visitor::visit(ir_variable *ir) this->output_components[output] = vector_elements; } } - } else if (ir->mode == ir_var_uniform) { + } else if (ir->data.mode == ir_var_uniform) { int param_index = c->prog_data.nr_params; /* Thanks to the lower_ubo_reference pass, we will see only @@ -131,7 +131,7 @@ fs_visitor::visit(ir_variable *ir) reg = new(this->mem_ctx) fs_reg(UNIFORM, param_index); reg->type = brw_type_for_base_type(ir->type); - } else if (ir->mode == ir_var_system_value) { + } else if (ir->data.mode == ir_var_system_value) { if (ir->location == SYSTEM_VALUE_SAMPLE_POS) { reg = emit_samplepos_setup(ir); } else if (ir->location == SYSTEM_VALUE_SAMPLE_ID) { diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 88aa169fc1f..6f0ace8932c 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -223,7 +223,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) foreach_list(node, shader->ir) { ir_variable *var = ((ir_instruction *) node)->as_variable(); - if ((var == NULL) || (var->mode != ir_var_uniform) + if ((var == NULL) || (var->data.mode != ir_var_uniform) || (strncmp(var->name, "gl_", 3) != 0)) continue; diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp index adbb1cf0945..c93459d28a7 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp @@ -283,7 +283,7 @@ vec4_gs_visitor::compute_array_stride(ir_dereference_array *ir) * setup_attributes() will remap our accesses to the actual input array. */ ir_dereference_variable *deref_var = ir->array->as_dereference_variable(); - if (deref_var && deref_var->var->mode == ir_var_shader_in) + if (deref_var && deref_var->var->data.mode == ir_var_shader_in) return BRW_VARYING_SLOT_COUNT; else return vec4_visitor::compute_array_stride(ir); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 81039ab0bc2..0d8135c8d8f 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -945,7 +945,7 @@ vec4_visitor::visit(ir_variable *ir) if (variable_storage(ir)) return; - switch (ir->mode) { + switch (ir->data.mode) { case ir_var_shader_in: reg = new(mem_ctx) dst_reg(ATTR, ir->location); break; @@ -1752,7 +1752,7 @@ vec4_visitor::visit(ir_dereference_variable *ir) this->result = src_reg(*reg); /* System values get their swizzle from the dst_reg writemask */ - if (ir->var->mode == ir_var_system_value) + if (ir->var->data.mode == ir_var_system_value) return; if (type->is_scalar() || type->is_vector() || type->is_matrix()) diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 3014a97785d..6db29d803ab 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -106,7 +106,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index, const ir_variable *const var = ((ir_instruction *) node)->as_variable(); if (var == NULL - || var->mode != ir_var_shader_in + || var->data.mode != ir_var_shader_in || var->location == -1) continue; @@ -169,7 +169,7 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name) * attribute, or if an error occurs, -1 will be returned." */ if (var == NULL - || var->mode != ir_var_shader_in + || var->data.mode != ir_var_shader_in || var->location == -1 || var->location < VERT_ATTRIB_GENERIC0) continue; @@ -197,7 +197,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg) const ir_variable *const var = ((ir_instruction *) node)->as_variable(); if (var == NULL - || var->mode != ir_var_shader_in + || var->data.mode != ir_var_shader_in || var->location == -1) continue; @@ -223,7 +223,7 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg) const ir_variable *const var = ((ir_instruction *) node)->as_variable(); if (var == NULL - || var->mode != ir_var_shader_in + || var->data.mode != ir_var_shader_in || var->location == -1) continue; @@ -333,7 +333,7 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar *name) * attribute, or if an error occurs, -1 will be returned." */ if (var == NULL - || var->mode != ir_var_shader_out + || var->data.mode != ir_var_shader_out || var->location == -1 || var->location < FRAG_RESULT_DATA0) continue; @@ -389,7 +389,7 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar *name) * attribute, or if an error occurs, -1 will be returned." */ if (var == NULL - || var->mode != ir_var_shader_out + || var->data.mode != ir_var_shader_out || var->location == -1 || var->location < FRAG_RESULT_DATA0) continue; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index ad6c242e4d5..1f841efd101 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -681,11 +681,11 @@ ir_to_mesa_visitor::visit(ir_variable *ir) if (strcmp(ir->name, "gl_FragCoord") == 0) { struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; - fp->OriginUpperLeft = ir->origin_upper_left; - fp->PixelCenterInteger = ir->pixel_center_integer; + fp->OriginUpperLeft = ir->data.origin_upper_left; + fp->PixelCenterInteger = ir->data.pixel_center_integer; } - if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { + 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); @@ -1528,7 +1528,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) ir_variable *var = ir->var; if (!entry) { - switch (var->mode) { + switch (var->data.mode) { case ir_var_uniform: entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM, var->location); @@ -2499,7 +2499,7 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program foreach_list(node, sh->ir) { ir_variable *var = ((ir_instruction *) node)->as_variable(); - if ((var == NULL) || (var->mode != ir_var_uniform) + if ((var == NULL) || (var->data.mode != ir_var_uniform) || var->is_in_uniform_block() || (strncmp(var->name, "gl_", 3) == 0)) continue; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index a1ee24f6693..befa6d45e4b 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1056,11 +1056,11 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir) if (strcmp(ir->name, "gl_FragCoord") == 0) { struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; - fp->OriginUpperLeft = ir->origin_upper_left; - fp->PixelCenterInteger = ir->pixel_center_integer; + fp->OriginUpperLeft = ir->data.origin_upper_left; + fp->PixelCenterInteger = ir->data.pixel_center_integer; } - if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { + 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); @@ -2020,7 +2020,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir) ir_variable *var = ir->var; if (!entry) { - switch (var->mode) { + switch (var->data.mode) { case ir_var_uniform: entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM, var->location); @@ -2345,7 +2345,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); l.writemask = WRITEMASK_XYZW; } else if (ir->lhs->type->is_scalar() && - ir->lhs->variable_referenced()->mode == ir_var_shader_out) { + ir->lhs->variable_referenced()->data.mode == ir_var_shader_out) { /* FINISHME: This hack makes writing to gl_FragDepth, which lives in the * FINISHME: W component of fragment shader output zero, work correctly. */ @@ -2621,8 +2621,8 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *param = (ir_variable *)sig_iter.get(); - if (param->mode == ir_var_function_in || - param->mode == ir_var_function_inout) { + if (param->data.mode == ir_var_function_in || + param->data.mode == ir_var_function_inout) { variable_storage *storage = find_variable_storage(param); assert(storage); @@ -2657,8 +2657,8 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *param = (ir_variable *)sig_iter.get(); - if (param->mode == ir_var_function_out || - param->mode == ir_var_function_inout) { + if (param->data.mode == ir_var_function_out || + param->data.mode == ir_var_function_inout) { variable_storage *storage = find_variable_storage(param); assert(storage); |