From: Marek Olšák Date: Sat, 10 Jun 2017 15:22:09 +0000 (+0200) Subject: mesa: don't flag _NEW_PROGRAM_CONSTANTS for GLSL programs for st/mesa X-Git-Tag: upstream/18.1.0~8537 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=caf39d6df9de145060d7def72c20ca45e41b1e9c;p=platform%2Fupstream%2Fmesa.git mesa: don't flag _NEW_PROGRAM_CONSTANTS for GLSL programs for st/mesa v2: also update _mesa_uniform_handle for bindless textures Reviewed-by: Nicolai Hähnle (v1) Reviewed-by: Brian Paul (v1) Reviewed-by: Timothy Arceri (v1) Reviewed-by: Samuel Pitoiset --- diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 9f0122a..5a71240 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2586,6 +2586,7 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, } i = 0; + bool flushed = false; do { struct gl_uniform_storage *uni = p->sh.SubroutineUniformRemapTable[i]; if (uni == NULL) { @@ -2593,6 +2594,11 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, continue; } + if (!flushed) { + _mesa_flush_vertices_for_uniforms(ctx, uni); + flushed = true; + } + int uni_count = uni->array_elements ? uni->array_elements : 1; int j, k, f; @@ -2625,8 +2631,6 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, } i += uni_count; } while(i < count); - - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); } diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 37c130a..5eb0efc 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -1002,6 +1002,23 @@ validate_uniform(GLint location, GLsizei count, const GLvoid *values, return uni; } +void +_mesa_flush_vertices_for_uniforms(struct gl_context *ctx, + const struct gl_uniform_storage *uni) +{ + uint64_t new_driver_state = 0; + unsigned mask = uni->active_shader_mask; + + while (mask) { + unsigned index = u_bit_scan(&mask); + + assert(index < MESA_SHADER_STAGES); + new_driver_state |= ctx->DriverFlags.NewShaderConstants[index]; + } + + FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS); + ctx->NewDriverState |= new_driver_state; +} /** * Called via glUniform*() functions. @@ -1056,7 +1073,7 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values, count = MIN2(count, (int) (uni->array_elements - offset)); } - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + _mesa_flush_vertices_for_uniforms(ctx, uni); /* Store the data in the "actual type" backing storage for the uniform. */ @@ -1272,7 +1289,7 @@ _mesa_uniform_matrix(GLint location, GLsizei count, count = MIN2(count, (int) (uni->array_elements - offset)); } - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + _mesa_flush_vertices_for_uniforms(ctx, uni); /* Store the data in the "actual type" backing storage for the uniform. */ @@ -1426,7 +1443,7 @@ _mesa_uniform_handle(GLint location, GLsizei count, const GLvoid *values, count = MIN2(count, (int) (uni->array_elements - offset)); } - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + _mesa_flush_vertices_for_uniforms(ctx, uni); /* Store the data in the "actual type" backing storage for the uniform. */ diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h index bd42b4f..ebeaf9d 100644 --- a/src/mesa/main/uniforms.h +++ b/src/mesa/main/uniforms.h @@ -486,6 +486,10 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg, extern bool _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *); +extern void +_mesa_flush_vertices_for_uniforms(struct gl_context *ctx, + const struct gl_uniform_storage *uni); + struct gl_builtin_uniform_element { const char *field; int tokens[STATE_LENGTH]; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index f74f391..18f2026 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -243,9 +243,6 @@ st_invalidate_state(struct gl_context * ctx) st->dirty |= ST_NEW_FS_STATE; } } - - if (new_state & _NEW_PROGRAM_CONSTANTS) - st->dirty |= st->active_states & ST_NEW_CONSTANTS; }