From e109f5ea0f6c94a31cfeb5221f0ecc89e827e02d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 5 Jan 2021 11:15:06 -0800 Subject: [PATCH] gallium/tgsi_exec: Add support for PIPE_CAP_LOAD_CONSTBUF. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- 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"); }