[Bug 82574] New: GLSL: opt_vectorize goes wrong on texture lookups

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Aug 13 10:38:18 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=82574

          Priority: medium
            Bug ID: 82574
          Assignee: idr at freedesktop.org
           Summary: GLSL: opt_vectorize goes wrong on texture lookups
        QA Contact: intel-3d-bugs at lists.freedesktop.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: aras at unity3d.com
          Hardware: All
            Status: NEW
           Version: git
         Component: glsl-compiler
           Product: Mesa

Looks like opt_vectorize is too eager on texture lookups. For example, a shader
like this (which does a color correction effect by looking up R,G,B channels
into a ramp texture):

uniform sampler2D _MainTex;
uniform sampler2D _RampTex;
varying vec2 varUV;
void main()
{
  vec4 orig = texture2D (_MainTex, varUV);
  float rr = texture2D (_RampTex, orig.xx).x;
  float gg = texture2D (_RampTex, orig.yy).y;
  float bb = texture2D (_RampTex, orig.zz).z;
  vec4 color = vec4 (rr, gg, bb, orig.w);
  gl_FragData[0] = color;
}

These 3 lookups effectively get vectorized into something like a:

  t.xyz = texture2DProj (_RampTex, t.xyz).xyz;


I can make this bug go away by stopping vectorizing on texture samples, i.e.
adding something like this to opt_vectorize.cpp:


/**
 * Upon entering an ir_texture, remove the current assignment from
 * further consideration. Vectorizing multiple texture lookups into one
 * is wrong.
 */
ir_visitor_status
ir_vectorize_visitor::visit_enter(ir_texture *)
{
   this->current_assignment = NULL;
   return visit_continue_with_parent;
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20140813/df3aaef3/attachment.html>


More information about the intel-3d-bugs mailing list