summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_emit.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2009-12-24 17:40:53 +0100
committerCorbin Simpson <[email protected]>2010-01-06 12:49:15 -0800
commite78648db0a91269ed83238bfa3ced5d4d7dae2e0 (patch)
tree50bd53465789976af9636a9a174af1ef18070444 /src/gallium/drivers/r300/r300_emit.c
parent7c902b43d84f5508764e64d95f7359897a1aad0a (diff)
r300g: fix outputting depth in the FS
Diffstat (limited to 'src/gallium/drivers/r300/r300_emit.c')
-rw-r--r--src/gallium/drivers/r300/r300_emit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 1dc9216a7b2..596ec21bc0e 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -283,6 +283,22 @@ void r300_emit_fs_constant_buffer(struct r300_context* r300,
END_CS;
}
+static void r300_emit_fragment_depth_config(struct r300_context* r300,
+ struct r300_fragment_shader* fs)
+{
+ CS_LOCALS(r300);
+
+ BEGIN_CS(4);
+ if (r300_fragment_shader_writes_depth(fs)) {
+ OUT_CS_REG(R300_FG_DEPTH_SRC, R300_FG_DEPTH_SRC_SHADER);
+ OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W24 | R300_W_SRC_US);
+ } else {
+ OUT_CS_REG(R300_FG_DEPTH_SRC, R300_FG_DEPTH_SRC_SCAN);
+ OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0 | R300_W_SRC_US);
+ }
+ END_CS;
+}
+
void r500_emit_fragment_program_code(struct r300_context* r300,
struct rX00_fragment_program_code* generic_code)
{
@@ -1036,6 +1052,7 @@ validate:
}
if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) {
+ r300_emit_fragment_depth_config(r300, r300->fs);
if (r300screen->caps->is_r500) {
r500_emit_fragment_program_code(r300, &r300->fs->shader->code);
} else {