diff options
author | Corbin Simpson <[email protected]> | 2009-03-15 23:04:49 -0700 |
---|---|---|
committer | Corbin Simpson <[email protected]> | 2009-03-15 23:07:31 -0700 |
commit | 44adea1a0975ebad59790b9cfd03439aa44559fc (patch) | |
tree | afa2f5369432209d9efb6e4c6eaf1ba9a285b232 /src/gallium/drivers/r300/r300_state_shader.c | |
parent | 1e56bb890bff5a9750dbd439e91ce03c87a750b8 (diff) |
r300-gallium: r500-fs: Setup immediates.
Textures still not working. RS block shenanigans expected.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_shader.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_state_shader.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 06dd6842ed8..519879114a9 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -82,6 +82,13 @@ static INLINE unsigned r300_fs_src(struct r300_fs_asm* assembler, case TGSI_FILE_TEMPORARY: return src->Index + assembler->temp_offset; break; + case TGSI_FILE_IMMEDIATE: + return src->Index + assembler->imm_offset | (1 << 8); + break; + case TGSI_FILE_CONSTANT: + /* XXX magic */ + return src->Index | (1 << 8); + break; default: debug_printf("r300: fs: Unimplemented src %d\n", src->File); break; @@ -269,11 +276,13 @@ void r300_translate_fragment_shader(struct r300_context* r300, void r500_translate_fragment_shader(struct r300_context* r300, struct r500_fragment_shader* fs) { + struct tgsi_parse_context parser; + int i, imm_const_offset; + struct r300_fs_asm* assembler = CALLOC_STRUCT(r300_fs_asm); if (assembler == NULL) { return; } - struct tgsi_parse_context parser; tgsi_parse_init(&parser, fs->shader.state.tokens); @@ -288,9 +297,24 @@ void r500_translate_fragment_shader(struct r300_context* r300, * of the program. */ r300_fs_declare(assembler, &parser.FullToken.FullDeclaration); break; + case TGSI_TOKEN_TYPE_IMMEDIATE: + assembler->imm_offset++; + imm_const_offset = assembler->imm_offset + + r300->shader_constants[PIPE_SHADER_FRAGMENT].user_count; + /* I am not amused by the length of these. */ + for (i = 0; i < 4; i++) { + r300->shader_constants[PIPE_SHADER_FRAGMENT].constants + [imm_const_offset][i] = + parser.FullToken.FullImmediate.u.ImmediateFloat32[i] + .Float; + } + r300->shader_constants[PIPE_SHADER_FRAGMENT].count = + imm_const_offset; + break; case TGSI_TOKEN_TYPE_INSTRUCTION: r500_fs_instruction(fs, assembler, &parser.FullToken.FullInstruction); + break; } } |