Mesa (master): softpipe: fix 32-bit bitfield extract

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 21 23:32:36 UTC 2019


Module: Mesa
Branch: master
Commit: 7b7cb1bc35cf9ec5d0acb9dd6ea8d7da95c962cb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b7cb1bc35cf9ec5d0acb9dd6ea8d7da95c962cb

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Mar 21 14:13:48 2019 +1000

softpipe: fix 32-bit bitfield extract

These didn't deal with the width == 32 case that TGSI is defined with.

Fixes piglit tests if ARB_gpu_shader5 is enabled.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 99edf33c22e..f66df18c7f5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -4912,8 +4912,13 @@ micro_ibfe(union tgsi_exec_channel *dst,
 {
    int i;
    for (i = 0; i < 4; i++) {
-      int width = src2->i[i] & 0x1f;
+      int width = src2->i[i];
       int offset = src1->i[i] & 0x1f;
+      if (width == 32 && offset == 0) {
+         dst->i[i] = src0->i[i];
+         continue;
+      }
+      width &= 0x1f;
       if (width == 0)
          dst->i[i] = 0;
       else if (width + offset < 32)
@@ -4934,8 +4939,13 @@ micro_ubfe(union tgsi_exec_channel *dst,
 {
    int i;
    for (i = 0; i < 4; i++) {
-      int width = src2->u[i] & 0x1f;
+      int width = src2->u[i];
       int offset = src1->u[i] & 0x1f;
+      if (width == 32 && offset == 0) {
+         dst->u[i] = src0->u[i];
+         continue;
+      }
+      width &= 0x1f;
       if (width == 0)
          dst->u[i] = 0;
       else if (width + offset < 32)




More information about the mesa-commit mailing list