summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv30/nv30_state.c
diff options
context:
space:
mode:
authorPatrice Mandin <pmandin@caramail.com>2008-07-03 20:58:31 +0200
committerPatrice Mandin <pmandin@caramail.com>2008-07-03 20:58:31 +0200
commit36488ed052a18f7eafef1d1c5c18b20ad508b2b7 (patch)
treebc0908481856abab317551a53da1016a9b61aa8c /src/gallium/drivers/nv30/nv30_state.c
parent9833aec6cbd113d24277aa5da8625c1427d831ca (diff)
nv30: Emit framebuffer state using state objects
Diffstat (limited to 'src/gallium/drivers/nv30/nv30_state.c')
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c105
1 files changed, 2 insertions, 103 deletions
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
index c1618041bb..3edfb0874d 100644
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ b/src/gallium/drivers/nv30/nv30_state.c
@@ -565,110 +565,9 @@ nv30_set_framebuffer_state(struct pipe_context *pipe,
const struct pipe_framebuffer_state *fb)
{
struct nv30_context *nv30 = nv30_context(pipe);
- struct pipe_surface *rt[2], *zeta = NULL;
- uint32_t rt_enable, rt_format, w = 0, h = 0;
- int i, colour_format = 0, zeta_format = 0;
-
- rt_enable = 0;
- for (i = 0; i < 2; i++) {
- if (!fb->cbufs[i])
- continue;
-
- if (colour_format) {
- assert(w == fb->cbufs[i]->width);
- assert(h == fb->cbufs[i]->height);
- assert(colour_format == fb->cbufs[i]->format);
- } else {
- w = fb->cbufs[i]->width;
- h = fb->cbufs[i]->height;
- colour_format = fb->cbufs[i]->format;
- rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i);
- rt[i] = fb->cbufs[i];
- }
- }
-
- if (rt_enable & (NV34TCL_RT_ENABLE_COLOR1 | NV34TCL_RT_ENABLE_COLOR2 |
- NV34TCL_RT_ENABLE_COLOR3))
- rt_enable |= NV34TCL_RT_ENABLE_MRT;
-
- if (fb->zsbuf) {
- if (colour_format) {
- assert(w == fb->zsbuf->width);
- assert(h == fb->zsbuf->height);
- } else {
- w = fb->zsbuf->width;
- h = fb->zsbuf->height;
- }
-
- zeta_format = fb->zsbuf->format;
- zeta = fb->zsbuf;
- }
-
- rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
-
- switch (colour_format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case 0:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8;
- break;
- case PIPE_FORMAT_R5G6B5_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5;
- break;
- default:
- assert(0);
- }
-
- switch (zeta_format) {
- case PIPE_FORMAT_Z16_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16;
- break;
- case PIPE_FORMAT_Z24S8_UNORM:
- case 0:
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8;
- break;
- default:
- assert(0);
- }
-
- if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) {
- uint32_t pitch = rt[0]->stride;
- if (zeta) {
- pitch |= (zeta->stride << 16);
- } else {
- pitch |= (pitch << 16);
- }
-
- BEGIN_RING(rankine, NV34TCL_COLOR0_PITCH, 1);
- OUT_RING (pitch);
- nv30->rt[0] = rt[0]->buffer;
- }
-
- if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
- BEGIN_RING(rankine, NV34TCL_COLOR1_PITCH, 1);
- OUT_RING (rt[1]->stride);
- nv30->rt[1] = rt[1]->buffer;
- }
-
- if (zeta_format)
- {
- nv30->zeta = zeta->buffer;
- }
- nv30->rt_enable = rt_enable;
- BEGIN_RING(rankine, NV34TCL_RT_ENABLE, 1);
- OUT_RING (rt_enable);
- BEGIN_RING(rankine, NV34TCL_RT_HORIZ, 3);
- OUT_RING ((w << 16) | 0);
- OUT_RING ((h << 16) | 0);
- OUT_RING (rt_format);
- BEGIN_RING(rankine, NV34TCL_VIEWPORT_HORIZ, 2);
- OUT_RING ((w << 16) | 0);
- OUT_RING ((h << 16) | 0);
- BEGIN_RING(rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2);
- OUT_RING (((w - 1) << 16) | 0);
- OUT_RING (((h - 1) << 16) | 0);
- BEGIN_RING(rankine, NV34TCL_VIEWPORT_TX_ORIGIN, 1);
- OUT_RING (0);
+ nv30->framebuffer = *fb;
+ nv30->dirty |= NV30_NEW_FB;
}
static void