+static void r300_set_stencil_ref(struct pipe_context* pipe,
+ const struct pipe_stencil_ref* sr)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ r300->stencil_ref = *sr;
+ r300->dsa_state.dirty = TRUE;
+}
+
+/* This switcheroo is needed just because of goddamned MACRO_SWITCH. */
+static void r300_fb_update_tiling_flags(struct r300_context *r300,
+ const struct pipe_framebuffer_state *old_state,
+ const struct pipe_framebuffer_state *new_state)
+{
+ struct r300_texture *tex;
+ unsigned i, j, level;
+
+ /* Reset tiling flags for old surfaces to default values. */
+ for (i = 0; i < old_state->nr_cbufs; i++) {
+ for (j = 0; j < new_state->nr_cbufs; j++) {
+ if (old_state->cbufs[i]->texture == new_state->cbufs[j]->texture) {
+ break;
+ }
+ }
+ /* If not binding the surface again... */
+ if (j != new_state->nr_cbufs) {
+ continue;
+ }
+
+ tex = (struct r300_texture*)old_state->cbufs[i]->texture;
+
+ if (tex) {
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ tex->pitch[0],
+ tex->microtile,
+ tex->macrotile);
+ }
+ }
+ if (old_state->zsbuf &&
+ (!new_state->zsbuf ||
+ old_state->zsbuf->texture != new_state->zsbuf->texture)) {
+ tex = (struct r300_texture*)old_state->zsbuf->texture;
+
+ if (tex) {
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ tex->pitch[0],
+ tex->microtile,
+ tex->macrotile);
+ }
+ }
+
+ /* Set tiling flags for new surfaces. */
+ for (i = 0; i < new_state->nr_cbufs; i++) {
+ tex = (struct r300_texture*)new_state->cbufs[i]->texture;
+ level = new_state->cbufs[i]->level;
+
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ tex->pitch[level],
+ tex->microtile,
+ tex->mip_macrotile[level]);
+ }
+ if (new_state->zsbuf) {
+ tex = (struct r300_texture*)new_state->zsbuf->texture;
+ level = new_state->zsbuf->level;
+
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ tex->pitch[level],
+ tex->microtile,
+ tex->mip_macrotile[level]);
+ }
+}
+