Module: Mesa Branch: master Commit: c27cbfd9ed5335e1c5f728c0fc92e5dd048fe99b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c27cbfd9ed5335e1c5f728c0fc92e5dd048fe99b
Author: Eric Anholt <[email protected]> Date: Tue Dec 22 13:37:54 2020 -0800 gallium/tgsi_exec: Stop doing the weird allocation of the Addrs array. Saves an indirection on referencing the address regs, and also my sanity. Reviewed-by: Adam Jackson <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8283> --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 4 ++-- src/gallium/auxiliary/tgsi/tgsi_exec.h | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 1db19914451..0eea711e9be 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1264,7 +1264,6 @@ tgsi_exec_machine_create(enum pipe_shader_type shader_type) memset(mach, 0, sizeof(*mach)); mach->ShaderType = shader_type; - mach->Addrs = &mach->Temps[TGSI_EXEC_TEMP_ADDR]; mach->MaxGeometryShaderOutputs = TGSI_MAX_TOTAL_VERTICES; if (shader_type != PIPE_SHADER_COMPUTE) { @@ -1528,7 +1527,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach, case TGSI_FILE_ADDRESS: for (i = 0; i < TGSI_QUAD_SIZE; i++) { - assert(index->i[i] >= 0); + assert(index->i[i] >= 0 && index->i[i] < ARRAY_SIZE(mach->Addrs)); assert(index2D->i[i] == 0); chan->u[i] = mach->Addrs[index->i[i]].xyzw[swizzle].u[i]; @@ -1893,6 +1892,7 @@ store_dest_dstret(struct tgsi_exec_machine *mach, case TGSI_FILE_ADDRESS: index = reg->Register.Index; + assert(index >= 0 && index < ARRAY_SIZE(mach->Addrs)); dst = &mach->Addrs[index].xyzw[chan_index]; break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 16f44c3736f..e3d190939b5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -224,10 +224,7 @@ struct tgsi_sampler #define TGSI_EXEC_TEMP_R0 (TGSI_EXEC_NUM_TEMPS + 1) #define TGSI_EXEC_NUM_TEMP_R 4 -#define TGSI_EXEC_TEMP_ADDR (TGSI_EXEC_NUM_TEMPS + 5) -#define TGSI_EXEC_NUM_ADDRS 3 - -#define TGSI_EXEC_NUM_TEMP_EXTRAS 8 +#define TGSI_EXEC_NUM_TEMP_EXTRAS 5 @@ -321,7 +318,7 @@ struct tgsi_exec_machine unsigned SysSemanticToIndex[TGSI_SEMANTIC_COUNT]; struct tgsi_exec_vector SystemValue[TGSI_MAX_MISC_INPUTS]; - struct tgsi_exec_vector *Addrs; + struct tgsi_exec_vector Addrs[3]; struct tgsi_sampler *Sampler; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
