<p dir="ltr"><br>
On Jan 16, 2015 4:19 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> I dislike how fs_reg has a constructor that knows about fs_visitor.<br>
> Apart from that, it stands alone, with no need to interact with the<br>
> rest of the compiler. Which is sensible - a class that represents<br>
> a register should do just that. Allocating virtual register numbers<br>
> should be left up to the compiler (fs_visitor).<br>
><br>
> This patch replaces the constructor with a new fs_visitor::vgrf method,<br>
> eliminating fs_reg's dependency on fs_visitor. It ends up being no<br>
> more code.<br>
><br>
> v2: Rebase from May 2014 -> January 2015.</p>
<p dir="ltr">I love the part where I suggested you do this and you already had the patch... Assuming Matt's OK with it, this is r-b me.</p>
<p dir="ltr">> Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/brw_fs.cpp | 50 ++++----<br>
> src/mesa/drivers/dri/i965/brw_fs.h | 2 +-<br>
> src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 46 ++++----<br>
> src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 18 +--<br>
> src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp | 2 +-<br>
> src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 132 +++++++++++-----------<br>
> 6 files changed, 122 insertions(+), 128 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> index 35639de..817ca2e 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> @@ -406,7 +406,7 @@ fs_visitor::VARYING_PULL_CONSTANT_LOAD(const fs_reg &dst,<br>
> * CSE can later notice that those loads are all the same and eliminate<br>
> * the redundant ones.<br>
> */<br>
> - fs_reg vec4_offset = fs_reg(this, glsl_type::int_type);<br>
> + fs_reg vec4_offset = vgrf(glsl_type::int_type);<br>
> instructions.push_tail(ADD(vec4_offset,<br>
> varying_offset, fs_reg(const_offset & ~3)));<br>
><br>
> @@ -778,9 +778,9 @@ fs_visitor::emit_shader_time_write(enum shader_time_shader_type type,<br>
><br>
> fs_reg payload;<br>
> if (dispatch_width == 8)<br>
> - payload = fs_reg(this, glsl_type::uvec2_type);<br>
> + payload = vgrf(glsl_type::uvec2_type);<br>
> else<br>
> - payload = fs_reg(this, glsl_type::uint_type);<br>
> + payload = vgrf(glsl_type::uint_type);<br>
><br>
> emit(new(mem_ctx) fs_inst(SHADER_OPCODE_SHADER_TIME_ADD,<br>
> fs_reg(), payload, offset, value));<br>
> @@ -1032,6 +1032,14 @@ fs_visitor::virtual_grf_alloc(int size)<br>
> return virtual_grf_count++;<br>
> }<br>
><br>
> +fs_reg<br>
> +fs_visitor::vgrf(const glsl_type *const type)<br>
> +{<br>
> + int reg_width = dispatch_width / 8;<br>
> + return fs_reg(GRF, virtual_grf_alloc(type_size(type) * reg_width),<br>
> + brw_type_for_base_type(type), dispatch_width);<br>
> +}<br>
> +<br>
> /** Fixed HW reg constructor. */<br>
> fs_reg::fs_reg(enum register_file file, int reg)<br>
> {<br>
> @@ -1077,20 +1085,6 @@ fs_reg::fs_reg(enum register_file file, int reg, enum brw_reg_type type,<br>
> this->width = width;<br>
> }<br>
><br>
> -/** Automatic reg constructor. */<br>
> -fs_reg::fs_reg(fs_visitor *v, const struct glsl_type *type)<br>
> -{<br>
> - init();<br>
> - int reg_width = v->dispatch_width / 8;<br>
> -<br>
> - this->file = GRF;<br>
> - this->reg = v->virtual_grf_alloc(v->type_size(type) * reg_width);<br>
> - this->reg_offset = 0;<br>
> - this->type = brw_type_for_base_type(type);<br>
> - this->width = v->dispatch_width;<br>
> - assert(this->width == 8 || this->width == 16);<br>
> -}<br>
> -<br>
> fs_reg *<br>
> fs_visitor::variable_storage(ir_variable *var)<br>
> {<br>
> @@ -1208,7 +1202,7 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,<br>
> {<br>
> assert(stage == MESA_SHADER_FRAGMENT);<br>
> brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;<br>
> - fs_reg *reg = new(this->mem_ctx) fs_reg(this, glsl_type::vec4_type);<br>
> + fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::vec4_type));<br>
> fs_reg wpos = *reg;<br>
> bool flip = !origin_upper_left ^ key->render_to_fbo;<br>
><br>
> @@ -1394,7 +1388,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,<br>
> fs_reg *<br>
> fs_visitor::emit_frontfacing_interpolation()<br>
> {<br>
> - fs_reg *reg = new(this->mem_ctx) fs_reg(this, glsl_type::bool_type);<br>
> + fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::bool_type));<br>
><br>
> if (brw->gen >= 6) {<br>
> /* Bit 15 of g0.0 is 0 if the polygon is front facing. We want to create<br>
> @@ -1461,10 +1455,10 @@ fs_visitor::emit_samplepos_setup()<br>
> assert(brw->gen >= 6);<br>
><br>
> this->current_annotation = "compute sample position";<br>
> - fs_reg *reg = new(this->mem_ctx) fs_reg(this, glsl_type::vec2_type);<br>
> + fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::vec2_type));<br>
> fs_reg pos = *reg;<br>
> - fs_reg int_sample_x = fs_reg(this, glsl_type::int_type);<br>
> - fs_reg int_sample_y = fs_reg(this, glsl_type::int_type);<br>
> + fs_reg int_sample_x = vgrf(glsl_type::int_type);<br>
> + fs_reg int_sample_y = vgrf(glsl_type::int_type);<br>
><br>
> /* WM will be run in MSDISPMODE_PERSAMPLE. So, only one of SIMD8 or SIMD16<br>
> * mode will be enabled.<br>
> @@ -1512,11 +1506,11 @@ fs_visitor::emit_sampleid_setup()<br>
> assert(brw->gen >= 6);<br>
><br>
> this->current_annotation = "compute sample id";<br>
> - fs_reg *reg = new(this->mem_ctx) fs_reg(this, glsl_type::int_type);<br>
> + fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::int_type));<br>
><br>
> if (key->compute_sample_id) {<br>
> - fs_reg t1 = fs_reg(this, glsl_type::int_type);<br>
> - fs_reg t2 = fs_reg(this, glsl_type::int_type);<br>
> + fs_reg t1 = vgrf(glsl_type::int_type);<br>
> + fs_reg t2 = vgrf(glsl_type::int_type);<br>
> t2.type = BRW_REGISTER_TYPE_UW;<br>
><br>
> /* The PS will be run in MSDISPMODE_PERSAMPLE. For example with<br>
> @@ -1584,7 +1578,7 @@ fs_visitor::fix_math_operand(fs_reg src)<br>
> if (brw->gen >= 7 && src.file != IMM)<br>
> return src;<br>
><br>
> - fs_reg expanded = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg expanded = vgrf(glsl_type::float_type);<br>
> expanded.type = src.type;<br>
> emit(BRW_OPCODE_MOV, expanded, src);<br>
> return expanded;<br>
> @@ -2261,7 +2255,7 @@ fs_visitor::demote_pull_constants()<br>
> current_annotation = inst->annotation;<br>
><br>
> fs_reg surf_index(stage_prog_data->binding_table.pull_constants_start);<br>
> - fs_reg dst = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg dst = vgrf(glsl_type::float_type);<br>
><br>
> /* Generate a pull load into dst. */<br>
> if (inst->src[i].reladdr) {<br>
> @@ -2997,7 +2991,7 @@ fs_visitor::lower_uniform_pull_constant_loads()<br>
> assert(const_offset_reg.file == IMM &&<br>
> const_offset_reg.type == BRW_REGISTER_TYPE_UD);<br>
> const_offset_reg.fixed_hw_reg.dw1.ud /= 4;<br>
> - fs_reg payload = fs_reg(this, glsl_type::uint_type);<br>
> + fs_reg payload = vgrf(glsl_type::uint_type);<br>
><br>
> /* We have to use a message header on Skylake to get SIMD4x2 mode.<br>
> * Reserve space for the register.<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h<br>
> index 2aa58eb..466f90f 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs.h<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h<br>
> @@ -83,7 +83,6 @@ public:<br>
> fs_reg(enum register_file file, int reg);<br>
> fs_reg(enum register_file file, int reg, enum brw_reg_type type);<br>
> fs_reg(enum register_file file, int reg, enum brw_reg_type type, uint8_t width);<br>
> - fs_reg(fs_visitor *v, const struct glsl_type *type);<br>
><br>
> bool equals(const fs_reg &r) const;<br>
> bool is_contiguous() const;<br>
> @@ -323,6 +322,7 @@ public:<br>
><br>
> fs_reg *variable_storage(ir_variable *var);<br>
> int virtual_grf_alloc(int size);<br>
> + fs_reg vgrf(const glsl_type *const type);<br>
> void import_uniforms(fs_visitor *v);<br>
> void setup_uniform_clipplane_values();<br>
> void compute_clip_distance();<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp<br>
> index 4639590..7f2874d 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp<br>
> @@ -105,7 +105,7 @@ fs_visitor::emit_fp_scalar_math(enum opcode opcode,<br>
> const struct prog_instruction *fpi,<br>
> fs_reg dst, fs_reg src)<br>
> {<br>
> - fs_reg temp = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> emit_math(opcode, temp, src);<br>
> emit_fp_scalar_write(fpi, dst, temp);<br>
> }<br>
> @@ -125,7 +125,7 @@ fs_visitor::emit_fragment_program_code()<br>
> * mov dst 0.0<br>
> * mov.f0 dst 1.0<br>
> */<br>
> - fs_reg one = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg one = vgrf(glsl_type::float_type);<br>
> emit(MOV(one, fs_reg(1.0f)));<br>
><br>
> for (unsigned int insn = 0; insn < prog->NumInstructions; insn++) {<br>
> @@ -138,7 +138,7 @@ fs_visitor::emit_fragment_program_code()<br>
> /* We always emit into a temporary destination register to avoid<br>
> * aliasing issues.<br>
> */<br>
> - dst = fs_reg(this, glsl_type::vec4_type);<br>
> + dst = vgrf(glsl_type::vec4_type);<br>
><br>
> for (int i = 0; i < 3; i++)<br>
> src[i] = get_fp_src_reg(&fpi->SrcReg[i]);<br>
> @@ -177,8 +177,8 @@ fs_visitor::emit_fragment_program_code()<br>
> case OPCODE_DP3:<br>
> case OPCODE_DP4:<br>
> case OPCODE_DPH: {<br>
> - fs_reg mul = fs_reg(this, glsl_type::float_type);<br>
> - fs_reg acc = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg mul = vgrf(glsl_type::float_type);<br>
> + fs_reg acc = vgrf(glsl_type::float_type);<br>
> int count;<br>
><br>
> switch (fpi->Opcode) {<br>
> @@ -316,7 +316,7 @@ fs_visitor::emit_fragment_program_code()<br>
> case OPCODE_MAD:<br>
> for (int i = 0; i < 4; i++) {<br>
> if (fpi->DstReg.WriteMask & (1 << i)) {<br>
> - fs_reg temp = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> emit(MUL(temp, offset(src[0], i), offset(src[1], i)));<br>
> emit(ADD(offset(dst, i), temp, offset(src[2], i)));<br>
> }<br>
> @@ -340,7 +340,7 @@ fs_visitor::emit_fragment_program_code()<br>
> break;<br>
><br>
> case OPCODE_POW: {<br>
> - fs_reg temp = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> emit_math(SHADER_OPCODE_POW, temp, src[0], src[1]);<br>
> emit_fp_scalar_write(fpi, dst, temp);<br>
> break;<br>
> @@ -404,8 +404,8 @@ fs_visitor::emit_fragment_program_code()<br>
> case OPCODE_TXP: {<br>
> op = ir_tex;<br>
><br>
> - coordinate = fs_reg(this, glsl_type::vec3_type);<br>
> - fs_reg invproj = fs_reg(this, glsl_type::float_type);<br>
> + coordinate = vgrf(glsl_type::vec3_type);<br>
> + fs_reg invproj = vgrf(glsl_type::float_type);<br>
> emit_math(SHADER_OPCODE_RCP, invproj, offset(src[0], 3));<br>
> for (int i = 0; i < 3; i++) {<br>
> emit(MUL(offset(coordinate, i),<br>
> @@ -442,8 +442,8 @@ fs_visitor::emit_fragment_program_code()<br>
> case TEXTURE_CUBE_INDEX: {<br>
> coord_components = 4;<br>
><br>
> - fs_reg temp = fs_reg(this, glsl_type::float_type);<br>
> - fs_reg cubecoord = fs_reg(this, glsl_type::vec3_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> + fs_reg cubecoord = vgrf(glsl_type::vec3_type);<br>
> fs_reg abscoord = coordinate;<br>
> abscoord.negate = false;<br>
> abscoord.abs = true;<br>
> @@ -495,7 +495,7 @@ fs_visitor::emit_fragment_program_code()<br>
> int i1 = (i + 1) % 3;<br>
> int i2 = (i + 2) % 3;<br>
><br>
> - fs_reg temp = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> fs_reg neg_src1_1 = offset(src[1], i1);<br>
> neg_src1_1.negate = !neg_src1_1.negate;<br>
> emit(MUL(temp, offset(src[0], i2), neg_src1_1));<br>
> @@ -537,7 +537,7 @@ fs_visitor::emit_fragment_program_code()<br>
> */<br>
> this->current_annotation = "result.depth write";<br>
> if (frag_depth.file != BAD_FILE) {<br>
> - fs_reg temp = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> emit(MOV(temp, offset(frag_depth, 2)));<br>
> frag_depth = temp;<br>
> }<br>
> @@ -550,7 +550,7 @@ fs_visitor::setup_fp_regs()<br>
> int num_temp = prog->NumTemporaries;<br>
> fp_temp_regs = rzalloc_array(mem_ctx, fs_reg, num_temp);<br>
> for (int i = 0; i < num_temp; i++)<br>
> - fp_temp_regs[i] = fs_reg(this, glsl_type::vec4_type);<br>
> + fp_temp_regs[i] = vgrf(glsl_type::vec4_type);<br>
><br>
> /* PROGRAM_STATE_VAR etc. */<br>
> if (dispatch_width == 8) {<br>
> @@ -583,7 +583,7 @@ fs_visitor::setup_fp_regs()<br>
> fp_input_regs[i] = *emit_frontfacing_interpolation();<br>
> break;<br>
> default:<br>
> - fp_input_regs[i] = fs_reg(this, glsl_type::vec4_type);<br>
> + fp_input_regs[i] = vgrf(glsl_type::vec4_type);<br>
> emit_general_interpolation(fp_input_regs[i], "fp_input",<br>
> glsl_type::vec4_type,<br>
> INTERP_QUALIFIER_NONE,<br>
> @@ -616,11 +616,11 @@ fs_visitor::get_fp_dst_reg(const prog_dst_register *dst)<br>
> case PROGRAM_OUTPUT:<br>
> if (dst->Index == FRAG_RESULT_DEPTH) {<br>
> if (frag_depth.file == BAD_FILE)<br>
> - frag_depth = fs_reg(this, glsl_type::vec4_type);<br>
> + frag_depth = vgrf(glsl_type::vec4_type);<br>
> return frag_depth;<br>
> } else if (dst->Index == FRAG_RESULT_COLOR) {<br>
> if (outputs[0].file == BAD_FILE) {<br>
> - outputs[0] = fs_reg(this, glsl_type::vec4_type);<br>
> + outputs[0] = vgrf(glsl_type::vec4_type);<br>
> output_components[0] = 4;<br>
><br>
> /* Tell emit_fb_writes() to smear fragment.color across all the<br>
> @@ -635,7 +635,7 @@ fs_visitor::get_fp_dst_reg(const prog_dst_register *dst)<br>
> } else {<br>
> int output_index = dst->Index - FRAG_RESULT_DATA0;<br>
> if (outputs[output_index].file == BAD_FILE) {<br>
> - outputs[output_index] = fs_reg(this, glsl_type::vec4_type);<br>
> + outputs[output_index] = vgrf(glsl_type::vec4_type);<br>
> }<br>
> output_components[output_index] = 4;<br>
> return outputs[output_index];<br>
> @@ -647,7 +647,7 @@ fs_visitor::get_fp_dst_reg(const prog_dst_register *dst)<br>
> default:<br>
> _mesa_problem(ctx, "bad dst register file: %s\n",<br>
> _mesa_register_file_name((gl_register_file)dst->File));<br>
> - return fs_reg(this, glsl_type::vec4_type);<br>
> + return vgrf(glsl_type::vec4_type);<br>
> }<br>
> }<br>
><br>
> @@ -680,7 +680,7 @@ fs_visitor::get_fp_src_reg(const prog_src_register *src)<br>
> */<br>
> switch (plist->Parameters[src->Index].Type) {<br>
> case PROGRAM_CONSTANT: {<br>
> - result = fs_reg(this, glsl_type::vec4_type);<br>
> + result = vgrf(glsl_type::vec4_type);<br>
><br>
> for (int i = 0; i < 4; i++) {<br>
> emit(MOV(offset(result, i),<br>
> @@ -697,19 +697,19 @@ fs_visitor::get_fp_src_reg(const prog_src_register *src)<br>
> default:<br>
> _mesa_problem(ctx, "bad uniform src register file: %s\n",<br>
> _mesa_register_file_name((gl_register_file)src->File));<br>
> - return fs_reg(this, glsl_type::vec4_type);<br>
> + return vgrf(glsl_type::vec4_type);<br>
> }<br>
> break;<br>
><br>
> default:<br>
> _mesa_problem(ctx, "bad src register file: %s\n",<br>
> _mesa_register_file_name((gl_register_file)src->File));<br>
> - return fs_reg(this, glsl_type::vec4_type);<br>
> + return vgrf(glsl_type::vec4_type);<br>
> }<br>
><br>
> if (src->Swizzle != SWIZZLE_NOOP || src->Negate) {<br>
> fs_reg unswizzled = result;<br>
> - result = fs_reg(this, glsl_type::vec4_type);<br>
> + result = vgrf(glsl_type::vec4_type);<br>
> for (int i = 0; i < 4; i++) {<br>
> bool negate = src->Negate & (1 << i);<br>
> /* The ZERO, ONE, and Negate options are only used for OPCODE_SWZ,<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> index e8f398a..7d7c04c 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> @@ -858,7 +858,7 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)<br>
> }<br>
> case nir_op_fceil: {<br>
> op[0].negate = !op[0].negate;<br>
> - fs_reg temp = fs_reg(this, glsl_type::vec4_type);<br>
> + fs_reg temp = vgrf(glsl_type::vec4_type);<br>
> emit_percomp(RNDD(temp, op[0]), instr->dest.write_mask);<br>
> temp.negate = true;<br>
> fs_inst *inst = MOV(result, temp);<br>
> @@ -1393,7 +1393,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)<br>
> * per-channel and add the base UBO index; the generator will select<br>
> * a value from any live channel.<br>
> */<br>
> - surf_index = fs_reg(this, glsl_type::uint_type);<br>
> + surf_index = vgrf(glsl_type::uint_type);<br>
> emit(ADD(surf_index, get_nir_src(instr->src[0]),<br>
> fs_reg(stage_prog_data->binding_table.ubo_start)))<br>
> ->force_writemask_all = true;<br>
> @@ -1408,7 +1408,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)<br>
><br>
> if (has_indirect) {<br>
> /* Turn the byte offset into a dword offset. */<br>
> - fs_reg base_offset = fs_reg(this, glsl_type::int_type);<br>
> + fs_reg base_offset = vgrf(glsl_type::int_type);<br>
> emit(SHR(base_offset, retype(get_nir_src(instr->src[1]),<br>
> BRW_REGISTER_TYPE_D),<br>
> fs_reg(2)));<br>
> @@ -1418,7 +1418,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)<br>
> emit(VARYING_PULL_CONSTANT_LOAD(offset(dest, i), surf_index,<br>
> base_offset, vec4_offset + i));<br>
> } else {<br>
> - fs_reg packed_consts = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg packed_consts = vgrf(glsl_type::float_type);<br>
> packed_consts.type = dest.type;<br>
><br>
> fs_reg const_offset_reg((unsigned) instr->const_index[0] & ~15);<br>
> @@ -1494,7 +1494,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)<br>
> * requires mlen==1 even when there is no payload. in the per-slot<br>
> * offset case, we'll replace this with the proper source data.<br>
> */<br>
> - fs_reg src(this, glsl_type::float_type);<br>
> + fs_reg src = vgrf(glsl_type::float_type);<br>
> int mlen = 1; /* one reg unless overriden */<br>
> fs_inst *inst;<br>
><br>
> @@ -1523,13 +1523,13 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)<br>
> inst = emit(FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET, dst_x, src,<br>
> fs_reg(off_x | (off_y << 4)));<br>
> } else {<br>
> - src = fs_reg(this, glsl_type::ivec2_type);<br>
> + src = vgrf(glsl_type::ivec2_type);<br>
> fs_reg offset_src = retype(get_nir_src(instr->src[0]),<br>
> BRW_REGISTER_TYPE_F);<br>
> for (int i = 0; i < 2; i++) {<br>
> - fs_reg temp(this, glsl_type::float_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> emit(MUL(temp, offset(offset_src, i), fs_reg(16.0f)));<br>
> - fs_reg itemp(this, glsl_type::int_type);<br>
> + fs_reg itemp = vgrf(glsl_type::int_type);<br>
> emit(MOV(itemp, temp)); /* float to int */<br>
><br>
> /* Clamp the upper end of the range to +7/16.<br>
> @@ -1691,7 +1691,7 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)<br>
> brw_mark_surface_used(prog_data, max_used);<br>
><br>
> /* Emit code to evaluate the actual indexing expression */<br>
> - sampler_reg = fs_reg(this, glsl_type::uint_type);<br>
> + sampler_reg = vgrf(glsl_type::uint_type);<br>
> emit(ADD(sampler_reg, src, fs_reg(sampler)))<br>
> ->force_writemask_all = true;<br>
> break;<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp<br>
> index f18589c..ee485fa 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp<br>
> @@ -196,7 +196,7 @@ fs_visitor::opt_peephole_sel()<br>
> */<br>
> fs_reg src0(then_mov[i]->src[0]);<br>
> if (src0.file == IMM) {<br>
> - src0 = fs_reg(this, glsl_type::float_type);<br>
> + src0 = vgrf(glsl_type::float_type);<br>
> src0.type = then_mov[i]->src[0].type;<br>
> mov_imm_inst[i] = MOV(src0, then_mov[i]->src[0]);<br>
> }<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> index 8aafbef..a55c930 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> @@ -98,7 +98,7 @@ fs_visitor::visit(ir_variable *ir)<br>
> } else if (!strcmp(ir->name, "gl_FrontFacing")) {<br>
> reg = emit_frontfacing_interpolation();<br>
> } else {<br>
> - reg = new(this->mem_ctx) fs_reg(this, ir->type);<br>
> + reg = new(this->mem_ctx) fs_reg(vgrf(ir->type));<br>
> emit_general_interpolation(*reg, ir->name, ir->type,<br>
> (glsl_interp_qualifier) ir->data.interpolation,<br>
> ir->data.location, ir->data.centroid,<br>
> @@ -108,7 +108,7 @@ fs_visitor::visit(ir_variable *ir)<br>
> hash_table_insert(this->variable_ht, reg, ir);<br>
> return;<br>
> } else if (ir->data.mode == ir_var_shader_out) {<br>
> - reg = new(this->mem_ctx) fs_reg(this, ir->type);<br>
> + reg = new(this->mem_ctx) fs_reg(vgrf(ir->type));<br>
><br>
> if (stage == MESA_SHADER_VERTEX) {<br>
> int vector_elements =<br>
> @@ -210,7 +210,7 @@ fs_visitor::visit(ir_variable *ir)<br>
> }<br>
><br>
> if (!reg)<br>
> - reg = new(this->mem_ctx) fs_reg(this, ir->type);<br>
> + reg = new(this->mem_ctx) fs_reg(vgrf(ir->type));<br>
><br>
> hash_table_insert(this->variable_ht, reg, ir);<br>
> }<br>
> @@ -279,7 +279,7 @@ fs_visitor::visit(ir_dereference_array *ir)<br>
> ir->array_index->accept(this);<br>
><br>
> fs_reg index_reg;<br>
> - index_reg = fs_reg(this, glsl_type::int_type);<br>
> + index_reg = vgrf(glsl_type::int_type);<br>
> emit(BRW_OPCODE_MUL, index_reg, this->result, fs_reg(element_size));<br>
><br>
> if (src.reladdr) {<br>
> @@ -298,9 +298,9 @@ fs_visitor::emit_lrp(const fs_reg &dst, const fs_reg &x, const fs_reg &y,<br>
> {<br>
> if (brw->gen < 6) {<br>
> /* We can't use the LRP instruction. Emit x*(1-a) + y*a. */<br>
> - fs_reg y_times_a = fs_reg(this, glsl_type::float_type);<br>
> - fs_reg one_minus_a = fs_reg(this, glsl_type::float_type);<br>
> - fs_reg x_times_one_minus_a = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg y_times_a = vgrf(glsl_type::float_type);<br>
> + fs_reg one_minus_a = vgrf(glsl_type::float_type);<br>
> + fs_reg x_times_one_minus_a = vgrf(glsl_type::float_type);<br>
><br>
> emit(MUL(y_times_a, y, a));<br>
><br>
> @@ -408,11 +408,11 @@ fs_visitor::try_emit_line(ir_expression *ir)<br>
> non_const_mul->accept(this);<br>
> fs_reg src1 = this->result;<br>
><br>
> - fs_reg src0 = fs_reg(this, ir->type);<br>
> + fs_reg src0 = vgrf(ir->type);<br>
> emit(BRW_OPCODE_MOV, src0,<br>
> fs_reg((uint8_t)mul_operand_vf, 0, 0, (uint8_t)add_operand_vf));<br>
><br>
> - this->result = fs_reg(this, ir->type);<br>
> + this->result = vgrf(ir->type);<br>
> emit(BRW_OPCODE_LINE, this->result, src0, src1);<br>
> return true;<br>
> }<br>
> @@ -477,7 +477,7 @@ fs_visitor::try_emit_mad(ir_expression *ir)<br>
> if (mul_abs)<br>
> src2.negate = false;<br>
><br>
> - this->result = fs_reg(this, ir->type);<br>
> + this->result = vgrf(ir->type);<br>
> emit(BRW_OPCODE_MAD, this->result, src0, src1, src2);<br>
><br>
> return true;<br>
> @@ -520,13 +520,13 @@ fs_visitor::emit_interpolate_expression(ir_expression *ir)<br>
><br>
> /* 1. collect interpolation factors */<br>
><br>
> - fs_reg dst_x = fs_reg(this, glsl_type::get_instance(ir->type->base_type, 2, 1));<br>
> + fs_reg dst_x = vgrf(glsl_type::get_instance(ir->type->base_type, 2, 1));<br>
> fs_reg dst_y = offset(dst_x, 1);<br>
><br>
> /* for most messages, we need one reg of ignored data; the hardware requires mlen==1<br>
> * even when there is no payload. in the per-slot offset case, we'll replace this with<br>
> * the proper source data. */<br>
> - fs_reg src = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg src = vgrf(glsl_type::float_type);<br>
> int mlen = 1; /* one reg unless overriden */<br>
> int reg_width = dispatch_width / 8;<br>
> fs_inst *inst;<br>
> @@ -555,10 +555,10 @@ fs_visitor::emit_interpolate_expression(ir_expression *ir)<br>
> } else {<br>
> /* pack the operands: hw wants offsets as 4 bit signed ints */<br>
> ir->operands[1]->accept(this);<br>
> - src = fs_reg(this, glsl_type::ivec2_type);<br>
> + src = vgrf(glsl_type::ivec2_type);<br>
> fs_reg src2 = src;<br>
> for (int i = 0; i < 2; i++) {<br>
> - fs_reg temp = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg temp = vgrf(glsl_type::float_type);<br>
> emit(MUL(temp, this->result, fs_reg(16.0f)));<br>
> emit(MOV(src2, temp)); /* float to int */<br>
><br>
> @@ -600,7 +600,7 @@ fs_visitor::emit_interpolate_expression(ir_expression *ir)<br>
><br>
> /* 2. emit linterp */<br>
><br>
> - fs_reg res(this, ir->type);<br>
> + fs_reg res = vgrf(ir->type);<br>
> this->result = res;<br>
><br>
> for (int i = 0; i < ir->type->vector_elements; i++) {<br>
> @@ -642,7 +642,7 @@ fs_visitor::visit(ir_expression *ir)<br>
><br>
> emit_bool_to_cond_code(ir->operands[0]);<br>
><br>
> - this->result = fs_reg(this, ir->type);<br>
> + this->result = vgrf(ir->type);<br>
> inst = emit(SEL(this->result, op[1], op[2]));<br>
> inst->predicate = BRW_PREDICATE_NORMAL;<br>
> return;<br>
> @@ -680,7 +680,7 @@ fs_visitor::visit(ir_expression *ir)<br>
> /* Storage for our result. If our result goes into an assignment, it will<br>
> * just get copy-propagated out, so no worries.<br>
> */<br>
> - this->result = fs_reg(this, ir->type);<br>
> + this->result = vgrf(ir->type);<br>
><br>
> switch (ir->operation) {<br>
> case ir_unop_logic_not:<br>
> @@ -984,7 +984,7 @@ fs_visitor::visit(ir_expression *ir)<br>
> emit(RNDZ(this->result, op[0]));<br>
> break;<br>
> case ir_unop_ceil: {<br>
> - fs_reg tmp = fs_reg(this, ir->type);<br>
> + fs_reg tmp = vgrf(ir->type);<br>
> op[0].negate = !op[0].negate;<br>
> emit(RNDD(tmp, op[0]));<br>
> tmp.negate = true;<br>
> @@ -1037,7 +1037,7 @@ fs_visitor::visit(ir_expression *ir)<br>
> emit(CBIT(this->result, op[0]));<br>
> break;<br>
> case ir_unop_find_msb:<br>
> - temp = fs_reg(this, glsl_type::uint_type);<br>
> + temp = vgrf(glsl_type::uint_type);<br>
> emit(FBH(temp, op[0]));<br>
><br>
> /* FBH counts from the MSB side, while GLSL's findMSB() wants the count<br>
> @@ -1121,7 +1121,7 @@ fs_visitor::visit(ir_expression *ir)<br>
> * per-channel and add the base UBO index; the generator will select<br>
> * a value from any live channel.<br>
> */<br>
> - surf_index = fs_reg(this, glsl_type::uint_type);<br>
> + surf_index = vgrf(glsl_type::uint_type);<br>
> emit(ADD(surf_index, op[0],<br>
> fs_reg(stage_prog_data->binding_table.ubo_start)))<br>
> ->force_writemask_all = true;<br>
> @@ -1135,7 +1135,7 @@ fs_visitor::visit(ir_expression *ir)<br>
> }<br>
><br>
> if (const_offset) {<br>
> - fs_reg packed_consts = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg packed_consts = vgrf(glsl_type::float_type);<br>
> packed_consts.type = result.type;<br>
><br>
> fs_reg const_offset_reg = fs_reg(const_offset->value.u[0] & ~15);<br>
> @@ -1163,7 +1163,7 @@ fs_visitor::visit(ir_expression *ir)<br>
> }<br>
> } else {<br>
> /* Turn the byte offset into a dword offset. */<br>
> - fs_reg base_offset = fs_reg(this, glsl_type::int_type);<br>
> + fs_reg base_offset = vgrf(glsl_type::int_type);<br>
> emit(SHR(base_offset, op[1], fs_reg(2)));<br>
><br>
> for (int i = 0; i < ir->type->vector_elements; i++) {<br>
> @@ -1655,7 +1655,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst,<br>
><br>
> fs_reg *sources = ralloc_array(mem_ctx, fs_reg, MAX_SAMPLER_MESSAGE_SIZE);<br>
> for (int i = 0; i < MAX_SAMPLER_MESSAGE_SIZE; i++) {<br>
> - sources[i] = fs_reg(this, glsl_type::float_type);<br>
> + sources[i] = vgrf(glsl_type::float_type);<br>
> }<br>
> int length = 0;<br>
><br>
> @@ -1956,7 +1956,7 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components,<br>
> * for clamping, but we don't care enough to make a new<br>
> * parameter type, so just invert back.<br>
> */<br>
> - fs_reg limit = fs_reg(this, glsl_type::float_type);<br>
> + fs_reg limit = vgrf(glsl_type::float_type);<br>
> emit(MOV(limit, i == 0 ? scale_x : scale_y));<br>
> emit(SHADER_OPCODE_RCP, limit, limit);<br>
><br>
> @@ -1987,12 +1987,12 @@ fs_visitor::emit_mcs_fetch(fs_reg coordinate, int components, fs_reg sampler)<br>
> int reg_width = dispatch_width / 8;<br>
> fs_reg payload = fs_reg(GRF, virtual_grf_alloc(components * reg_width),<br>
> BRW_REGISTER_TYPE_F);<br>
> - fs_reg dest = fs_reg(this, glsl_type::uvec4_type);<br>
> + fs_reg dest = vgrf(glsl_type::uvec4_type);<br>
> fs_reg *sources = ralloc_array(mem_ctx, fs_reg, components);<br>
><br>
> /* parameters are: u, v, r; missing parameters are treated as zero */<br>
> for (int i = 0; i < components; i++) {<br>
> - sources[i] = fs_reg(this, glsl_type::float_type);<br>
> + sources[i] = vgrf(glsl_type::float_type);<br>
> emit(MOV(retype(sources[i], BRW_REGISTER_TYPE_D), coordinate));<br>
> coordinate = offset(coordinate, 1);<br>
> }<br>
> @@ -2036,7 +2036,7 @@ fs_visitor::emit_texture(ir_texture_opcode op,<br>
> int swiz = GET_SWZ(tex->swizzles[sampler], gather_component);<br>
> if (swiz == SWIZZLE_ZERO || swiz == SWIZZLE_ONE) {<br>
><br>
> - fs_reg res = fs_reg(this, glsl_type::vec4_type);<br>
> + fs_reg res = vgrf(glsl_type::vec4_type);<br>
> this->result = res;<br>
><br>
> for (int i=0; i<4; i++) {<br>
> @@ -2058,7 +2058,7 @@ fs_visitor::emit_texture(ir_texture_opcode op,<br>
> /* Writemasking doesn't eliminate channels on SIMD8 texture<br>
> * samples, so don't worry about them.<br>
> */<br>
> - fs_reg dst(this, glsl_type::get_instance(dest_type->base_type, 4, 1));<br>
> + fs_reg dst = vgrf(glsl_type::get_instance(dest_type->base_type, 4, 1));<br>
><br>
> if (brw->gen >= 7) {<br>
> inst = emit_texture_gen7(op, dst, coordinate, coord_components,<br>
> @@ -2093,7 +2093,7 @@ fs_visitor::emit_texture(ir_texture_opcode op,<br>
> /* fixup #layers for cube map arrays */<br>
> if (op == ir_txs && is_cube_array) {<br>
> fs_reg depth = offset(dst, 2);<br>
> - fs_reg fixed_depth = fs_reg(this, glsl_type::int_type);<br>
> + fs_reg fixed_depth = vgrf(glsl_type::int_type);<br>
> emit_math(SHADER_OPCODE_INT_QUOTIENT, fixed_depth, depth, fs_reg(6));<br>
><br>
> fs_reg *fixed_payload = ralloc_array(mem_ctx, fs_reg, inst->regs_written);<br>
> @@ -2142,7 +2142,7 @@ fs_visitor::visit(ir_texture *ir)<br>
><br>
> /* Emit code to evaluate the actual indexing expression */<br>
> nonconst_sampler_index->accept(this);<br>
> - fs_reg temp(this, glsl_type::uint_type);<br>
> + fs_reg temp = vgrf(glsl_type::uint_type);<br>
> emit(ADD(temp, this->result, fs_reg(sampler)))<br>
> ->force_writemask_all = true;<br>
> sampler_reg = temp;<br>
> @@ -2342,7 +2342,7 @@ fs_visitor::swizzle_result(ir_texture_opcode op, int dest_components,<br>
> if (dest_components == 1) {<br>
> /* Ignore DEPTH_TEXTURE_MODE swizzling. */<br>
> } else if (tex->swizzles[sampler] != SWIZZLE_NOOP) {<br>
> - fs_reg swizzled_result = fs_reg(this, glsl_type::vec4_type);<br>
> + fs_reg swizzled_result = vgrf(glsl_type::vec4_type);<br>
> swizzled_result.type = orig_val.type;<br>
><br>
> for (int i = 0; i < 4; i++) {<br>
> @@ -2374,7 +2374,7 @@ fs_visitor::visit(ir_swizzle *ir)<br>
> return;<br>
> }<br>
><br>
> - fs_reg result = fs_reg(this, ir->type);<br>
> + fs_reg result = vgrf(ir->type);<br>
> this->result = result;<br>
><br>
> for (unsigned int i = 0; i < ir->type->vector_elements; i++) {<br>
> @@ -2442,7 +2442,7 @@ fs_visitor::visit(ir_constant *ir)<br>
> * Make reg constant so that it doesn't get accidentally modified along the<br>
> * way. Yes, I actually had this problem. :(<br>
> */<br>
> - const fs_reg reg(this, ir->type);<br>
> + const fs_reg reg = vgrf(ir->type);<br>
> fs_reg dst_reg = reg;<br>
><br>
> if (ir->type->is_array()) {<br>
> @@ -2536,7 +2536,7 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)<br>
><br>
> case ir_binop_logic_xor:<br>
> if (brw->gen <= 5) {<br>
> - fs_reg temp = fs_reg(this, ir->type);<br>
> + fs_reg temp = vgrf(ir->type);<br>
> emit(XOR(temp, op[0], op[1]));<br>
> inst = emit(AND(reg_null_d, temp, fs_reg(1)));<br>
> } else {<br>
> @@ -2547,7 +2547,7 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)<br>
><br>
> case ir_binop_logic_or:<br>
> if (brw->gen <= 5) {<br>
> - fs_reg temp = fs_reg(this, ir->type);<br>
> + fs_reg temp = vgrf(ir->type);<br>
> emit(OR(temp, op[0], op[1]));<br>
> inst = emit(AND(reg_null_d, temp, fs_reg(1)));<br>
> } else {<br>
> @@ -2558,7 +2558,7 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)<br>
><br>
> case ir_binop_logic_and:<br>
> if (brw->gen <= 5) {<br>
> - fs_reg temp = fs_reg(this, ir->type);<br>
> + fs_reg temp = vgrf(ir->type);<br>
> emit(AND(temp, op[0], op[1]));<br>
> inst = emit(AND(reg_null_d, temp, fs_reg(1)));<br>
> } else {<br>
> @@ -2608,7 +2608,7 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)<br>
> inst->conditional_mod = BRW_CONDITIONAL_NZ;<br>
><br>
> /* Select which boolean to return. */<br>
> - fs_reg temp(this, expr->operands[1]->type);<br>
> + fs_reg temp = vgrf(expr->operands[1]->type);<br>
> inst = emit(SEL(temp, op[1], op[2]));<br>
> inst->predicate = BRW_PREDICATE_NORMAL;<br>
><br>
> @@ -2655,13 +2655,13 @@ fs_visitor::emit_if_gen6(ir_if *ir)<br>
> return;<br>
><br>
> case ir_binop_logic_or:<br>
> - temp = fs_reg(this, glsl_type::bool_type);<br>
> + temp = vgrf(glsl_type::bool_type);<br>
> emit(OR(temp, op[0], op[1]));<br>
> emit(IF(temp, fs_reg(0), BRW_CONDITIONAL_NZ));<br>
> return;<br>
><br>
> case ir_binop_logic_and:<br>
> - temp = fs_reg(this, glsl_type::bool_type);<br>
> + temp = vgrf(glsl_type::bool_type);<br>
> emit(AND(temp, op[0], op[1]));<br>
> emit(IF(temp, fs_reg(0), BRW_CONDITIONAL_NZ));<br>
> return;<br>
> @@ -2698,7 +2698,7 @@ fs_visitor::emit_if_gen6(ir_if *ir)<br>
> inst->conditional_mod = BRW_CONDITIONAL_NZ;<br>
><br>
> /* Select which boolean to use as the result. */<br>
> - fs_reg temp(this, expr->operands[1]->type);<br>
> + fs_reg temp = vgrf(expr->operands[1]->type);<br>
> inst = emit(SEL(temp, op[1], op[2]));<br>
> inst->predicate = BRW_PREDICATE_NORMAL;<br>
><br>
> @@ -2779,7 +2779,7 @@ fs_visitor::try_replace_with_sel()<br>
> */<br>
> fs_reg src0(then_mov->src[0]);<br>
> if (src0.file == IMM) {<br>
> - src0 = fs_reg(this, glsl_type::float_type);<br>
> + src0 = vgrf(glsl_type::float_type);<br>
> src0.type = then_mov->src[0].type;<br>
> emit(MOV(src0, then_mov->src[0]));<br>
> }<br>
> @@ -2881,13 +2881,13 @@ fs_visitor::visit_atomic_counter_intrinsic(ir_call *ir)<br>
> location->data.binding);<br>
><br>
> /* Calculate the surface offset */<br>
> - fs_reg offset(this, glsl_type::uint_type);<br>
> + fs_reg offset = vgrf(glsl_type::uint_type);<br>
> ir_dereference_array *deref_array = deref->as_dereference_array();<br>
><br>
> if (deref_array) {<br>
> deref_array->array_index->accept(this);<br>
><br>
> - fs_reg tmp(this, glsl_type::uint_type);<br>
> + fs_reg tmp = vgrf(glsl_type::uint_type);<br>
> emit(MUL(tmp, this->result, fs_reg(ATOMIC_COUNTER_SIZE)));<br>
> emit(ADD(offset, tmp, fs_reg(location->data.atomic.offset)));<br>
> } else {<br>
> @@ -3000,19 +3000,19 @@ fs_visitor::emit_untyped_atomic(unsigned atomic_op, unsigned surf_index,<br>
> length++;<br>
><br>
> /* Set the atomic operation offset. */<br>
> - sources[1] = fs_reg(this, glsl_type::uint_type);<br>
> + sources[1] = vgrf(glsl_type::uint_type);<br>
> emit(MOV(sources[1], offset));<br>
> length++;<br>
><br>
> /* Set the atomic operation arguments. */<br>
> if (src0.file != BAD_FILE) {<br>
> - sources[length] = fs_reg(this, glsl_type::uint_type);<br>
> + sources[length] = vgrf(glsl_type::uint_type);<br>
> emit(MOV(sources[length], src0));<br>
> length++;<br>
> }<br>
><br>
> if (src1.file != BAD_FILE) {<br>
> - sources[length] = fs_reg(this, glsl_type::uint_type);<br>
> + sources[length] = vgrf(glsl_type::uint_type);<br>
> emit(MOV(sources[length], src1));<br>
> length++;<br>
> }<br>
> @@ -3054,7 +3054,7 @@ fs_visitor::emit_untyped_surface_read(unsigned surf_index, fs_reg dst,<br>
> }<br>
><br>
> /* Set the surface read offset. */<br>
> - sources[1] = fs_reg(this, glsl_type::uint_type);<br>
> + sources[1] = vgrf(glsl_type::uint_type);<br>
> emit(MOV(sources[1], offset));<br>
><br>
> int mlen = 1 + reg_width;<br>
> @@ -3132,8 +3132,8 @@ void<br>
> fs_visitor::emit_interpolation_setup_gen4()<br>
> {<br>
> this->current_annotation = "compute pixel centers";<br>
> - this->pixel_x = fs_reg(this, glsl_type::uint_type);<br>
> - this->pixel_y = fs_reg(this, glsl_type::uint_type);<br>
> + this->pixel_x = vgrf(glsl_type::uint_type);<br>
> + this->pixel_y = vgrf(glsl_type::uint_type);<br>
> this->pixel_x.type = BRW_REGISTER_TYPE_UW;<br>
> this->pixel_y.type = BRW_REGISTER_TYPE_UW;<br>
><br>
> @@ -3143,14 +3143,14 @@ fs_visitor::emit_interpolation_setup_gen4()<br>
> this->current_annotation = "compute pixel deltas from v0";<br>
> if (brw->has_pln) {<br>
> this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC] =<br>
> - fs_reg(this, glsl_type::vec2_type);<br>
> + vgrf(glsl_type::vec2_type);<br>
> this->delta_y[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC] =<br>
> offset(this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC], 1);<br>
> } else {<br>
> this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC] =<br>
> - fs_reg(this, glsl_type::float_type);<br>
> + vgrf(glsl_type::float_type);<br>
> this->delta_y[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC] =<br>
> - fs_reg(this, glsl_type::float_type);<br>
> + vgrf(glsl_type::float_type);<br>
> }<br>
> emit(ADD(this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],<br>
> this->pixel_x, fs_reg(negate(brw_vec1_grf(1, 0)))));<br>
> @@ -3161,13 +3161,13 @@ fs_visitor::emit_interpolation_setup_gen4()<br>
> /* Compute wpos.w. It's always in our setup, since it's needed to<br>
> * interpolate the other attributes.<br>
> */<br>
> - this->wpos_w = fs_reg(this, glsl_type::float_type);<br>
> + this->wpos_w = vgrf(glsl_type::float_type);<br>
> emit(FS_OPCODE_LINTERP, wpos_w,<br>
> this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],<br>
> this->delta_y[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],<br>
> interp_reg(VARYING_SLOT_POS, 3));<br>
> /* Compute the pixel 1/W value from wpos.w. */<br>
> - this->pixel_w = fs_reg(this, glsl_type::float_type);<br>
> + this->pixel_w = vgrf(glsl_type::float_type);<br>
> emit_math(SHADER_OPCODE_RCP, this->pixel_w, wpos_w);<br>
> this->current_annotation = NULL;<br>
> }<br>
> @@ -3180,8 +3180,8 @@ fs_visitor::emit_interpolation_setup_gen6()<br>
><br>
> /* If the pixel centers end up used, the setup is the same as for gen4. */<br>
> this->current_annotation = "compute pixel centers";<br>
> - fs_reg int_pixel_x = fs_reg(this, glsl_type::uint_type);<br>
> - fs_reg int_pixel_y = fs_reg(this, glsl_type::uint_type);<br>
> + fs_reg int_pixel_x = vgrf(glsl_type::uint_type);<br>
> + fs_reg int_pixel_y = vgrf(glsl_type::uint_type);<br>
> int_pixel_x.type = BRW_REGISTER_TYPE_UW;<br>
> int_pixel_y.type = BRW_REGISTER_TYPE_UW;<br>
> emit(ADD(int_pixel_x,<br>
> @@ -3195,14 +3195,14 @@ fs_visitor::emit_interpolation_setup_gen6()<br>
> * to turn the integer pixel centers into floats for their actual<br>
> * use.<br>
> */<br>
> - this->pixel_x = fs_reg(this, glsl_type::float_type);<br>
> - this->pixel_y = fs_reg(this, glsl_type::float_type);<br>
> + this->pixel_x = vgrf(glsl_type::float_type);<br>
> + this->pixel_y = vgrf(glsl_type::float_type);<br>
> emit(MOV(this->pixel_x, int_pixel_x));<br>
> emit(MOV(this->pixel_y, int_pixel_y));<br>
><br>
> this->current_annotation = "compute pos.w";<br>
> this->pixel_w = fs_reg(brw_vec8_grf(payload.source_w_reg, 0));<br>
> - this->wpos_w = fs_reg(this, glsl_type::float_type);<br>
> + this->wpos_w = vgrf(glsl_type::float_type);<br>
> emit_math(SHADER_OPCODE_RCP, this->wpos_w, this->pixel_w);<br>
><br>
> for (int i = 0; i < BRW_WM_BARYCENTRIC_INTERP_MODE_COUNT; ++i) {<br>
> @@ -3433,7 +3433,7 @@ fs_visitor::emit_single_fb_write(fs_reg color0, fs_reg color1,<br>
> no16("Missing support for simd16 depth writes on gen6\n");<br>
> }<br>
><br>
> - sources[length] = fs_reg(this, glsl_type::float_type);<br>
> + sources[length] = vgrf(glsl_type::float_type);<br>
> if (prog->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {<br>
> /* Hand over gl_FragDepth. */<br>
> assert(this->frag_depth.file != BAD_FILE);<br>
> @@ -3447,7 +3447,7 @@ fs_visitor::emit_single_fb_write(fs_reg color0, fs_reg color1,<br>
> }<br>
><br>
> if (payload.dest_depth_reg) {<br>
> - sources[length] = fs_reg(this, glsl_type::float_type);<br>
> + sources[length] = vgrf(glsl_type::float_type);<br>
> emit(MOV(sources[length],<br>
> fs_reg(brw_vec8_grf(payload.dest_depth_reg, 0))));<br>
> length++;<br>
> @@ -3590,8 +3590,8 @@ void fs_visitor::compute_clip_distance()<br>
><br>
> current_annotation = "user clip distances";<br>
><br>
> - this->outputs[VARYING_SLOT_CLIP_DIST0] = fs_reg(this, glsl_type::vec4_type);<br>
> - this->outputs[VARYING_SLOT_CLIP_DIST1] = fs_reg(this, glsl_type::vec4_type);<br>
> + this->outputs[VARYING_SLOT_CLIP_DIST0] = vgrf(glsl_type::vec4_type);<br>
> + this->outputs[VARYING_SLOT_CLIP_DIST1] = vgrf(glsl_type::vec4_type);<br>
><br>
> for (int i = 0; i < key->nr_userclip_plane_consts; i++) {<br>
> fs_reg u = userplane[i];<br>
> @@ -3777,7 +3777,7 @@ fs_visitor::resolve_ud_negate(fs_reg *reg)<br>
> !reg->negate)<br>
> return;<br>
><br>
> - fs_reg temp = fs_reg(this, glsl_type::uint_type);<br>
> + fs_reg temp = vgrf(glsl_type::uint_type);<br>
> emit(MOV(temp, *reg));<br>
> *reg = temp;<br>
> }<br>
> @@ -3796,8 +3796,8 @@ fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)<br>
> if (rvalue->type != glsl_type::bool_type)<br>
> return;<br>
><br>
> - fs_reg and_result = fs_reg(this, glsl_type::bool_type);<br>
> - fs_reg neg_result = fs_reg(this, glsl_type::bool_type);<br>
> + fs_reg and_result = vgrf(glsl_type::bool_type);<br>
> + fs_reg neg_result = vgrf(glsl_type::bool_type);<br>
> emit(AND(and_result, *reg, fs_reg(1)));<br>
> emit(MOV(neg_result, negate(and_result)));<br>
> *reg = neg_result;<br>
> --<br>
> 2.2.2<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>