freedreno/a6xx: Move user const upload to bind

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>
This commit is contained in:
Rob Clark
2022-09-18 11:34:33 -07:00
committed by Marge Bot
parent f8204018fd
commit 2f3b980caa
2 changed files with 16 additions and 15 deletions
+4 -15
View File
@@ -187,8 +187,8 @@ fd6_build_tess_consts(struct fd6_emit *emit)
}
static void
fd6_emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v,
struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf)
fd6_emit_ubos(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
struct fd_constbuf_stateobj *constbuf)
{
const struct ir3_const_state *const_state = ir3_const_state(v);
int num_ubos = const_state->num_ubos;
@@ -216,17 +216,6 @@ fd6_emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v,
struct pipe_constant_buffer *cb = &constbuf->cb[i];
/* If we have user pointers (constbuf 0, aka GL uniforms), upload them
* to a buffer now, and save it in the constbuf so that we don't have
* to reupload until they get changed.
*/
if (cb->user_buffer) {
struct pipe_context *pctx = &ctx->base;
u_upload_data(pctx->stream_uploader, 0, cb->buffer_size, 64,
cb->user_buffer, &cb->buffer_offset, &cb->buffer);
cb->user_buffer = NULL;
}
if (cb->buffer) {
int size_vec4s = DIV_ROUND_UP(cb->buffer_size, 16);
OUT_RELOC(ring, fd_resource(cb->buffer)->bo, cb->buffer_offset,
@@ -280,7 +269,7 @@ fd6_build_user_consts(struct fd6_emit *emit)
continue;
ir3_emit_user_consts(variants[i], constobj,
&ctx->constbuf[types[i]]);
fd6_emit_ubos(ctx, variants[i], constobj, &ctx->constbuf[types[i]]);
fd6_emit_ubos(variants[i], constobj, &ctx->constbuf[types[i]]);
}
return constobj;
@@ -337,7 +326,7 @@ fd6_emit_cs_consts(const struct ir3_shader_variant *v,
const struct pipe_grid_info *info)
{
ir3_emit_cs_consts(v, ring, ctx, info);
fd6_emit_ubos(ctx, v, ring, &ctx->constbuf[PIPE_SHADER_COMPUTE]);
fd6_emit_ubos(v, ring, &ctx->constbuf[PIPE_SHADER_COMPUTE]);
}
void
@@ -29,6 +29,7 @@
#include "util/u_helpers.h"
#include "util/u_memory.h"
#include "util/u_string.h"
#include "util/u_upload_mgr.h"
#include "freedreno_context.h"
#include "freedreno_gmem.h"
@@ -103,6 +104,14 @@ fd_set_min_samples(struct pipe_context *pctx, unsigned min_samples) in_dt
fd_context_dirty(ctx, FD_DIRTY_MIN_SAMPLES);
}
static void
upload_user_buffer(struct pipe_context *pctx, struct pipe_constant_buffer *cb)
{
u_upload_data(pctx->stream_uploader, 0, cb->buffer_size, 64,
cb->user_buffer, &cb->buffer_offset, &cb->buffer);
cb->user_buffer = NULL;
}
/* notes from calim on #dri-devel:
* index==0 will be non-UBO (ie. glUniformXYZ()) all packed together padded
* out to vec4's
@@ -129,6 +138,9 @@ fd_set_constant_buffer(struct pipe_context *pctx, enum pipe_shader_type shader,
return;
}
if (cb->user_buffer && ctx->screen->gen >= 6)
upload_user_buffer(pctx, &so->cb[index]);
so->enabled_mask |= 1 << index;
fd_context_dirty_shader(ctx, shader, FD_DIRTY_SHADER_CONST);