[Mesa-dev,19/32] i965/vec4: Pass dst register to the vec4_instruction constructor.

Submitted by Francisco Jerez on Feb. 6, 2015, 2:42 p.m.

Details

Message ID 1423233792-11767-19-git-send-email-currojerez@riseup.net
State New
Headers show

Not browsing as part of any series.

Commit Message

Francisco Jerez Feb. 6, 2015, 2:42 p.m.
So regs_written gets initialized with a sensible value.
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index babddee..514de11 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2384,12 +2384,11 @@  vec4_visitor::visit(ir_call *ir)
 src_reg
 vec4_visitor::emit_mcs_fetch(ir_texture *ir, src_reg coordinate, src_reg sampler)
 {
-   vec4_instruction *inst = new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS);
+   vec4_instruction *inst =
+      new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS,
+                                    dst_reg(this, glsl_type::uvec4_type));
    inst->base_mrf = 2;
    inst->mlen = 1;
-   inst->dst = dst_reg(this, glsl_type::uvec4_type);
-   inst->dst.writemask = WRITEMASK_XYZW;
-
    inst->src[1] = sampler;
 
    /* parameters are: u, v, r, lod; lod will always be zero due to api restrictions */
@@ -2562,7 +2561,8 @@  vec4_visitor::visit(ir_texture *ir)
       unreachable("Unrecognized tex op");
    }
 
-   vec4_instruction *inst = new(mem_ctx) vec4_instruction(opcode);
+   vec4_instruction *inst = new(mem_ctx) vec4_instruction(
+      opcode, dst_reg(this, ir->type));
 
    if (ir->offset != NULL && !has_nonconstant_offset) {
       inst->offset =
@@ -2587,7 +2587,6 @@  vec4_visitor::visit(ir_texture *ir)
       is_high_sampler(brw, sampler_reg);
    inst->base_mrf = 2;
    inst->mlen = inst->header_present + 1; /* always at least one */
-   inst->dst = dst_reg(this, ir->type);
    inst->dst.writemask = WRITEMASK_XYZW;
    inst->shadow_compare = ir->shadow_comparitor != NULL;
 

Comments

On Fri, Feb 6, 2015 at 6:42 AM, Francisco Jerez <currojerez@riseup.net> wrote:
> So regs_written gets initialized with a sensible value.
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index babddee..514de11 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2384,12 +2384,11 @@ vec4_visitor::visit(ir_call *ir)
>  src_reg
>  vec4_visitor::emit_mcs_fetch(ir_texture *ir, src_reg coordinate, src_reg sampler)
>  {
> -   vec4_instruction *inst = new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS);
> +   vec4_instruction *inst =
> +      new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS,
> +                                    dst_reg(this, glsl_type::uvec4_type));
>     inst->base_mrf = 2;
>     inst->mlen = 1;
> -   inst->dst = dst_reg(this, glsl_type::uvec4_type);
> -   inst->dst.writemask = WRITEMASK_XYZW;
> -
>     inst->src[1] = sampler;
>
>     /* parameters are: u, v, r, lod; lod will always be zero due to api restrictions */
> @@ -2562,7 +2561,8 @@ vec4_visitor::visit(ir_texture *ir)
>        unreachable("Unrecognized tex op");
>     }
>
> -   vec4_instruction *inst = new(mem_ctx) vec4_instruction(opcode);
> +   vec4_instruction *inst = new(mem_ctx) vec4_instruction(
> +      opcode, dst_reg(this, ir->type));
>
>     if (ir->offset != NULL && !has_nonconstant_offset) {
>        inst->offset =
> @@ -2587,7 +2587,6 @@ vec4_visitor::visit(ir_texture *ir)
>        is_high_sampler(brw, sampler_reg);
>     inst->base_mrf = 2;
>     inst->mlen = inst->header_present + 1; /* always at least one */
> -   inst->dst = dst_reg(this, ir->type);
>     inst->dst.writemask = WRITEMASK_XYZW;

I think you probably want to delete this line too?

If so,

Reviewed-by: Matt Turner <mattst88@gmail.com>
Matt Turner <mattst88@gmail.com> writes:

> On Fri, Feb 6, 2015 at 6:42 AM, Francisco Jerez <currojerez@riseup.net> wrote:
>> So regs_written gets initialized with a sensible value.
>> ---
>>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 +++++------
>>  1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> index babddee..514de11 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> @@ -2384,12 +2384,11 @@ vec4_visitor::visit(ir_call *ir)
>>  src_reg
>>  vec4_visitor::emit_mcs_fetch(ir_texture *ir, src_reg coordinate, src_reg sampler)
>>  {
>> -   vec4_instruction *inst = new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS);
>> +   vec4_instruction *inst =
>> +      new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS,
>> +                                    dst_reg(this, glsl_type::uvec4_type));
>>     inst->base_mrf = 2;
>>     inst->mlen = 1;
>> -   inst->dst = dst_reg(this, glsl_type::uvec4_type);
>> -   inst->dst.writemask = WRITEMASK_XYZW;
>> -
>>     inst->src[1] = sampler;
>>
>>     /* parameters are: u, v, r, lod; lod will always be zero due to api restrictions */
>> @@ -2562,7 +2561,8 @@ vec4_visitor::visit(ir_texture *ir)
>>        unreachable("Unrecognized tex op");
>>     }
>>
>> -   vec4_instruction *inst = new(mem_ctx) vec4_instruction(opcode);
>> +   vec4_instruction *inst = new(mem_ctx) vec4_instruction(
>> +      opcode, dst_reg(this, ir->type));
>>
>>     if (ir->offset != NULL && !has_nonconstant_offset) {
>>        inst->offset =
>> @@ -2587,7 +2587,6 @@ vec4_visitor::visit(ir_texture *ir)
>>        is_high_sampler(brw, sampler_reg);
>>     inst->base_mrf = 2;
>>     inst->mlen = inst->header_present + 1; /* always at least one */
>> -   inst->dst = dst_reg(this, ir->type);
>>     inst->dst.writemask = WRITEMASK_XYZW;
>
> I think you probably want to delete this line too?
>
> If so,
>
> Reviewed-by: Matt Turner <mattst88@gmail.com>

Thanks, fixed it locally.