From 073a73e4c7344db46ab89862e2fbc267da34969c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 13 Feb 2009 08:14:42 -0800 Subject: r300-gallium: Various thingies. Add formats to framebuffer emit, fix up shader function names, make sure fragment format is emitted for r500. --- src/gallium/drivers/r300/r300_emit.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gallium/drivers/r300/r300_emit.c') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index c0990cabd9..8108b99f94 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; -- cgit v1.2.3