[Mesa-dev] [PATCH] i965/vec4: don't copy ATTR into 3src instructions with complex swizzles

Ilia Mirkin imirkin at alum.mit.edu
Sun Jan 17 17:30:14 PST 2016


The vec4 backend, at the end, does this:

    if (inst->is_3src()) {
       for (int i = 0; i < 3; i++) {
          if (inst->src[i].vstride == BRW_VERTICAL_STRIDE_0)
             assert(brw_is_single_value_swizzle(inst->src[i].swizzle));

So make sure that we use the same conditions when trying to
copy-propagate. UNIFORMs will be converted to vstride 0 in
convert_to_hw_regs, but so will ATTRs when interleaved (as will happen
in a GS with multiple attributes). Since the vstride may not be properly
set at copy-prop time, just reject all ATTRs with complex swizzles as
well.

Fixes assertion errors in dolphin-generated geometry shaders (or
misrendering on opt builds).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93418
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>
---

Wasn't sure if it was worth the effort of still allowing ATTR when it was not going to get interleaved (which is, admittedly, the vast majority of the time). But it's just for 3-src instructions...

 src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index c6f0b0d..b7435c3 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -320,7 +320,7 @@ try_copy_propagate(const struct brw_device_info *devinfo,
    unsigned composed_swizzle = brw_compose_swizzle(inst->src[arg].swizzle,
                                                    value.swizzle);
    if (inst->is_3src() &&
-       value.file == UNIFORM &&
+       (value.file == UNIFORM || value.file == ATTR) &&
        !brw_is_single_value_swizzle(composed_swizzle))
       return false;
 
-- 
2.4.10



More information about the mesa-dev mailing list