And use pipe_buffer_create_with_data instead of doing it
manually.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11296>
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);
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. */