Re: [Mesa-dev] [PATCH] mesa: skip FLUSH_VERTICES() if no samplers were changed
Reviewed-by: Marek Olšák Marek On Fri, Jun 23, 2017 at 12:56 AM, 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); > + } > > /* 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; > -- > 2.9.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: skip FLUSH_VERTICES() if no samplers were changed
On 24/06/17 11:45, Ian Romanick wrote: 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. No. It's just something I noticed that made sense to do. The drawoverhead perf test [1] could likely be modified reasonably easily to test this. What is the branch? [1] https://cgit.freedesktop.org/piglit/tree/tests/perf/drawoverhead.c /* 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; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: skip FLUSH_VERTICES() if no samplers were changed
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; > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev