[Mesa-dev] [PATCH 2/2] st/mesa: use buffer usage history to set dirty flags for revalidation

Nicolai Hähnle nhaehnle at gmail.com
Tue Jun 7 19:43:33 UTC 2016


On 07.06.2016 16:08, Ilia Mirkin wrote:
> On Tue, Jun 7, 2016 at 8:50 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
>> On 04.06.2016 19:28, Ilia Mirkin wrote:
>>>
>>> We were previously unconditionally doing this for arrays and ubo's, and
>>> ignoring texture/storage/atomic buffers. Instead use the usage history
>>> to determine which atoms need to be revalidated.
>>
>>
>> Does this need to handle shader images as well?
>
> Hm, right. Of course there's no way to bind a buffer to an image
> (explicitly), so I think I can just do
>
> |   if (st_obj->Base.UsageHistory & USAGE_TEXTURE_BUFFER)
> |      st->dirty.st |= ST_NEW_SAMPLER_VIEWS | ST_NEW_IMAGE_UNITS
>
> What do you think?

Yes, that looks reasonable to me. With this change, you can add my R-b 
also to the second patch.

Cheers,
Nicolai

>
>>
>> Nicolai
>>
>>
>>>
>>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>> Cc: "12.0" <mesa-stable at lists.freedesktop.org>
>>> ---
>>>    src/mesa/state_tracker/st_cb_bufferobjects.c | 15 +++++++++++++--
>>>    1 file changed, 13 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c
>>> b/src/mesa/state_tracker/st_cb_bufferobjects.c
>>> index 8bbc2f0..cd57b6f 100644
>>> --- a/src/mesa/state_tracker/st_cb_bufferobjects.c
>>> +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
>>> @@ -332,8 +332,19 @@ st_bufferobj_data(struct gl_context *ctx,
>>>          }
>>>       }
>>>
>>> -   /* BufferData may change an array or uniform buffer, need to update it
>>> */
>>> -   st->dirty.st |= ST_NEW_VERTEX_ARRAYS | ST_NEW_UNIFORM_BUFFER;
>>> +   /* The current buffer may be bound, so we have to revalidate all atoms
>>> that
>>> +    * might be using it.
>>> +    */
>>> +   /* TODO: Add arrays to usage history */
>>> +   st->dirty.st |= ST_NEW_VERTEX_ARRAYS;
>>> +   if (st_obj->Base.UsageHistory & USAGE_UNIFORM_BUFFER)
>>> +      st->dirty.st |= ST_NEW_UNIFORM_BUFFER;
>>> +   if (st_obj->Base.UsageHistory & USAGE_SHADER_STORAGE_BUFFER)
>>> +      st->dirty.st |= ST_NEW_STORAGE_BUFFER;
>>> +   if (st_obj->Base.UsageHistory & USAGE_TEXTURE_BUFFER)
>>> +      st->dirty.st |= ST_NEW_SAMPLER_VIEWS;
>>> +   if (st_obj->Base.UsageHistory & USAGE_ATOMIC_COUNTER_BUFFER)
>>> +      st->dirty.st |= ST_NEW_ATOMIC_BUFFER;
>>>
>>>       return GL_TRUE;
>>>    }
>>>
>>


More information about the mesa-dev mailing list