aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_emit.c
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-02-13 08:14:42 -0800
committerCorbin Simpson <[email protected]>2009-02-13 08:18:26 -0800
commit073a73e4c7344db46ab89862e2fbc267da34969c (patch)
tree69d3a800d7586be53f4fa3617d7e8215ec82f63c /src/gallium/drivers/r300/r300_emit.c
parentc273dfe6a28d4bb64ce167685b4053d22db5a727 (diff)
r300-gallium: Various thingies.
Add formats to framebuffer emit, fix up shader function names, make sure fragment format is emitted for r500.
Diffstat (limited to 'src/gallium/drivers/r300/r300_emit.c')
-rw-r--r--src/gallium/drivers/r300/r300_emit.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index c0990cabd9c..8108b99f944 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -136,6 +136,21 @@ void r500_emit_fragment_shader(struct r300_context* r300,
END_CS;
}
+/* Translate pipe_format into US_OUT_FMT. Note that formats are stored from
+ * C3 to C0. */
+uint32_t translate_out_fmt(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ return R300_US_OUT_FMT_C4_8 |
+ R300_C0_SEL_B | R300_C1_SEL_G |
+ R300_C2_SEL_R | R300_C3_SEL_A;
+ default:
+ return R300_US_OUT_FMT_UNUSED;
+ }
+ return 0;
+}
+
/* XXX add pitch, stride, z/stencil buf */
void r300_emit_fb_state(struct r300_context* r300,
struct pipe_framebuffer_state* fb)
@@ -149,6 +164,9 @@ void r300_emit_fb_state(struct r300_context* r300,
tex = (struct r300_texture*)fb->cbufs[i]->texture;
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),
+ translate_out_fmt(fb->cbufs[i]->format));
}
R300_PACIFY;
END_CS;