uint32_t start_base = base;
unsigned i;
- // XXX TODO only emit dirty consts.. but we need to keep track if
- // they are clobbered by a clear, gmem2mem, or mem2gmem..
- constbuf->dirty_mask = enabled_mask;
-
/* emit user constants: */
while (enabled_mask) {
unsigned index = ffs(enabled_mask) - 1;
if (shader && ((base - start_base) >= (shader->first_immediate * 4)))
break;
- if (constbuf->dirty_mask & (1 << index)) {
- const uint32_t *dwords;
-
- if (cb->user_buffer) {
- dwords = cb->user_buffer;
- } else {
- struct fd_resource *rsc = fd_resource(cb->buffer);
- dwords = fd_bo_map(rsc->bo);
- }
+ const uint32_t *dwords;
- dwords = (uint32_t *)(((uint8_t *)dwords) + cb->buffer_offset);
+ if (cb->user_buffer) {
+ dwords = cb->user_buffer;
+ } else {
+ struct fd_resource *rsc = fd_resource(cb->buffer);
+ dwords = fd_bo_map(rsc->bo);
+ }
- OUT_PKT3(ring, CP_SET_CONSTANT, size + 1);
- OUT_RING(ring, base);
- for (i = 0; i < size; i++)
- OUT_RING(ring, *(dwords++));
+ dwords = (uint32_t *)(((uint8_t *)dwords) + cb->buffer_offset);
- constbuf->dirty_mask &= ~(1 << index);
- }
+ OUT_PKT3(ring, CP_SET_CONSTANT, size + 1);
+ OUT_RING(ring, base);
+ for (i = 0; i < size; i++)
+ OUT_RING(ring, *(dwords++));
base += size;
enabled_mask &= ~(1 << index);
enum pipe_shader_type shader)
{
struct fd_shaderimg_stateobj *so = &ctx->shaderimg[shader];
+ unsigned enabled_mask = so->enabled_mask;
- so->dirty_mask &= so->enabled_mask;
-
- while (so->dirty_mask) {
- unsigned index = u_bit_scan(&so->dirty_mask);
+ while (enabled_mask) {
+ unsigned index = u_bit_scan(&enabled_mask);
unsigned slot = get_image_slot(index);
struct fd5_image img;
emit_image_ssbo(ring, slot, &img, shader);
}
}
-
struct fd_constbuf_stateobj {
struct pipe_constant_buffer cb[PIPE_MAX_CONSTANT_BUFFERS];
uint32_t enabled_mask;
- uint32_t dirty_mask;
};
struct fd_shaderbuf_stateobj {
struct pipe_shader_buffer sb[PIPE_MAX_SHADER_BUFFERS];
uint32_t enabled_mask;
- uint32_t dirty_mask;
};
struct fd_shaderimg_stateobj {
struct pipe_image_view si[PIPE_MAX_SHADER_IMAGES];
uint32_t enabled_mask;
- uint32_t dirty_mask;
};
struct fd_vertexbuf_stateobj {
struct pipe_vertex_buffer vb[PIPE_MAX_ATTRIBS];
unsigned count;
uint32_t enabled_mask;
- uint32_t dirty_mask;
};
struct fd_vertex_stateobj {
*/
if (unlikely(!cb)) {
so->enabled_mask &= ~(1 << index);
- so->dirty_mask &= ~(1 << index);
return;
}
so->enabled_mask |= 1 << index;
- so->dirty_mask |= 1 << index;
ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_CONST;
ctx->dirty |= FD_DIRTY_CONST;
}
so->enabled_mask &= ~mask;
}
- so->dirty_mask |= mask;
ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_SSBO;
}
so->enabled_mask &= ~mask;
}
- so->dirty_mask |= mask;
ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_IMAGE;
}
struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf)
{
const unsigned index = 0; /* user consts are index 0 */
- /* TODO save/restore dirty_mask for binning pass instead: */
- uint32_t dirty_mask = constbuf->enabled_mask;
- if (dirty_mask & (1 << index)) {
+ if (constbuf->enabled_mask & (1 << index)) {
struct pipe_constant_buffer *cb = &constbuf->cb[index];
unsigned size = align(cb->buffer_size, 4) / 4; /* size in dwords */
ctx->emit_const(ring, v->type, 0,
cb->buffer_offset, size,
cb->user_buffer, cb->buffer);
- constbuf->dirty_mask &= ~(1 << index);
}
}
}