[Mesa-dev] [RFC 2/4] gallium: Add fixed block size to pipe_compute_state
Marek Olšák
maraeo at gmail.com
Sun Mar 27 17:38:47 UTC 2016
If this is only needed by TGSI, adding TGSI properties is preferred.
Marek
On Fri, Mar 25, 2016 at 2:43 AM, Bas Nieuwenhuizen
<bas at basnieuwenhuizen.nl> wrote:
> This avoids shader variants for radeonsi, or if we go with
> shader variants, it lets us compile an initial variant.
>
> Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> ---
> src/gallium/drivers/trace/tr_dump_state.c | 4 ++++
> src/gallium/include/pipe/p_state.h | 6 ++++++
> src/gallium/tests/trivial/compute.c | 1 +
> src/mesa/state_tracker/st_program.c | 2 ++
> 4 files changed, 13 insertions(+)
>
> diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
> index 394cdaa..4f89af9 100644
> --- a/src/gallium/drivers/trace/tr_dump_state.c
> +++ b/src/gallium/drivers/trace/tr_dump_state.c
> @@ -333,6 +333,10 @@ void trace_dump_compute_state(const struct pipe_compute_state *state)
> trace_dump_member(uint, state, req_private_mem);
> trace_dump_member(uint, state, req_input_mem);
>
> + trace_dump_member_begin("fixed_block");
> + trace_dump_array(uint, state->fixed_block, Elements(state->fixed_block));
> + trace_dump_member_end();
> +
> trace_dump_struct_end();
> }
>
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index 8e7a10b..fff90e7 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -732,6 +732,12 @@ struct pipe_compute_state
> unsigned req_local_mem; /**< Required size of the LOCAL resource. */
> unsigned req_private_mem; /**< Required size of the PRIVATE resource. */
> unsigned req_input_mem; /**< Required size of the INPUT resource. */
> +
> + /**
> + * Block layout if known, or all zeroes if the block layout is either not
> + * known yet or dynamic.
> + */
> + unsigned fixed_block[3];
> };
>
> /**
> diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c
> index 2ddfc42..af3e3aa 100644
> --- a/src/gallium/tests/trivial/compute.c
> +++ b/src/gallium/tests/trivial/compute.c
> @@ -149,6 +149,7 @@ static void init_prog(struct context *ctx, unsigned local_sz,
> .req_local_mem = local_sz,
> .req_private_mem = private_sz,
> .req_input_mem = input_sz
> + .fixed_block = {0}
> };
> char *psrc = preprocess_prog(ctx, src, defs);
> int ret;
> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
> index 5e282d9..5777e76 100644
> --- a/src/mesa/state_tracker/st_program.c
> +++ b/src/mesa/state_tracker/st_program.c
> @@ -1440,6 +1440,8 @@ st_translate_compute_program(struct st_context *st,
> stcp->tgsi.req_local_mem = stcp->Base.SharedSize;
> stcp->tgsi.req_private_mem = 0;
> stcp->tgsi.req_input_mem = 0;
> + memcpy(stcp->tgsi.fixed_block, stcp->Base.LocalSize,
> + sizeof(stcp->Base.LocalSize));
>
> free_glsl_to_tgsi_visitor(stcp->glsl_to_tgsi);
> stcp->glsl_to_tgsi = NULL;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list