From edb77ec3c770135280cc321326c7924b73fb535c Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 9 Jun 2021 10:32:41 +0200 Subject: [PATCH] radeonsi: delay sample_pos_buffer creation until first use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And use pipe_buffer_create_with_data instead of doing it manually. Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_pipe.c | 5 ----- src/gallium/drivers/radeonsi/si_state.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index f34e7e741a4..9eae6b18efb 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -717,11 +717,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign if (!sctx->dirty_implicit_resources) goto fail; - sctx->sample_pos_buffer = - pipe_buffer_create(sctx->b.screen, 0, PIPE_USAGE_DEFAULT, sizeof(sctx->sample_positions)); - pipe_buffer_write(&sctx->b, sctx->sample_pos_buffer, 0, sizeof(sctx->sample_positions), - &sctx->sample_positions); - /* The remainder of this function initializes the gfx CS and must be last. */ assert(sctx->gfx_cs.current.cdw == 0); diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 25db0ca54aa..9fefe1b59f5 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2947,6 +2947,11 @@ static void si_set_framebuffer_state(struct pipe_context *ctx, si_mark_atom_dirty(sctx, &sctx->atoms.s.msaa_config); si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state); + if (!sctx->sample_pos_buffer) { + sctx->sample_pos_buffer = pipe_buffer_create_with_data(&sctx->b, 0, PIPE_USAGE_DEFAULT, + sizeof(sctx->sample_positions), + &sctx->sample_positions); + } constbuf.buffer = sctx->sample_pos_buffer; /* Set sample locations as fragment shader constants. */