mesa: call FLUSH_VERTICES before changing sampler uniforms

Fixes: 9545139ce5 "mesa: skip FLUSH_VERTICES() if no samplers were changed"

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
(cherry picked from commit 0a2117bc9e)
This commit is contained in:
Marek Olšák 2020-09-27 11:19:46 -04:00 committed by Dylan Baker
parent 17f0681ff9
commit 127a1b1244
2 changed files with 9 additions and 6 deletions

View file

@ -580,7 +580,7 @@
"description": "mesa: call FLUSH_VERTICES before changing sampler uniforms",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "9545139ce5f10180547568a3da94af9e291253fd"
},

View file

@ -1181,6 +1181,10 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
/* Mark this bindless sampler as bound to a texture unit.
*/
if (sampler->unit != value || !sampler->bound) {
if (!flushed) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM);
flushed = true;
}
sampler->unit = value;
changed = true;
}
@ -1188,6 +1192,10 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
sh->Program->sh.HasBoundBindlessSampler = true;
} else {
if (sh->Program->SamplerUnits[unit] != value) {
if (!flushed) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM);
flushed = true;
}
sh->Program->SamplerUnits[unit] = value;
changed = true;
}
@ -1195,11 +1203,6 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
}
if (changed) {
if (!flushed) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM);
flushed = true;
}
struct gl_program *const prog = sh->Program;
_mesa_update_shader_textures_used(shProg, prog);
if (ctx->Driver.SamplerUniformChange)