All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nouveau: codegen: Take src swizzle into account on loads
@ 2016-04-07 13:27 Hans de Goede
       [not found] ` <1460035648-3804-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Hans de Goede @ 2016-04-07 13:27 UTC (permalink / raw)
  To: Ilia Mirkin, Samuel Pitoiset; +Cc: mesa-dev, nouveau

The llvm TGSI backend does things like:

LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0].x

Expecting the data at address TEMP[0].x to get loaded to
TEMP[0].y. Before this commit the data at TEMP[0].x + 4 would be
loaded instead. This commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index 557608e..cc51f5a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -2279,12 +2279,16 @@ Converter::handleLOAD(Value *dst0[4])
 
          Value *off = fetchSrc(1, c);
          Symbol *sym;
+         uint32_t src0_component_offset = tgsi.getSrc(0).getSwizzle(c) * 4;
+
          if (tgsi.getSrc(1).getFile() == TGSI_FILE_IMMEDIATE) {
             off = NULL;
             sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,
-                          tgsi.getSrc(1).getValueU32(0, info) + 4 * c);
+                          tgsi.getSrc(1).getValueU32(0, info) +
+                          src0_component_offset);
          } else {
-            sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c, 4 * c);
+            sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,
+                          src0_component_offset);
          }
 
          Instruction *ld = mkLoad(TYPE_U32, dst0[c], sym, off);
-- 
2.7.3

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-04-08 16:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-07 13:27 [PATCH] nouveau: codegen: Take src swizzle into account on loads Hans de Goede
     [not found] ` <1460035648-3804-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-07 13:58   ` Ilia Mirkin
     [not found]     ` <CAKb7Uvhf=6TngukZe976+fX2zibE6U4D05zYOUEj_F5mCVKOBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-08  9:27       ` Hans de Goede
     [not found]         ` <5707797B.4040708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-08 13:56           ` Ilia Mirkin
2016-04-08 15:02           ` Ilia Mirkin
     [not found]             ` <CAKb7UvjhSJGCH2bLJWc+A8hOUepR8=AnjKjLWTW9ipr44N2NnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-08 15:28               ` Hans de Goede
     [not found]                 ` <5707CE34.6050904-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-08 15:45                   ` Ilia Mirkin
     [not found]                     ` <CAKb7Uvg5c1NorKA3uvnXfToZb+QUwRzZ0T9cUaA5jEuiBma+gA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-08 16:06                       ` Hans de Goede
2016-04-08 16:26                         ` [Nouveau] " Hans de Goede
2016-04-08 16:34                           ` Ilia Mirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.