radeonsi: optimize set_inlinable_constants when they don't change
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11509>
This commit is contained in:
parent
86355b5984
commit
888b7ba338
|
@ -1231,9 +1231,21 @@ static void si_set_inlinable_constants(struct pipe_context *ctx,
|
|||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
|
||||
memcpy(sctx->inlinable_uniforms[shader], values, num_values * 4);
|
||||
sctx->inlinable_uniforms_valid_mask |= 1 << shader;
|
||||
sctx->do_update_shaders = true;
|
||||
if (!(sctx->inlinable_uniforms_valid_mask & BITFIELD_BIT(shader))) {
|
||||
/* It's the first time we set the constants. Always update shaders. */
|
||||
memcpy(sctx->inlinable_uniforms[shader], values, num_values * 4);
|
||||
sctx->inlinable_uniforms_valid_mask |= BITFIELD_BIT(shader);
|
||||
sctx->do_update_shaders = true;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We have already set inlinable constants for this shader. Update the shader only if
|
||||
* the constants are being changed so as not to update shaders needlessly.
|
||||
*/
|
||||
if (memcmp(sctx->inlinable_uniforms[shader], values, num_values * 4)) {
|
||||
memcpy(sctx->inlinable_uniforms[shader], values, num_values * 4);
|
||||
sctx->do_update_shaders = true;
|
||||
}
|
||||
}
|
||||
|
||||
void si_get_pipe_constant_buffer(struct si_context *sctx, uint shader, uint slot,
|
||||
|
|
Loading…
Reference in New Issue