On Sun, 2012-06-03 at 14:30 -0700, Kenneth Graunke wrote:
> On 06/03/2012 10:15 AM, Matt Turner wrote:
> > It seems that we already do this.
> > ---
> >  src/glsl/TODO |    3 ---
> >  1 files changed, 0 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/glsl/TODO b/src/glsl/TODO
> > index eb73fc2..bd077a8 100644
> > --- a/src/glsl/TODO
> > +++ b/src/glsl/TODO
> > @@ -6,9 +6,6 @@
> >    constant index values.  For others it is more complicated.  Perhaps these
> >    cases should be silently converted to uniforms?
> >  
> > -- Implement support for ir_binop_dot in opt_algebraic.cpp.  Perform
> > -  transformations such as "dot(v, vec3(0.0, 1.0, 0.0))" -> v.y.
> > -
> >  - Track source locations throughout the IR.  There are currently several
> >    places where we cannot emit line numbers for errors (and currently emit 
> > 0:0)
> >    because we've "lost" the line number information.  This is particularly
> 
> We do?  Considering there's no instance of ir_binop_dot in
> opt_algebraic.cpp, I'm a bit skeptical :)

I could of course be mistaken, but consider the following fragment
shader:

varying vec3 light;
void main() {
        const vec4 DiffuseColor = vec4(0.9, 0.9, 0.9, 1.0);
        float DiffuseTerm = dot(vec3(0.0, 1.0, 0.0), light);
        gl_FragColor = DiffuseColor * DiffuseTerm;
}

>From this, we generate this GLSL IR:

(
(declare (temporary ) float light_y)
(declare (out ) vec4 gl_FragColor)
(function main
  (signature void
    (parameters
    )
    (
      (assign  (x) (var_ref gl_FragColor)  (expression float * (constant
float (0.900000)) (var_ref light_y) ) ) 
      (assign  (y) (var_ref gl_FragColor)  (expression float * (constant
float (0.900000)) (var_ref light_y) ) ) 
      (assign  (z) (var_ref gl_FragColor)  (expression float * (constant
float (0.900000)) (var_ref light_y) ) ) 
      (assign  (w) (var_ref gl_FragColor)  (var_ref light_y) ) 
    ))

)
)

I don't claim to understand how (obviously there's no ir_binop_dot in
opt_algebraic.cpp, so) but it looks like we're already getting the
result of the TODO.

The other part that I thought opt_algebraic.cpp's ir_binop_dot case
should handle was zero vectors, but they're already handled as well. I
presume because dot is lowered into mul/madd which already handle zero
vectors.

Does this sound right, or did I miss some piece?

Thanks,
Matt

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to