[Mesa-dev] [PATCH 5/8] radeonsi: add a new helper si_get_vs
Marek Olšák
maraeo at gmail.com
Wed Jun 7 16:33:35 UTC 2017
On Mon, Jun 5, 2017 at 10:32 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
>
> On 06/05/2017 06:50 PM, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>> src/gallium/drivers/radeonsi/si_pipe.h | 30
>> ++++++++++++++-----------
>> src/gallium/drivers/radeonsi/si_state_shaders.c | 6 ++---
>> 2 files changed, 19 insertions(+), 17 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.h
>> b/src/gallium/drivers/radeonsi/si_pipe.h
>> index 9364ef2..c5e6e7d 100644
>> --- a/src/gallium/drivers/radeonsi/si_pipe.h
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.h
>> @@ -484,40 +484,44 @@ si_is_atom_dirty(struct si_context *sctx,
>> return sctx->dirty_atoms & bit;
>> }
>> static inline void
>> si_mark_atom_dirty(struct si_context *sctx,
>> struct r600_atom *atom)
>> {
>> si_set_atom_dirty(sctx, atom, true);
>> }
>> -static inline struct tgsi_shader_info *si_get_vs_info(struct si_context
>> *sctx)
>> +static inline struct si_shader_ctx_state *si_get_vs(struct si_context
>> *sctx)
>> {
>> if (sctx->gs_shader.cso)
>> - return &sctx->gs_shader.cso->info;
>> - else if (sctx->tes_shader.cso)
>> - return &sctx->tes_shader.cso->info;
>> - else if (sctx->vs_shader.cso)
>> - return &sctx->vs_shader.cso->info;
>> - else
>> - return NULL;
>> + return &sctx->gs_shader;
>> + if (sctx->tes_shader.cso)
>> + return &sctx->tes_shader;
>> +
>> + return &sctx->vs_shader;
>> +}
>> +
>> +static inline struct tgsi_shader_info *si_get_vs_info(struct si_context
>> *sctx)
>> +{
>> + struct si_shader_ctx_state *vs = si_get_vs(sctx);
>> +
>> + return vs->cso ? &vs->cso->info : NULL;
>> }
>> static inline struct si_shader* si_get_vs_state(struct si_context
>> *sctx)
>> {
>> - if (sctx->gs_shader.current)
>> + if (sctx->gs_shader.cso)
>> return sctx->gs_shader.cso->gs_copy_shader;
>
>
> Mmmh, this was broken before, right?
No, it wasn't. Both "current" and "cso" are guaranteed to be
up-to-date here and !!cso == !!current, so it's not a change in
behavior, but the patch makes it clearer.
Marek
More information about the mesa-dev
mailing list