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

Author: Eric Anholt <e...@anholt.net>
Date:   Tue Jan  5 11:15:06 2021 -0800

gallium/tgsi_exec: Add support for PIPE_CAP_LOAD_CONSTBUF.

Now that we can end up in nir-to-tgsi in the draw fallback paths of
drivers with that flag set, we need to support it.

Reviewed-by: Marek Olšák <marek.ol...@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index f17d61c2c7c..8eaae4e46e3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -3903,7 +3903,7 @@ exec_load_membuf(struct tgsi_exec_machine *mach,
    uint32_t unit = fetch_sampler_unit(mach, inst, 0);
 
    uint32_t size;
-   char *ptr;
+   const char *ptr;
    switch (inst->Src[0].Register.File) {
    case TGSI_FILE_MEMORY:
       ptr = mach->LocalMem;
@@ -3914,6 +3914,16 @@ exec_load_membuf(struct tgsi_exec_machine *mach,
       ptr = mach->Buffer->lookup(mach->Buffer, unit, &size);
       break;
 
+   case TGSI_FILE_CONSTANT:
+      if (unit < ARRAY_SIZE(mach->Consts)) {
+         ptr = mach->Consts[unit];
+         size = mach->ConstsSize[unit];
+      } else {
+         ptr = NULL;
+         size = 0;
+      }
+      break;
+
    default:
       unreachable("unsupported TGSI_OPCODE_LOAD file");
    }

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

Reply via email to