Bug 109317 - piglit.spec.glsl-1_20.execution.out-parameter-indexing.fs-inout-index-two-level:
Summary: piglit.spec.glsl-1_20.execution.out-parameter-indexing.fs-inout-index-two-level:
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Matt Turner
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Reported: 2019-01-11 16:06 UTC by Mark Janes
Modified: 2019-01-14 01:11 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
Description Mark Janes 2019-01-11 16:06:36 UTC
/tmp/build_root/m64/lib/piglit/bin/shader_runner /tmp/build_root/m64/lib/piglit/tests/spec/glsl-1.20/execution/out-parameter-indexing/fs-inout-index-two-level.shader_test -auto -fbo
Probe color at (0,0)
  Expected: 0 255 0 255
  Observed: 255 51 0 0
Test failure on line 48

Bisected to:
Author:     Timothy Arceri <tarceri@itsqueeze.com>

glsl: Copy function out to temp if we don't directly ref a variable

Otherwise we can end up with IR that looks like this:

      (declare (temporary ) vec4 f@8)
      (assign  (xyzw) (var_ref f@8)  (var_ref f) )
      (call f16  ((swiz y (var_ref f@8) )))

      (assign  (xyzw) (var_ref f)  (var_ref f@8) )

When we really need:

      (declare (temporary ) float inout_tmp)
      (assign  (x) (var_ref inout_tmp)  (swiz y (var_ref f) ))
      (call f16  ((var_ref inout_tmp) ))

      (assign  (y) (var_ref f)  (swiz y (swiz xxxx (var_ref inout_tmp) )))
      (declare (temporary ) void void_var)

The GLSL IR function inlining code seemed to produce correct code
even without this but we need the correct IR for GLSL IR -> NIR to
be able to understand whats going on.
Comment 2 Timothy Arceri 2019-01-14 01:11:07 UTC
Should be fixed by:

commit 0862929bf64222e85e8242824aecf05e494c157c
Author: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Date:   Thu Jan 10 18:16:59 2019 +0200

    glsl: Fix copying function's out to temp if dereferenced by array
    Function's out variable could be an array dereferenced by an array:
    or something more complicated.
    Copy index in any case.
    Fixes: 76c27e47b906 ("glsl: Copy function out to temp if we don't directly ref a variable")
    Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
    Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.