}
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;
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,
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;
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
#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"
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
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);