static void evergreen_emit_vs_sampler_views(struct r600_context *rctx, struct r600_atom *atom)
{
- evergreen_emit_sampler_views(rctx, &rctx->vs_samplers.views, 176 + R600_MAX_CONST_BUFFERS);
+ evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views, 176 + R600_MAX_CONST_BUFFERS);
}
static void evergreen_emit_ps_sampler_views(struct r600_context *rctx, struct r600_atom *atom)
{
- evergreen_emit_sampler_views(rctx, &rctx->ps_samplers.views, R600_MAX_CONST_BUFFERS);
+ evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views, R600_MAX_CONST_BUFFERS);
}
static void evergreen_emit_sampler_states(struct r600_context *rctx,
static void evergreen_emit_vs_sampler_states(struct r600_context *rctx, struct r600_atom *atom)
{
- evergreen_emit_sampler_states(rctx, &rctx->vs_samplers, 18, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX);
+ evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_VERTEX], 18, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX);
}
static void evergreen_emit_ps_sampler_states(struct r600_context *rctx, struct r600_atom *atom)
{
- evergreen_emit_sampler_states(rctx, &rctx->ps_samplers, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX);
+ evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT], 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX);
}
static void evergreen_emit_sample_mask(struct r600_context *rctx, struct r600_atom *a)
/* shader program */
r600_init_atom(rctx, &rctx->cs_shader_state.atom, id++, evergreen_emit_cs_shader, 0);
/* sampler */
- r600_init_atom(rctx, &rctx->vs_samplers.states.atom, id++, evergreen_emit_vs_sampler_states, 0);
- r600_init_atom(rctx, &rctx->ps_samplers.states.atom, id++, evergreen_emit_ps_sampler_states, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].states.atom, id++, evergreen_emit_vs_sampler_states, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].states.atom, id++, evergreen_emit_ps_sampler_states, 0);
/* resources */
r600_init_atom(rctx, &rctx->vertex_buffer_state.atom, id++, evergreen_fs_emit_vertex_buffers, 0);
r600_init_atom(rctx, &rctx->cs_vertex_buffer_state.atom, id++, evergreen_cs_emit_vertex_buffers, 0);
- r600_init_atom(rctx, &rctx->vs_samplers.views.atom, id++, evergreen_emit_vs_sampler_views, 0);
- r600_init_atom(rctx, &rctx->ps_samplers.views.atom, id++, evergreen_emit_ps_sampler_views, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views.atom, id++, evergreen_emit_vs_sampler_views, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views.atom, id++, evergreen_emit_ps_sampler_views, 0);
if (rctx->chip_class == EVERGREEN) {
r600_init_atom(rctx, &rctx->sample_mask.atom, id++, evergreen_emit_sample_mask, 3);
if (op & R600_SAVE_TEXTURES) {
util_blitter_save_fragment_sampler_states(
- rctx->blitter, util_last_bit(rctx->ps_samplers.states.enabled_mask),
- (void**)rctx->ps_samplers.states.states);
+ rctx->blitter, util_last_bit(rctx->samplers[PIPE_SHADER_FRAGMENT].states.enabled_mask),
+ (void**)rctx->samplers[PIPE_SHADER_FRAGMENT].states.states);
util_blitter_save_fragment_sampler_views(
- rctx->blitter, util_last_bit(rctx->ps_samplers.views.enabled_mask),
- (struct pipe_sampler_view**)rctx->ps_samplers.views.views);
+ rctx->blitter, util_last_bit(rctx->samplers[PIPE_SHADER_FRAGMENT].views.enabled_mask),
+ (struct pipe_sampler_view**)rctx->samplers[PIPE_SHADER_FRAGMENT].views.views);
}
if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) {
r600_atom_dirty(ctx, &ctx->cb_misc_state.atom);
r600_atom_dirty(ctx, &ctx->db_misc_state.atom);
- ctx->vs_samplers.states.dirty_mask = ctx->vs_samplers.states.enabled_mask;
- ctx->ps_samplers.states.dirty_mask = ctx->ps_samplers.states.enabled_mask;
- r600_sampler_states_dirty(ctx, &ctx->vs_samplers.states);
- r600_sampler_states_dirty(ctx, &ctx->ps_samplers.states);
-
if (ctx->chip_class <= R700) {
r600_atom_dirty(ctx, &ctx->seamless_cube_map.atom);
}
ctx->vertex_buffer_state.dirty_mask = ctx->vertex_buffer_state.enabled_mask;
r600_vertex_buffers_dirty(ctx);
+ /* Re-emit shader resources. */
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);
- }
+ struct r600_constbuf_state *constbuf = &ctx->constbuf_state[shader];
+ struct r600_textures_info *samplers = &ctx->samplers[shader];
- ctx->vs_samplers.views.dirty_mask = ctx->vs_samplers.views.enabled_mask;
- ctx->ps_samplers.views.dirty_mask = ctx->ps_samplers.views.enabled_mask;
- r600_sampler_views_dirty(ctx, &ctx->vs_samplers.views);
- r600_sampler_views_dirty(ctx, &ctx->ps_samplers.views);
+ constbuf->dirty_mask = constbuf->enabled_mask;
+ samplers->views.dirty_mask = samplers->views.enabled_mask;
+ samplers->states.dirty_mask = samplers->states.enabled_mask;
+
+ r600_constant_buffers_dirty(ctx, constbuf);
+ r600_sampler_views_dirty(ctx, &samplers->views);
+ r600_sampler_states_dirty(ctx, &samplers->states);
+ }
if (streamout_suspended) {
ctx->streamout_start = TRUE;
/** Vertex buffers for compute shaders */
struct r600_vertexbuf_state cs_vertex_buffer_state;
struct r600_constbuf_state constbuf_state[PIPE_SHADER_TYPES];
- struct r600_textures_info vs_samplers;
- struct r600_textures_info ps_samplers;
+ struct r600_textures_info samplers[PIPE_SHADER_TYPES];
struct r600_seamless_cube_map seamless_cube_map;
struct r600_cs_shader_state cs_shader_state;
struct r600_sample_mask sample_mask;
static void r600_emit_vs_sampler_views(struct r600_context *rctx, struct r600_atom *atom)
{
- r600_emit_sampler_views(rctx, &rctx->vs_samplers.views, 160 + R600_MAX_CONST_BUFFERS);
+ r600_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views, 160 + R600_MAX_CONST_BUFFERS);
}
static void r600_emit_ps_sampler_views(struct r600_context *rctx, struct r600_atom *atom)
{
- r600_emit_sampler_views(rctx, &rctx->ps_samplers.views, R600_MAX_CONST_BUFFERS);
+ r600_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views, R600_MAX_CONST_BUFFERS);
}
static void r600_emit_sampler_states(struct r600_context *rctx,
static void r600_emit_vs_sampler_states(struct r600_context *rctx, struct r600_atom *atom)
{
- r600_emit_sampler_states(rctx, &rctx->vs_samplers, 18, R_00A600_TD_VS_SAMPLER0_BORDER_RED);
+ r600_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_VERTEX], 18, R_00A600_TD_VS_SAMPLER0_BORDER_RED);
}
static void r600_emit_ps_sampler_states(struct r600_context *rctx, struct r600_atom *atom)
{
- r600_emit_sampler_states(rctx, &rctx->ps_samplers, 0, R_00A400_TD_PS_SAMPLER0_BORDER_RED);
+ r600_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT], 0, R_00A400_TD_PS_SAMPLER0_BORDER_RED);
}
static void r600_emit_seamless_cube_map(struct r600_context *rctx, struct r600_atom *atom)
/* 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)
*/
- r600_init_atom(rctx, &rctx->vs_samplers.states.atom, id++, r600_emit_vs_sampler_states, 0);
- r600_init_atom(rctx, &rctx->ps_samplers.states.atom, id++, r600_emit_ps_sampler_states, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].states.atom, id++, r600_emit_vs_sampler_states, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].states.atom, id++, r600_emit_ps_sampler_states, 0);
/* resource */
- r600_init_atom(rctx, &rctx->vs_samplers.views.atom, id++, r600_emit_vs_sampler_views, 0);
- r600_init_atom(rctx, &rctx->ps_samplers.views.atom, id++, r600_emit_ps_sampler_views, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views.atom, id++, r600_emit_vs_sampler_views, 0);
+ r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views.atom, id++, r600_emit_ps_sampler_views, 0);
r600_init_atom(rctx, &rctx->vertex_buffer_state.atom, id++, r600_emit_vertex_buffers, 0);
r600_init_atom(rctx, &rctx->seamless_cube_map.atom, id++, r600_emit_seamless_cube_map, 3);
unsigned count, void **states)
{
struct r600_context *rctx = (struct r600_context *)pipe;
- struct r600_textures_info *dst;
+ struct r600_textures_info *dst = &rctx->samplers[shader];
struct r600_pipe_sampler_state **rstates = (struct r600_pipe_sampler_state**)states;
int seamless_cube_map = -1;
unsigned i;
assert(start == 0); /* XXX fix below */
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- dst = &rctx->vs_samplers;
- break;
- case PIPE_SHADER_FRAGMENT:
- dst = &rctx->ps_samplers;
- break;
- default:
- debug_error("bad shader in r600_bind_samplers()");
- return;
- }
-
for (i = 0; i < count; i++) {
struct r600_pipe_sampler_state *rstate = rstates[i];
struct pipe_sampler_view **views)
{
struct r600_context *rctx = (struct r600_context *) pipe;
- struct r600_textures_info *dst;
+ struct r600_textures_info *dst = &rctx->samplers[shader];
struct r600_pipe_sampler_view **rviews = (struct r600_pipe_sampler_view **)views;
uint32_t dirty_sampler_states_mask = 0;
unsigned i;
assert(start == 0); /* XXX fix below */
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- dst = &rctx->vs_samplers;
- break;
- case PIPE_SHADER_FRAGMENT:
- dst = &rctx->ps_samplers;
- break;
- default:
- debug_error("bad shader in r600_set_sampler_views()");
- return;
- }
-
remaining_mask = dst->views.enabled_mask & disable_mask;
while (remaining_mask) {
unsigned ps_dirty = 0, blend_override;
if (!rctx->blitter->running) {
+ unsigned i;
+
/* Decompress textures if needed. */
- if (rctx->vs_samplers.views.compressed_depthtex_mask) {
- r600_decompress_depth_textures(rctx, &rctx->vs_samplers.views);
- }
- if (rctx->ps_samplers.views.compressed_depthtex_mask) {
- r600_decompress_depth_textures(rctx, &rctx->ps_samplers.views);
- }
- if (rctx->vs_samplers.views.compressed_colortex_mask) {
- r600_decompress_color_textures(rctx, &rctx->vs_samplers.views);
- }
- if (rctx->ps_samplers.views.compressed_colortex_mask) {
- r600_decompress_color_textures(rctx, &rctx->ps_samplers.views);
+ for (i = 0; i < PIPE_SHADER_TYPES; i++) {
+ struct r600_samplerview_state *views = &rctx->samplers[i].views;
+ if (views->compressed_depthtex_mask) {
+ r600_decompress_depth_textures(rctx, views);
+ }
+ if (views->compressed_colortex_mask) {
+ r600_decompress_color_textures(rctx, views);
+ }
}
}