Mesa (master): r600g: accept empty frag prog shader

Jerome Glisse glisse at kemper.freedesktop.org
Wed Aug 11 11:26:10 PDT 2010


Module: Mesa
Branch: master
Commit: 481b65abaedb271d0da24c75b8c60f7bcf6d8ce9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=481b65abaedb271d0da24c75b8c60f7bcf6d8ce9

Author: Jerome Glisse <jglisse at redhat.com>
Date:   Wed Aug 11 14:26:07 2010 -0400

r600g: accept empty frag prog shader

Signed-off-by: Jerome Glisse <jglisse at redhat.com>

---

 src/gallium/drivers/r600/r600_asm.c    |    3 +--
 src/gallium/drivers/r600/r600_shader.c |   15 +++++++++++++++
 src/gallium/drivers/r600/r600_state.c  |    2 +-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index ae818bf..9ea9d43 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -167,8 +167,7 @@ int r600_bc_add_literal(struct r600_bc *bc, const u32 *value)
 	struct r600_bc_alu *alu;
 
 	if (bc->cf_last == NULL) {
-		R600_ERR("no last CF\n");
-		return -EINVAL;
+		return 0;
 	}
 	if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_TEX) {
 		return 0;
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index cbeb692..956c7e7 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -494,6 +494,21 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
 			noutput++;
 		}
 	}
+	/* add fake pixel export */
+	if (ctx.type == TGSI_PROCESSOR_FRAGMENT && !noutput) {
+		memset(&output[0], 0, sizeof(struct r600_bc_output));
+		output[0].gpr = 0;
+		output[0].elem_size = 3;
+		output[0].swizzle_x = 7;
+		output[0].swizzle_y = 7;
+		output[0].swizzle_z = 7;
+		output[0].swizzle_w = 7;
+		output[0].barrier = 1;
+		output[0].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM;
+		output[0].array_base = 0;
+		output[0].inst = V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT;
+		noutput++;
+	}
 	/* set export done on last export of each type */
 	for (i = noutput - 1, output_done = 0; i >= 0; i--) {
 		if (i == (noutput - 1)) {
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index a50b75c..ed2d9f9 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -727,7 +727,7 @@ static struct radeon_state *r600_db(struct r600_context *rctx)
 	struct r600_resource *rbuffer;
 	struct radeon_state *rstate;
 	const struct pipe_framebuffer_state *state = &rctx->framebuffer->state.framebuffer;
-	unsigned level = state->cbufs[0]->level;
+	unsigned level;
 	unsigned pitch, slice, format;
 
 	if (state->zsbuf == NULL)



More information about the mesa-commit mailing list