[Mesa-dev] [PATCH] mesa: skip FLUSH_VERTICES() if no samplers were changed

Ian Romanick idr at freedesktop.org
Sat Jun 24 01:45:23 UTC 2017


On 06/22/2017 03:56 PM, Timothy Arceri wrote:
> ---
>  src/mesa/main/uniform_query.cpp | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index 1570770..9683fa8 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -1071,21 +1071,26 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
>      *     element that exceeds the highest array element index used, as
>      *     reported by GetActiveUniform, will be ignored by the GL."
>      *
>      * Clamp 'count' to a valid value.  Note that for non-arrays a count > 1
>      * will have already generated an error.
>      */
>     if (uni->array_elements != 0) {
>        count = MIN2(count, (int) (uni->array_elements - offset));
>     }
>  
> -   _mesa_flush_vertices_for_uniforms(ctx, uni);
> +   /* We check samplers for changes and flush if needed in the sampler
> +    * handling code further down, so just skip them here.
> +    */
> +   if (!uni->type->is_sampler()) {
> +       _mesa_flush_vertices_for_uniforms(ctx, uni);
> +   }

Do you have a test case where this helps performance (in a measurable
way)?  If so, I may have a branch for you to try.

>  
>     /* Store the data in the "actual type" backing storage for the uniform.
>      */
>     if (!uni->type->is_boolean() && !uni->is_bindless) {
>        memcpy(&uni->storage[size_mul * components * offset], values,
>               sizeof(uni->storage[0]) * components * count * size_mul);
>     } else if (uni->is_bindless) {
>        const union gl_constant_value *src =
>           (const union gl_constant_value *) values;
>        GLuint64 *dst = (GLuint64 *)&uni->storage[components * offset].i;
> 



More information about the mesa-dev mailing list