diff options
-rw-r--r-- | src/gallium/drivers/r300/r300_state_shader.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state_shader.h | 2 |
2 files changed, 25 insertions, 5 deletions
diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index db84dbdc4e..06dd6842ed 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -160,10 +160,18 @@ static INLINE void r500_emit_mov(struct r500_fragment_shader* fs, { int i = fs->instruction_count; - fs->instructions[i].inst0 = R500_INST_TYPE_OUT | - R500_INST_TEX_SEM_WAIT | R500_INST_LAST | - R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK | + if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { + fs->instructions[i].inst0 = R500_INST_TYPE_OUT | + R500_ALU_OMASK(dst->DstRegister.WriteMask); + } else { + fs->instructions[i].inst0 = R500_INST_TYPE_ALU | + R500_ALU_WMASK(dst->DstRegister.WriteMask); + } + + fs->instructions[i].inst0 |= + R500_INST_TEX_SEM_WAIT | R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP; + fs->instructions[i].inst1 = R500_RGB_ADDR0(r300_fs_src(assembler, &src->SrcRegister)); fs->instructions[i].inst2 = @@ -233,6 +241,17 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, } } +static void r500_fs_finalize(struct r500_fragment_shader* fs, + struct r300_fs_asm* assembler) +{ + /* XXX subtly wrong */ + fs->shader.stack_size = assembler->temp_offset; + + /* XXX should this just go with OPCODE_END? */ + fs->instructions[fs->instruction_count - 1].inst0 |= + R500_INST_LAST; +} + void r300_translate_fragment_shader(struct r300_context* r300, struct r300_fragment_shader* fs) { @@ -280,8 +299,7 @@ void r500_translate_fragment_shader(struct r300_context* r300, assembler->tex_count, assembler->color_count, assembler->tex_count + assembler->color_count); - /* XXX subtly wrong */ - fs->shader.stack_size = assembler->temp_offset; + r500_fs_finalize(fs, assembler); tgsi_dump(fs->shader.state.tokens); r500_fs_dump(fs); diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index 5dd3584459..87a5c99648 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -54,6 +54,8 @@ #define R500_SWIZ_ALPHA_C(x) ((x) << 27) /* Writemasks */ #define R500_TEX_WMASK(x) ((x) << 11) +#define R500_ALU_WMASK(x) ((x) << 11) +#define R500_ALU_OMASK(x) ((x) << 15) /* Temporary struct used to hold assembly state while putting together * fragment programs. */ |