From: Corbin Simpson Date: Fri, 24 Apr 2009 23:53:38 +0000 (-0700) Subject: r300-gallium: Clean up FB state emit. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f45a7a1d1f8a576daf02e94ecabfd42f556dd9b4;p=mesa.git r300-gallium: Clean up FB state emit. --- diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index cce5c591f10..74d63ffe417 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -152,38 +152,38 @@ void r500_emit_fragment_shader(struct r300_context* r300, END_CS; } -/* XXX add pitch, stride, clean up */ void r300_emit_fb_state(struct r300_context* r300, struct pipe_framebuffer_state* fb) { - int i; struct r300_texture* tex; + unsigned pixpitch; + int i; CS_LOCALS(r300); - BEGIN_CS((7 * fb->nr_cbufs) + (fb->zsbuf ? 7 : 0) + 4); + BEGIN_CS((8 * fb->nr_cbufs) + (fb->zsbuf ? 8 : 0) + 4); for (i = 0; i < fb->nr_cbufs; i++) { tex = (struct r300_texture*)fb->cbufs[i]->texture; + pixpitch = tex->stride / tex->tex.block.size; + OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), - r300_translate_out_fmt(fb->cbufs[i]->format)); - unsigned pixpitch = tex->stride / tex->tex.block.size; OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), pixpitch | r300_translate_colorformat(tex->tex.format)); + + OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), + r300_translate_out_fmt(fb->cbufs[i]->format)); } if (fb->zsbuf) { tex = (struct r300_texture*)fb->zsbuf->texture; + pixpitch = (tex->stride / tex->tex.block.size); + OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - if (fb->zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) { - OUT_CS_REG(R300_ZB_FORMAT, - R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL); - } else { - OUT_CS_REG(R300_ZB_FORMAT, 0x0); - } - unsigned pixpitch = tex->stride / tex->tex.block.size; + + OUT_CS_REG(R300_ZB_FORMAT, r300_translate_zsformat(tex->tex.format)); + OUT_CS_REG(R300_ZB_DEPTHPITCH, pixpitch); }