static void evergreen_emit_vs_constant_buffers(struct r600_context *rctx, struct r600_atom *atom)
{
- evergreen_emit_constant_buffers(rctx, &rctx->vs_constbuf_state, 176,
+ evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_VERTEX], 176,
R_028180_ALU_CONST_BUFFER_SIZE_VS_0,
R_028980_ALU_CONST_CACHE_VS_0);
}
static void evergreen_emit_ps_constant_buffers(struct r600_context *rctx, struct r600_atom *atom)
{
- evergreen_emit_constant_buffers(rctx, &rctx->ps_constbuf_state, 0,
+ evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_FRAGMENT], 0,
R_028140_ALU_CONST_BUFFER_SIZE_PS_0,
R_028940_ALU_CONST_CACHE_PS_0);
}
*/
/* shader const */
- r600_init_atom(rctx, &rctx->vs_constbuf_state.atom, id++, evergreen_emit_vs_constant_buffers, 0);
- r600_init_atom(rctx, &rctx->ps_constbuf_state.atom, id++, evergreen_emit_ps_constant_buffers, 0);
+ r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_VERTEX].atom, id++, evergreen_emit_vs_constant_buffers, 0);
+ r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_FRAGMENT].atom, id++, evergreen_emit_ps_constant_buffers, 0);
/* shader program */
r600_init_atom(rctx, &rctx->cs_shader_state.atom, id++, evergreen_emit_cs_shader, 0);
/* sampler */
}
static void r600_set_constants_dirty_if_bound(struct r600_context *rctx,
- struct r600_constbuf_state *state,
struct r600_resource *rbuffer)
{
- bool found = false;
- uint32_t mask = state->enabled_mask;
-
- while (mask) {
- unsigned i = u_bit_scan(&mask);
- if (state->cb[i].buffer == &rbuffer->b.b) {
- found = true;
- state->dirty_mask |= 1 << i;
+ unsigned shader;
+
+ for (shader = 0; shader < PIPE_SHADER_TYPES; shader++) {
+ struct r600_constbuf_state *state = &rctx->constbuf_state[shader];
+ bool found = false;
+ uint32_t mask = state->enabled_mask;
+
+ while (mask) {
+ unsigned i = u_bit_scan(&mask);
+ if (state->cb[i].buffer == &rbuffer->b.b) {
+ found = true;
+ state->dirty_mask |= 1 << i;
+ }
+ }
+ if (found) {
+ r600_constant_buffers_dirty(rctx, state);
}
- }
- if (found) {
- r600_constant_buffers_dirty(rctx, state);
}
}
}
}
/* Constant buffers. */
- r600_set_constants_dirty_if_bound(rctx, &rctx->vs_constbuf_state, rbuffer);
- r600_set_constants_dirty_if_bound(rctx, &rctx->ps_constbuf_state, rbuffer);
+ r600_set_constants_dirty_if_bound(rctx, rbuffer);
}
}
#if 0 /* this is broken (see Bug 53130) */
bool timer_queries_suspended = false;
bool nontimer_queries_suspended = false;
bool streamout_suspended = false;
+ unsigned shader;
if (cs->cdw == ctx->start_cs_cmd.atom.num_dw)
return;
ctx->vertex_buffer_state.dirty_mask = ctx->vertex_buffer_state.enabled_mask;
r600_vertex_buffers_dirty(ctx);
- ctx->vs_constbuf_state.dirty_mask = ctx->vs_constbuf_state.enabled_mask;
- ctx->ps_constbuf_state.dirty_mask = ctx->ps_constbuf_state.enabled_mask;
- r600_constant_buffers_dirty(ctx, &ctx->vs_constbuf_state);
- r600_constant_buffers_dirty(ctx, &ctx->ps_constbuf_state);
+ for (shader = 0; shader < PIPE_SHADER_TYPES; shader++) {
+ struct r600_constbuf_state *state = &ctx->constbuf_state[shader];
+ state->dirty_mask = state->enabled_mask;
+ r600_constant_buffers_dirty(ctx, state);
+ }
ctx->vs_samplers.views.dirty_mask = ctx->vs_samplers.views.enabled_mask;
ctx->ps_samplers.views.dirty_mask = ctx->ps_samplers.views.enabled_mask;
struct r600_vertexbuf_state vertex_buffer_state;
/** Vertex buffers for compute shaders */
struct r600_vertexbuf_state cs_vertex_buffer_state;
- struct r600_constbuf_state vs_constbuf_state;
- struct r600_constbuf_state ps_constbuf_state;
+ struct r600_constbuf_state constbuf_state[PIPE_SHADER_TYPES];
struct r600_textures_info vs_samplers;
struct r600_textures_info ps_samplers;
struct r600_seamless_cube_map seamless_cube_map;
static void r600_emit_vs_constant_buffers(struct r600_context *rctx, struct r600_atom *atom)
{
- r600_emit_constant_buffers(rctx, &rctx->vs_constbuf_state, 160,
+ r600_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_VERTEX], 160,
R_028180_ALU_CONST_BUFFER_SIZE_VS_0,
R_028980_ALU_CONST_CACHE_VS_0);
}
static void r600_emit_ps_constant_buffers(struct r600_context *rctx, struct r600_atom *atom)
{
- r600_emit_constant_buffers(rctx, &rctx->ps_constbuf_state, 0,
+ r600_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_FRAGMENT], 0,
R_028140_ALU_CONST_BUFFER_SIZE_PS_0,
R_028940_ALU_CONST_CACHE_PS_0);
}
*/
/* shader const */
- r600_init_atom(rctx, &rctx->vs_constbuf_state.atom, id++, r600_emit_vs_constant_buffers, 0);
- r600_init_atom(rctx, &rctx->ps_constbuf_state.atom, id++, r600_emit_ps_constant_buffers, 0);
+ r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_VERTEX].atom, id++, r600_emit_vs_constant_buffers, 0);
+ r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_FRAGMENT].atom, id++, r600_emit_ps_constant_buffers, 0);
/* sampler must be emited before TA_CNTL_AUX otherwise DISABLE_CUBE_WRAP change
* does not take effect (TA_CNTL_AUX emited by r600_emit_seamless_cube_map)
struct pipe_constant_buffer *input)
{
struct r600_context *rctx = (struct r600_context *)ctx;
- struct r600_constbuf_state *state;
+ struct r600_constbuf_state *state = &rctx->constbuf_state[shader];
struct pipe_constant_buffer *cb;
const uint8_t *ptr;
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- state = &rctx->vs_constbuf_state;
- break;
- case PIPE_SHADER_FRAGMENT:
- state = &rctx->ps_constbuf_state;
- break;
- default:
- return;
- }
-
/* Note that the state tracker can unbind constant buffers by
* passing NULL here.
*/