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.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
This commit is contained in:
Eric Anholt 2021-01-05 11:15:06 -08:00
parent 911bb08314
commit e109f5ea0f
1 changed files with 11 additions and 1 deletions

View File

@ -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");
}